
A Cover Letter in Brainfuck - FBT
http://myownfortune.wordpress.com/2014/06/15/cover-letter/
======
SonOfLilit
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...

~~~
unwind
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!

~~~
ryanjshaw
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.

------
amckenna
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...](http://nayuki.eigenstate.org/page/brainfuck-interpreter-javascript)

~~~
TheLoneWolfling
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.

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

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

~~~
skrebbel
That problem has a generic solution:

[https://github.com/eteeselink/bffmt](https://github.com/eteeselink/bffmt)

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

------
acomjean
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?

~~~
SonOfLilit
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).

~~~
joeframbach
I tried to OCR the letter.

The hex, I couldn't get.

[http://hastebin.com/raw/ogehefofez](http://hastebin.com/raw/ogehefofez)

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

------
adestefan
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.

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

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

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

~~~
sp332
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.

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

~~~
SonOfLilit
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.

------
maerF0x0
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.

~~~
SonOfLilit
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.

~~~
SonOfLilit
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.

~~~
sytelus
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.

~~~
SonOfLilit
> 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...

------
sheberight
I found your extra byte!

s/confered/conferred/

~~~
amckenna
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.

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

~~~
SonOfLilit
No, just IDF technologist types.

------
greg7mdp
This is brilliant!

------
esseti
so, what does the program do?

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

------
jebblue
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.

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

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

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

~~~
JasonFruit
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.

