OK, so in the spirit of Code-Golf, I\'m trying out something new here: Code-Bowling.
In golf, you try to get the lowest score (smallest application, mos
I wrote a tri-lingual frankensource program that can be interpreted with bash, compiled with gcc and interpreted with python without alterations to the code (if interpreted with bash, it invokes itself as C and python to accomplish the task). It also uses the load time of google as a source of random numbers.
#if 0
"""ls" > /dev/null
echo /* >/dev/null
# Save as 'whatever.sh.c' (.sh is negotiable, but .c is a must, lest gcc will cry)
# Run with bash (i.e. bash 'whatever.sh.c')
gcc -std=c99 $0 -o /tmp/codebowling 2>/dev/null
/tmp/codebowling
/tmp/codebowling `python $0`
rm -rf /tmp/codebowling
exit;
echo */ >/dev/null
#endif
#include
#include
char* strings[] = {
"Morning\n", "Evening\n", "Afternoon\n", "Night\n"
};
int main(int argc, char* argv[]) {
if(argc == 1) printf("Good ");
else if(argc == 2) {
int what = atoi(argv[1]);
printf(strings[what]);
}
return EXIT_SUCCESS;
}
#if 0
/*
"""
#*/
from urllib import urlopen
import time, math
t1 = time.time()
str = urlopen('http://www.google.com').read();
t2 = time.time()
dt = t2 - t1;
print int(100+100*math.sin(100000*dt))%4
#endif