As an example I offer this, which was used to clear the screen in COBOL.
DISPLAY SPACES UPON CRT
up vote
7
down vote
favorite
3
|
As an example I offer this, which was used to clear the screen in COBOL.
|
||||
|
up vote
18
down vote
accepted
|
while (true) System.out.println("SO isn't really meant for open-ended questions like this."); This little one-liner kills the discussion. (Sorry for the snarkiness, I think it's time for me to go home.) |
|||
|
up vote
22
down vote
|
It's not really strange, but one bit of code that I've always found particularly amusing decrementing a value and checking it as it approaches zero, e.g.
|
||||
|
up vote
15
down vote
|
I'd call this the most useful. I put this at the top of any simple single-file C scripts, so that I can execute them directly. It compiles if necessary and calls the executable, passing on any parameters. |
||||
|
up vote
12
down vote
|
It's a tug of war! |
|||
|
up vote
11
down vote
|
For me, it must be the Jaromil bash forkbomb, looks like a poem :)
This is an explanation of the Jaromil program Also, the more concise Windows shell forkbomb is a sure winner in any golf match:
|
|||
|
up vote
11
down vote
|
|
||||
|
up vote
11
down vote
|
Best I ever saw was someone's sig on usenet that was a couple of lines of ob-C that generated the mandlebrot set. it was freaking cool:
Source that does it:
|
|||
|
up vote
7
down vote
|
My personal favorite I met in Schneier's "Applied Cryptography", to swap two integers: x ^= y; y^= x; x^=y; |
|||
|
up vote
5
down vote
|
I always thought
was an interesting use of pointers to copy a string. |
|||
|
up vote
5
down vote
|
A perl-regexp to check if a number is prime:
(I would like to give credit for this one, but I can't remember who actually dicovered it - not me) |
|||
|
up vote
5
down vote
|
Truncate Table One line of SQL can do so much damage to data that would take many programs hundreds of lines of code. |
|||
|
up vote
4
down vote
|
|
|||
|
up vote
3
down vote
|
...to steal some ThinkGeek swag:
|
|||
|
up vote
2
down vote
|
My favorite bash script thingy. Originally written by http://twitter.com/jf
|
|||
|
up vote
2
down vote
|
Short and to the point. |
|||
|
up vote
1
down vote
|
From the Python FAQ
|
|||
|
up vote
1
down vote
|
This is on all my forum signitures:
or the ocassional
however it always evaluates to false. |
|||
|
up vote
1
down vote
|
I don't know why but it has always tickled me when I run across this.
|
|||
|
up vote
1
down vote
|
Elegant, eigh? Soon it's gonna be possible in C# too!!! |
|||
|
up vote
1
down vote
|
|
|||
|
up vote
1
down vote
|
It doesn't get better than that |
|||
|
up vote
0
down vote
|
This question reminds me of the site The Daily WTF. Check it out if you've never heard of it before. |
||||
|
up vote
0
down vote
|
This is not super complex but I've always been charmed by this method of unbuffering IO on a file handle in perl without changing the currently selected file handle (er, technically it does change it, but it changes it back and you don't have to know what the currently selected file handle is)
|
|||
|
up vote
0
down vote
|
$Completed = AskUserWhatTheyWantAndTakeCareOfIt(); |
|||
|
up vote
0
down vote
|
It ensures that your system is set up properly and ready for any programming action! |
|||
|
up vote
0
down vote
|
|
|||
|
up vote
0
down vote
|
|
|||
|
up vote
0
down vote
|
|
|||
|
up vote
0
down vote
|
I tend to see some kind of poetry in that line. (I've actually ran across it) |
|||
|
up vote
0
down vote
|
When I used ASP classic a lot, I was always frustrated that there was no floor/ceiling functions available.
I always thought that was an elegant one-liner. |
|||
|