Hacker News new | past | comments | ask | show | jobs | submit login
A Cover Letter in Brainfuck (myownfortune.wordpress.com)
148 points by FBT on June 25, 2014 | hide | past | favorite | 45 comments



Author here.

Due to popular request, I extracted the text from the PDF, it's in a gist at the bottom.

A funny (on my account) story:

After three days with little sleep, the last half-day spent finding just one more byte to remove so it fits in a nice rectangle[1], I was finally done. I sent the complete .asm to Oded Margalit, an IBM researcher who organizes the CodeGuru programming competitions in Israel, and he immediately responded "I can shave 5 bytes off".

It turns out instead of the "quit" system call all the books tell you to write:

    ;;; the program has finished
    quit:   
        mov     ah, 04ch        ; quit with return code
        mov     al, 0
        int     021h
You can just put a "ret", and DOS loads an address containing these commands to the bottom of your stack so it works.

You had to see my reaction.

[1] it was supposed to be 32x13 characters at the bottom, after it was done I decided to make it 8x52 characters on the right because it looked better. Had I known I would do it, I could've gone to sleep much earlier...


I love it how the OS does the obviously right thing (at least to my eyes, returning from the application's main() function equivalent makes 100% perfect sense), but people who have obviously spent a b*ttload of time with these things are still surprised. Not sure if it's irony, or just tragic. Good story though, thanks!


The first x86 assembly program I wrote ran almost perfectly the first time. That was over 15 years ago and I don't remember what it actually did, but I remember being impressed with myself.

Then the screen filled with junk and my P133 rebooted. When it happened a second time I resigned myself to actually read the assembly manual section about DOS programs properly (i.e. not stop after the part which said .COM files are the simplest way to get started).

The idea of asking the OS to unload my application wasn't obvious to me at all :) At the same time, realising why not asking the OS to unload my application produced the results it did was a lightbulb moment.


It's maybe the right thing, but not the obvious thing.

In the context of DOS assembly language programming, the only obvious thing is "nothing". DOS is barely an OS, it's mostly a library of function calls. DOS does nothing most of the time, so you expect it to do nothing all the time.

At the time I didn't yet spend a lot of time doing DOS assembly language programming, but since then I did, and had I heard about this for the first time today, I would be really surprised.


I guess CP/M did that, and that's why MS-DOS did it as well.


For those wondering what the program does:

TL;DR - The program writes a Brainfuck program that writes the text you inputted. Pretty neat

First copy the text of the letter (excluding the x86 interpreter in hex on the right, or in the case of the gist, at the bottom) and run it through an online Brainfuck interpreter. Supply ASCII text input such as "A" and run the program. It will output another Brainfuck program. If you then run the outputted program through the Brainfuck interpreter you will get the same ASCII text.

So if you run the code extracted from the letter:

    +++++++++[<+++++>-],[[-<--.++<+>>(]<+.-<[->.<]>>,]
If input an 'A' the output is:

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-----------------------------------------------------------------
which if run returns an 'A'

Online interpreter - http://nayuki.eigenstate.org/page/brainfuck-interpreter-java...


Hmm...

It would be interesting to do something similar, but optimizing for output code size.

For example, I'm pretty sure that the following is one of the shortest representations of "A" in BF, although it doesn't clean up after itself.

    -[+>+<[+<]>]>+.


The first ever Brainfuck program whose source doesn't actually look bad.


That problem has a generic solution:

https://github.com/eteeselink/bffmt


I think "formatted" is different from "doesn't actually look bad"


You may appreciate this (I am the author):

https://github.com/SirCmpwn/bf-irc-bot/blob/master/irc-bot.b...


I have questions:

Did the letter work?

Program and interpreter and letter, but why not let us with X86 machines cut and paste.

What did the program do?


Of course the letter worked in the technical sense.

In the business sense -

The letter was sent as a PDF to a contact I had, who promised to print it and hand it to the relevant recruiter. I never heard back from them, but I did get accepted somewhere much better, and I have good reasons to suspect there was a man-in-the-middle involved.

I'll try and extract the text from this PDF. Of course I lost the source years ago (_in a thunderstorm_, no less).


I tried to OCR the letter.

The hex, I couldn't get.

http://hastebin.com/raw/ogehefofez


I put the sources (including hex) in a gist at the bottom of the post.


Thanks! Thats the source, so that will do nicely.


You get bonus points if you find a 32-bit Windows machine and use DEBUG to load in the interpreter. It's like a modern day copy of BYTE.


What's wrong with a text file? Notice how brainfuck is specified to work on text files, not on PNG files!


Author here - I found this old PDF in my gmail inbox, and have lost the source long ago.

I'll see if I can extract the text out of it.


Can you embed a text file in the middle of a blog post?


Well... yes. You just, literally, paste it there. You can even throw in a <pre> for monospace shock value.


The formatting is pretty important for understanding this document. Even <pre> is just semantics and doesn't gurantee anything about presentation. Browsers just default to something monospace.



iframe? How 90s!

  <object type="application/brainfuck" data="http://www.over-yonder.net/~gollingj/oldpage/text/limericks.txt" id="text-file"/>


<pre> anyone?


That's great :-) For other teeny DOS BF interpreters, see http://www.hugi.scene.org/compo/compoold.htm#compo6 (1999) - smallest was 98 bytes!


At 19 my raw assembly optimization skills weren't even at national level, and we live in a _tiny_ nation. Some people do amazing things with x86 ASM.


My guess is that most HR people would see that and think "Troublemaker", Next..

But, then again, maybe you dont want to work for them anyways.


I was so much of a special case at the time that they would do that anyway. I needed to take a gambit that would have some probability of failing at the gatekeeper, but would yield rewards proportional to risk.

And of course _I didn't send it to an HR person_. I don't understand why would a programmer ever send his CV to an HR person. My CV always gets passed to a programmer who can read it and see my value, he passes it on to his team lead, who knows he wants _me_ and lobbies HR on my behalf. Works way better.


In fact, two weeks ago I had to take a similar gambit. Here is what I sent this time (to a large group of alumni of the unit I served in). I got a few offers, but I'm still open to propositions:

My CV in one sentence: "Ask anyone in 8200."

I'm busy with my venture (spreading code literacy as wide as literacy), so I can only help you at 30% capacity or for a short period.

I'm looking for the project where my experience and entrepreneur mindset would bring the most value. Hire me to prototype your new product, automate your workflow, refactor your MVP into a maintainable architecture, research new technology, fix the bug you gave up on, mentor your juniors, or just join your team.

I take full responsibility for my work. This is especially valuable in organizations where the bottleneck for R&D is management attention. Does it describe you?

To summarize, I won't solve every problem you have, but I may be able to solve one, without taking up precious manager time.

I'm also available for consulting.

Cheers, Aur

P.S. My hobby is to join companies for 1-2 days. Any such job offer would be accepted automatically עד גמר המלאי [while supplies last - AS]. Need something done but your developers are crunching? Need a really simple MVP? Want a second pair of eyes on your design? I can probably deliver. Ask me.

I shine with Python and C, programmed professionally in C#, Ruby, Haskell, C++, Java, Javascript, and x86 assembly language, and learn fast. I write unit tests for my hobby projects.


One line CVs are good but it would help if you also mention your current location and related preference (are you willing to move/commute-on-demand/telecommute-only and preference to work abroad as well as any work permits you might need). Are you open to full time positions or just contracting? Lot of big projects either requires full time commitments or long term contract. From career perspective I would also highly recommend not to shoehorn yourself as "cryptography" or security developer - unless that's what you want to genuinely only thing focus on. Typically people's expertise are mere coincidence of jobs they managed to get first time and it's generally good thing to develop skills in other fields such as computer vision or machine learning and stuff.


> your current location and related preference

Irrelevant in Israel. We're that small. Since this is now posted internationally I should mention I'm willing to work remotely.

> Are you open to full time positions or just contracting?

"I can only help you at 30% capacity or for a short period."

> Lot of big projects either requires full time commitments or long term contract.

Indeed, which is why I had to take this gambit. It worked, I got very interesting offers.

> not to shoehorn yourself as "cryptography" or security developer

"Hire me to prototype your new product, automate your workflow, refactor your MVP into a maintainable architecture, research new technology, fix the bug you gave up on, mentor your juniors, or just join your team."

The cover letter was written years ago for a specific security/crypto position. This "one line CV" is much more general.

> Typically people's expertise are mere coincidence of jobs

Indeed, never understood that. I always loved so many different things...


I found your extra byte!

s/confered/conferred/


The extra byte he needed to shave off was in the 8086 assembly language brainfuck interpreter (in hex on the right of the letter) so it would fit nicely in a rectangle.


So you were expecting IDF human resource types to have a sense of humor?


No, just IDF technologist types.


This is brilliant!


so, what does the program do?


Why don't you paste it in an online Brainfuck interpreter and find out? :-)


Kids may read HN, I'd think that exposing them to serious profanity would violate some countries laws and put HN at grave legal risk.


If swearing on the internet were illegal, most "user-generated content" sites would be shut down.


Brilliant, though shame it's regarding entry to the Israeli military.


Indeed, sad.

As a teenager in a country with conscription, you do what you can. Had I had a choice, this letter may have been targeted at Google.

For the record, I think conscription is a bad idea for many reasons.


Come on --that sort of political comment doesn't add anything constructive to the discussion.


If the word "Israeli" were omitted, I don't think anyone would have questioned if it were constructive. I don't know that the extra bit of specificity ruined it, for me, at least.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: