TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Things to commit just before leaving your job

379 pointsby diegoloover 9 years ago

35 comments

onion2kover 9 years ago
Something I wrote to amuse the junior front end developers here:<p><pre><code> document.write(&#x27;Error: Script not found.&#x27;); var node = document.currentScript; if (node.parentNode) { node.parentNode.removeChild(node); } </code></pre> Pop that in a JS file called something like jQuery.min.js and add it to an HTML page with the usual &lt;script src=&quot;&#x2F;js&#x2F;jQuery.min.js&quot;&gt;&lt;&#x2F;script&gt;. It&#x27;ll run when the page loads, add the line of text to the page, and then it&#x27;ll remove it&#x27;s own &lt;script&gt; tag so there&#x27;s no reference to it in the DOM (in relatively modern browsers) if you view the source. It&#x27;s easy to debug by watching the network traffic, but it caused a few scratched heads for a little while.
评论 #10085200 未加载
评论 #10085703 未加载
评论 #10085036 未加载
vereloover 9 years ago
I would suggest before you leave your job, you say &quot;it was nice working with you&quot; to the people you liked working with, and absolutely nothing to those who you did not enjoy working with.<p>The tech world is big in some ways, but also equally small in others. A select few might find this funny, but others will not appreciate their day (or longer) spent debugging your practical joke...and on the chance you actually get something like this onto production, well now it won&#x27;t just be your developer buddies you got off side.
评论 #10085169 未加载
评论 #10085171 未加载
评论 #10085231 未加载
happywolfover 9 years ago
The horror story that I heard was a disgruntled engineer silently replaced the source codes (C++ based) in the project with compiled binary object files and he kept the source codes on his local computer, not checking those in. He did this over an extended period of time to make sure this crept into the backup tapes as well. No one found out because each engineer owned a code module of their own. Then he resigned.<p>When his successor tried to debug and enhance the code base, the core files were basically all stripped binary object files...
评论 #10086098 未加载
评论 #10085269 未加载
评论 #10085102 未加载
评论 #10085195 未加载
评论 #10085098 未加载
评论 #10087510 未加载
评论 #10086415 未加载
cjslepover 9 years ago
From &quot;How to write unmaintainable code&quot; [0], here is a function declaration that changes signature based on how many times the header is #included:<p><pre><code> #ifndef DONE #ifdef TWICE void g(char* str); #define DONE #else &#x2F;&#x2F; TWICE #ifdef ONCE void g(void* str); #define TWICE #else &#x2F;&#x2F; ONCE void g(std::string str); #define ONCE #endif &#x2F;&#x2F; ONCE #endif &#x2F;&#x2F; TWICE #endif &#x2F;&#x2F; DONE </code></pre> Granted, it isn&#x27;t one line long.<p>[0] <a href="https:&#x2F;&#x2F;www.thc.org&#x2F;root&#x2F;phun&#x2F;unmaintain.html" rel="nofollow">https:&#x2F;&#x2F;www.thc.org&#x2F;root&#x2F;phun&#x2F;unmaintain.html</a> (Cert issue shows up on FF unfortunately)
评论 #10085614 未加载
monkeyshelliover 9 years ago
Someone will lose some hair over this<p><pre><code> &#x2F;* create memory leaks if compiled on April, 1st *&#x2F; #define free(x) if(strncmp(__DATE__, &quot;Apr 1&quot;, 6) != 0) free(x) </code></pre> The random ones are just pure evil.
评论 #10085035 未加载
josephmosbyover 9 years ago
PCI-compliant networks often contain checks for credit card numbers being sent in plaintext over the network. Problem with that is that credit card numbers are computed according to a formula, and it&#x27;s really easy to generate a bunch of fake 16-digit numbers that will pass the check. So if you want to troll your security team, generate a CSV with a stack of credit card numbers and drop it in a few places on a server. Even better, set up a script to send it over the network somewhere. Then wait for the scan.<p>Piece on check digits, for reference: <a href="http:&#x2F;&#x2F;www.datagenetics.com&#x2F;blog&#x2F;july42013&#x2F;index.html" rel="nofollow">http:&#x2F;&#x2F;www.datagenetics.com&#x2F;blog&#x2F;july42013&#x2F;index.html</a>
DeusExMachinaover 9 years ago
It is always a funny joke to say &quot;commit this when you leave a job&quot;. But I always wondered if there are people that actually do this.<p>Although it could be funny and give a sense of revenge for some wrong (perceived or real) that the person leaving might have suffered, I don&#x27;t think this would be a good idea. Contracts usually include liability for gross negligence or wilful misconduct.<p>Does anybody have a record of this actually happening at any company?
评论 #10085054 未加载
评论 #10085048 未加载
评论 #10085016 未加载
评论 #10086089 未加载
jasonkesterover 9 years ago
I left a file called xmas.js included in an internal tool one time when I left for a 9 month trip in between contracts (in November).<p>Basically it would check whether it was the last few weeks of December, and whether rand()%20 was zero. If so, it would wait about a minute then slowly fly a little gif of Santa &amp; his sleigh across the background, behind all the controls on whatever form it happened to land on.<p>They had a team of data entry guys using this tool, and it would take on average a few minutes to enter each record. So it made its way through QA and eventually to the desk of a friend. Got an email on the beach about it. Fun times.
codeshamanover 9 years ago
I love this. Evil in it&#x27;s purest form.<p>But also a great war story for the person who discovers it later.<p>&quot;So it was my 5th sleepless night. The thing would work 99% of the time. I triple checked every single line of code and it was still formatting the hard drive from time to time. Then I discovered:<p>#define if(x) if ((x) &amp;&amp; (rand() &lt; RAND_MAX * 0.99))<p>&quot;
leni536over 9 years ago
From the comments my favorite:<p><pre><code> #define i j</code></pre>
评论 #10084944 未加载
评论 #10084938 未加载
tiltover 9 years ago
My favorite (JS) <a href="https:&#x2F;&#x2F;twitter.com&#x2F;benbjohnson&#x2F;status&#x2F;533848879423578112" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;benbjohnson&#x2F;status&#x2F;533848879423578112</a>
Loqueover 9 years ago
I watched my friend swap the &#x27;m&#x27; and &#x27;n&#x27; keys around on the two tech directors keyboards the evening he left after goodbye drinks, the next day they both had to contact the IT support department as it turns out they still look at their keyboard whilst tapping in their passwords... amazing!
评论 #10086045 未加载
kelukelugamesover 9 years ago
I joked about starting a salary spreadsheet during my last week. Management wouldn&#x27;t even make eye contact with me on the last day. :P
评论 #10086081 未加载
corysamaover 9 years ago
Back in the bad old days of Visual SourceSafe I believe it was possible to perform a &quot;commit time bomb&quot; by rolling your computer&#x27;s clock forward a couple months before committing. The VSS backend would not enact the commit until the server&#x27;s clock caught up to the commit&#x27;s timestamp. D:
yarperover 9 years ago
We&#x27;ve got a guy in the office that merges the past over the present all the time. He&#x27;s not quitting but I imagine if you were to try to break things this would be a good way to do it.
评论 #10084853 未加载
评论 #10084966 未加载
评论 #10084880 未加载
评论 #10085757 未加载
codeshamanover 9 years ago
Wouldn&#x27;t it be wise if the compiler (or preprocessor) issued at least a warning if you redefine language keywords ? :)<p>So I just pasted this into a C++ file I was working on and it compiled without a single warning:<p>#define struct union<p>#define if while<p>#define else<p>#define break<p>#define double float<p>#define volatile &#x2F;&#x2F; this one is cool<p>I mean, redefining language keywords is not a thing I do every day and I guess most of you don&#x27;t do it either and I can&#x27;t see a valid reason why you&#x27;d want to do it in a normal project. For people who really want to do it, they&#x27;d just disable the warning.<p>Am I missing something here ?
评论 #10086477 未加载
评论 #10086684 未加载
jherikoover 9 years ago
&quot;#undef FLT_MIN #define FLT_MIN (-FLT_MAX)&quot;<p>i&#x27;ve seen FLT_MIN used as if it is -FLT_MAX enough times that i&#x27;m skeptical this would cause bugs rather than fix them. XD
noir_lordover 9 years ago
#define if(x) if ((x) &amp;&amp; (rand() &lt; RAND_MAX * 0.99))<p>That one is pure and absolute genius...er evil.
maxafover 9 years ago
Those who make liberal use of &#x27;git bisect&#x27; can not be so easily trolled.
评论 #10085099 未加载
评论 #10085786 未加载
to3mover 9 years ago
Perhaps we now finally know the story behind this: <a href="https:&#x2F;&#x2F;code.google.com&#x2F;p&#x2F;android-source-browsing&#x2F;source&#x2F;diff?spec=svn.platform--bootable--bootloader--legacy.734756ca3968b54e32acab867a05b10fc5e13d07&amp;repo=platform--bootable--bootloader--legacy&amp;r=734756ca3968b54e32acab867a05b10fc5e13d07&amp;format=side&amp;path=&#x2F;libc&#x2F;memset.c" rel="nofollow">https:&#x2F;&#x2F;code.google.com&#x2F;p&#x2F;android-source-browsing&#x2F;source&#x2F;dif...</a><p>&quot;probably can live undetected quite long&quot; indeed...
评论 #10086488 未加载
tmalyover 9 years ago
I had a professor back in the university that changes all the variable names to beer names while at a job. It ended up not being a problem for the company as he was consistent with the names.
评论 #10085049 未加载
mechazawaover 9 years ago
<p><pre><code> #define continue break</code></pre>
kevindeasisover 9 years ago
If only we can get a rosettacode version of this in all languages. I bet trolls will coming out left and right. It would be pure evil.
评论 #10084876 未加载
IgorPartolaover 9 years ago
<p><pre><code> #define i++ i-- </code></pre> Or even better<p><pre><code> #define i++ ++i</code></pre>
评论 #10085187 未加载
roelvanhintumover 9 years ago
If you wan&#x27;t to give your boss a laxative, through the coffee machine and lock the restroom doors in advance, just do.
评论 #10086487 未加载
评论 #10085287 未加载
forgettableuserover 9 years ago
Ooh. I recognize one of the contributor names, @cmuratori, from another HN post: Handmade Hero: C game from scratch <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8604489" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8604489</a>
评论 #10085732 未加载
hellofunkover 9 years ago
Perhaps the most enlightening (and actually useful) purpose of this file is to dramatize the glaring weakness in the c&#x2F;c++ macro system. A proper macro system would not make it so easy to do this, shall we say, &quot;evil&quot;, stuff :)
评论 #10084920 未加载
评论 #10084993 未加载
cyphunkover 9 years ago
&gt; (only pixel snapping + vertical-align left)<p>If vertical-align is the last thing, rather than one of the first, that one resolves... then we are in for 7 more years of hell.
TeMPOraLover 9 years ago
Oh I so desperately need a PHP equivalent right now.
评论 #10085192 未加载
评论 #10085172 未加载
评论 #10085190 未加载
xzcvczxover 9 years ago
and i read it just in time to have<p>&quot;So basically just #include &lt;windows.h&gt;&quot;<p>as the last comment, i think it was an interesting summary
bbathaover 9 years ago
I like #define const
chinathrowover 9 years ago
#define ntoh hton
Kenjiover 9 years ago
<i>#define volatile &#x2F;&#x2F; this one is cool</i><p>Oh wow. This literally sent a shiver down my spine. Imagine debugging that.<p>Also love the randmoness based ones!
评论 #10084866 未加载
Kenjiover 9 years ago
How about<p><i>#define free(x) if((rand()&amp;15)!=15) free(x)</i>
f00644over 9 years ago
This is when the scriptkiddies start getting involved..
评论 #10085268 未加载