Have fun with post build events

It’s important to have some fun in the project you work on. It helps in releasing some stress. Our project goes through a stressful phase now. Deadlines are getting closer and some of our arguments get more heated then they should. It would be a good idea that we go out for some beers but we work in different cities so it’s not that easy. After a meeting like I mentioned, a colleague and me thought it would be nice to play a little trick on another colleague. I took up the challenge and I promised I would think of something.

I figured, let’s me mess with him in a harmless but funny manner. My first thought was to implement some kind of Easter egg, but I didn’t wanted to affect the code. Our current client might not enjoy it as much as I would hope. So I had to think of something that only applies to him and not the code, so this is what I ended up doing.

for /f %%i in ('whoami') do (
IF "%%i" == “DOMAIN\user" (
IF %RANDOM% LEQ 12000 (
start chrome "https://youtu.be/_4IRMYuE1hI"
)))

These are a few simple CMD commands that you can place in the post build event for any Visual Studio project (other editors probably have a similar feature). You can collapse it to one line, I have it like this just to show you better what it does.

I wanted the trick to apply only to him without people around him knowing. The first command requests the currently logged in users name from the system. The second if checks the returned username and compares it to the targeted user. I wanted it to execute only roughly 33% of the time so I achieve that by rolling a random number between 0 and 32768. That is what the third check achieves. If these two conditions are met, I start chrome on a specific link: Beethoven’s 5th symphony. It is harmless, but I’m sure you can think of something darker, if you wish to do so.

This code will reach the server next week. I’ll keep you posted of its effect. Stay tuned!