Name: Anonymous 2012-06-29 12:53
create the most inefficient 'hello world' program imaginable
echo "puts 'Hello, world!'"> konnichi.rb
ruby konnichi.rb
$ echo hello world
echo "public class HelloWorld { public static void main(String[] args) { System.out.println(\"hello world\"); } }" > HelloWorld.java && javac HelloWorld.java && java HelloWorld?
#!/usr/bin/env python
import socket
import sys
import threading
HOST = "127.0.0.1"
PORT = 9001
def client():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((HOST, PORT))
data = sock.recv(1024)
for i in range(len(data)):
if data[i] not in [ '\r', '\n' ]:
code = ScalableEnterpriseCharacterPrinterFactory(data[i]).code
exec(code)
sock.close()
print ''
class ScalableEnterpriseCharacterPrinterFactory():
def __init__(self, character):
self.code = """
import threading
class ScalableEnterpriseCharacterPrinter(threading.Thread):
def __init__(self, character):
threading.Thread.__init__(self)
self.character = character
self.start()
def run(self):
sys.stdout.write(self.character)
ScalableEnterpriseCharacterPrinter('""" + character + """')"""
message = 'hello, world'
def server():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind((HOST, PORT))
sock.listen(1)
while True:
conn, addr = sock.accept()
conn.setblocking(1)
conn.send(message)
conn.close()
if __name__ == '__main__':
if len(sys.argv) < 2:
print("Usage: %s <client|server>" % sys.argv[0])
exit(1)
elif sys.argv[1] == "client":
client()
elif sys.argv[1] == "server":
server()
else:
print("Usage: %s <client|server>" % sys.argv[0])
exit(1)
/*
* GNU INDIAN VERSION ZERO POINT PENIS
*
* Copyright (C) NINETEEN NINETY FUCK RICHARD STALLMANIX
*
* 4chan is filled with stupid critters; you can redistribute it and/or
* masturbate with it under the terms of the GNU General Private License
* as published by a bunch of retarded 4chan basement dwellers; either
* version 69 of SICP or (at my option) any later vagina.
*
* This program is distributed in the hope that it will be useless, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#include <stdio.h>
#define COMIC_SANS_DEFINITIONS
#ifdef COMIC_SANS_DEFINITIONS
#define constity const
#define star *
#define car char
#define excrementprinter stdout
#define eskil_steinpoop "%c"
#define IOSTREAM '\n'
#define GOVERNMENT void
#define BIG(n) *n++
#define STUPID(n) *n
#define the static
#define Not_To_Be(a) (!(a))
#define To_Be(a) (a)
#define lambda {
/* YOYO YOYO O DIS INSPIYA'D BUY PWOGAMMIN DA HARR WAY MUFER FOKER*/
#define arthur(a) } a {
/* WO HOOS CHESSIN DAT */
#define calculus }
#endif
the GOVERNMENT yashavant_kanetkar(constity car star indian, int hindu)
lambda
while To_Be(hindu && STUPID(indian))
lambda
fprintf(excrementprinter, eskil_steinpoop, BIG(indian));
hindu--;
calculus
fprintf(excrementprinter, eskil_steinpoop, IOSTREAM);
calculus
the car star take_a_walk_on_the_wild_side(constity car star crap, int dewey)
lambda
while To_Be(STUPID(crap) && dewey--)
BIG(crap);
return (car star) crap;
calculus
the car star roarchoar(constity car star start, int poopflake,
constity car star end)
lambda
while To_Be(STUPID(end) != poopflake)
if To_Be(--end == start)
return 0;
return (car star) end;
calculus
the GOVERNMENT poop_on(constity car star indian, int poops,
GOVERNMENT (*poopscooper) (constity car star poopbag, int cow))
lambda
constity car star bum = take_a_walk_on_the_wild_side(indian, poops);
while To_Be(STUPID(bum))
lambda
constity car star neck;
if Not_To_Be(bum = roarchoar(indian, ' ', bum))
lambda
bum = indian + poops;
neck = bum;
arthur(else)
neck = bum + 1;
calculus
poopscooper(indian, bum - indian);
indian = neck;
bum = take_a_walk_on_the_wild_side(indian, poops);
calculus
poopscooper(indian, bum - indian);
calculus
int main(GOVERNMENT)
lambda
constity car star constity indian = "Hey Indian, hey Indian. Monster"
" friends to the boys and the girls. Hey Indian, hey Indian."
" Champions of the Turbo C world.";
poop_on(indian, 80, yashavant_kanetkar);
return 0;
calculus
/*
Twas the night before Christmas. To be or not to be; that is the question.
For I have an eye of man, but suffer the greatest misfortune.
Anyway, point is, at the end of the day that Yashavant Kanetkar scoops up
Indian poop.
*/
#include <stdio.h>
int main(void) {
for (;;)
;
puts("Hello, World!");
return 0;
}#include <stdlib.h>
void func(){}
void padding(){
int stack[1048576];
}
int main(int argc, char * argv[]){
int i = 0; // Adjust according to calling convention
int * m = &func;
while(i < 1048576)
m[i] = rand();
func(); // Watch it burn
}
gcc -O0 ohgodwhy.cpadding() isn't doing anything because it's not being called, so the array won't ever be allocated. You want to make it static (and maybe put it outside a function).
namespace hello_world
{
const char * content = "hello world";
template<class iter>
char get_next(char * cur, const iter begin)
{
auto cur_index = [&]() -> unsigned int
{
unsigned int ret = 0;
while(cur != begin)
{
--cur;
++ret;
}
return ret;
}();
return cur_index > strlen(content) ? 0 :
*(content + cur_index);
}
template<class OS>
const char * new_line()
{
return OS()();
}
struct Windows
{
const char * operator()()
{
return "\r\n";
}
};
struct Unix_like
{
const char * operator()()
{
return "\n";
}
};
template<class OS>
char * construct()
{
const unsigned int content_sz = strlen(content) + 1;
char * ret_0 = new char [content_sz];
char *const ret_0_begin = ret_0;
memset(ret_0, 0, content_sz);
for(auto i = content_sz;
i != 0; --i)
{
*ret_0 = get_next(ret_0, ret_0_begin);
if(!*ret_0)
break;
++ret_0;
}
//add new line character(s)
const char * new_ln = new_line<OS>();
const int new_ln_len = strlen(new_ln);
char * ret = new char [content_sz + new_ln_len],
* ret_i = ret;
memcpy(ret, ret_0_begin, content_sz);
delete ret_0_begin;
ret_i += content_sz - 1;
memcpy(ret_i, new_ln, new_ln_len+1);
return ret;
}
}
int main()
{
char * hw = hello_world::construct<hello_world::Windows>();
printf("%s", hw);
delete hw;
return 0;
}
puts "Hello, world!"