Live data from Hacker News

What is the coolest thing you can do in ten lines of code?

stackoverflow.com

11–20 of 40 posts

Re: What is the coolest thing you can do in ten lines of code?

#11
post #5

Less than 10 bytes of code on an Apple II: ] CALL -151 * 300: AD 30 CO 20 ED FD 4C 00 03 * 300G Enjoy! For bonus points, get this down to 8 bytes.

I used to do that kind of hacking in the 80's. I recognized the CALL-151. I have an old Apple II+ in the other room I'm tempted to try firing up just to solve this mystery.

Re: What is the coolest thing you can do in ten lines of code?

#12

Is 30 close enough to 10? I got a job with 30 lines of code appended to my resume, with a screenshot of the resultant output. Perhaps the first two pages had something to do with it but I was told that the third page was what stood out. This was a sysadmin position, the code includes bash, sed, awk, grep, tcpdump, netcat and gnuplot. Hint to anyone who tries this sort of resume stunt: You WILL be asked what the code…

How long would it have taken you to write that?

Re: What is the coolest thing you can do in ten lines of code?

#15
post #5

Less than 10 bytes of code on an Apple II: ] CALL -151 * 300: AD 30 CO 20 ED FD 4C 00 03 * 300G Enjoy! For bonus points, get this down to 8 bytes.

Should be able to use a two-byte BEQ, BNE, BCC, BCS, or something like that instead of the jump, depending on what COUT returns.

Re: What is the coolest thing you can do in ten lines of code?

#16

Back in real-mode x86 times the coolest thing could've been done in 2 lines CLI ; Disable interrupts HLT ; Halt CPU until next interrupt This hung the machine dead.

Not to forget the F00F bug, which did the same thing in full-blown protected mode.

Re: What is the coolest thing you can do in ten lines of code?

#18
Just about any Forth Haiku would probably qualify. Here's a nice Mandelbrot set (not my code):

  : z^2 2dup z* ;
  : layer push push z^2 pop pop 2dup push push z+ pop pop ;
  : many layer layer layer layer layer layer layer layer layer layer ;
  : len dup * swap dup * + ;
  : mant y 0.7 - 3 * x 0.5 - 3 * many drop drop len dup 1 
(http://www.forthsalon.appspot.com/haiku-view/agpmb3J0aHNhbG9...)

Re: What is the coolest thing you can do in ten lines of code?

#19
post #5

Less than 10 bytes of code on an Apple II: ] CALL -151 * 300: AD 30 CO 20 ED FD 4C 00 03 * 300G Enjoy! For bonus points, get this down to 8 bytes.

I used to do that kind of hacking in the 80's. I recognized the CALL-151. I have an old Apple II+ in the other room I'm tempted to try firing up just to solve this mystery.

For people who didn't hack apple IIs, can you expand on what's going on there?

Re: What is the coolest thing you can do in ten lines of code?

#20
post #14

Back in real-mode x86 times the coolest thing could've been done in 2 lines CLI ; Disable interrupts HLT ; Halt CPU until next interrupt This hung the machine dead.

This is not cool in my book.

... nor is downvoting nerdy posts on HN of all places :)
Post reply on HN