All Posts

April Fools – Developer Style

Here at uShip we are pretty big fans of open sourcing code. At the same time, we are also fans of a good ol’ prank. Hence, we have decided to open source a few of our favorite code pranks to share with the world (and just in time for April Fool’s Day).

But first, a few ground rules:

We believe in following Isaac Asimov’s first two rules of robotics, roughly, you can’t harm anyone with your prank, and you can’t harm their computer
Make sure others are okay with what you are about to do. Generally if you have a great culture like here at uShip, you will find that innocuous pranks are just an inevitable, natural remnant of some age-old perpetual developer-magic duel

Expeliarmus – taskkill /f /im explorer.exe
Additionally, added bonuses for pranks whereby:

The developer learns something in the end (other than to hate you)
The prank is either horribly complex or involves a lot of patience

Also note, for brevity’s sake, we kept most of the below examples in Windows and .NET, but feel free to rant about that in the comments.
Let’s get started…

Change Compile Time Constants

aka
π = 3
In 1897, Indiana for some reason thought it was a good idea to redefine ? as 3. We feel that you should express this idea to your fellow developers as well.

How it works:

 

In some languages like C#, you can override almost any code in the Assembly Info class. Although normally this can be done for any sane reason (of which there are few), we just decided why not have a little fun with the static Math functions instead?

Show me the code already!!!
using System;
namespace IndianaPi
{
class Program
{
static void Main()
{
Console.WriteLine(“PI is {0}”, Math.PI);
Console.WriteLine(“Press any key to continue…”);
Console.ReadKey();
}
}
}

The Trick:
// In AssemblyInfo.cs, located under the Properties folder for any project
internal class Math
{
public static double PI =3.0;
}

Note: One can also use this for enforcing good coding practices as well, although there are likely better means to do so, such as lint or ReSharper code formatting instead.

 
Startup Scripts
aka
What the heck is that sound!!!??

Recently, one of our favorite developers – Jordan Patapoff – left uShip to go and start his own startup Clyp.  Lucky for us, he knows enough about API’s that he left us a perfect entry-point for our next prank.

How it works::

Using Clyp’s API, and a quick script to open a media file, one can have a random media clip played on demand. Then by adding this new script to a user’s startup folder, we are able to give them a nice little surprise whenever they log in.

Show me the code already!!!

Registry Key Rebinding

aka
How-the-hell-do-I-fix-this?
One of the most awesome things windows allows is replacing one key with another. This can have a few purposes, from when a key just randomly falls off your laptop keyboard when riding your bike, to when you just hate a key and want to annihilate it from existence.

I’m looking at you Caps Lock!
However, we find the best usage of this feature is probably to have someone’s spacebar output dashes instead. This way you can wreak havoc, yet likely not get them locked out since rarely do people who fall for this prank use spaces in their passwords anyway.

How it works:

The below script is probably the easiest way to use the exploit (since anyone who wants to go through and manually modify the windows registry in the short amount of time it takes for someone to get a cup of coffee is either insane or the flash). Once run, restart their computer, and sit back and enjoy as they slack you “messages-such-as-this”.

Show me the code already!!!

Copy & Paste from the web
aka
These are not the scripts you are looking for

Some developers (especially those who are new to development) suffer from “just copy it from the internet” syndrome. Generally in order teach that not all code on the internet is “good code”, you can introduce them to your “found” code they should try out. Then once they copy the code blindly without even giving it a second look, they will find that you secretly had some invisible injected code hidden in the middle.

How it works:

When providing a code sample on a web page for someone to copy paste, you can insert code through the use of an invisible span. Even though the span is invisible, its contents will still be copied to the clipboard. After a little html magic, as well as an unsuspecting developer who doesn’t pay attention to what they copy and paste, the rest is history. And the end result is phenomical. The best part is that this works in ANY language!

Show me the code already!!!

 
Aliasing
aka
A rose command by any other name

I think I’m going to name you su
I think all of us as developers have become accustomed to blindly typing certain command line messages. Whether it be git commit or hg push, some developers only have production on the mind and will never give your inserted command a second thought.

How it works:

Using doskey, one is able to alias any command they want to another command. Often this is for the lazy who want to not have to type things like git push, but instead type gp. However, this also leaves the door open for those who want to add a little something extra, such as git commit -ma “<insert message>” $T git push. That is, so long as no one does anything silly like doskey doskey=echo “uh oh… now what?”

Show me the code already!!!

doskey git=git add -A $T git commit -am “I’m a little teapot” $T git pull $T git push

 

URL Redirecting

aka
The Host with the most!

No, not those guys
This one is pretty old school, but I am surprised how many developers still fall for a changed host file. As such, they will never understand when they go to their favorite sites (e.g. stackoverflow.com), then suddenly appear on some of their least favorite (although not uShip.com of course).

How it works:

Whenever a website tries to go to any url, it will always check to see if there is an override in the hosts file. However, if you happen to know of a url that can be accessed using their IP address, you can easily override any site (that is, assuming it does not redirect over https).

Show me the code already!!!

What else?

Obviously this list can easily grow, but hopefully what we have shared is enough to get you started. If you find that one of the above just isn’t good enough in its entirety, feel free to mix them up. For instance, redirect a user from stackoverflow to a place with javascript that changes their keyboard bindings!

Additionally, if you are not used to windows, be sure to try to run as administrator if you can (which is true for most developers) and running Set-ExecutionPolicy RemoteSigned if using any of the powershell commands.

And whatever you do, just be sure to be safe, have fun, and try not to let this wonderful gift of the First of April go to waste.

Feel like we are missing your favorite idea? Then leave us a comment and let us know. Or… just make a pull request!