CS Pranks: Push it!
Wednesday, October 27, 2010 :: Tagged under: pablolife. ⏰ 2 minutes.
Hey! Thanks for reading! Just a reminder that I wrote this some years ago, and may have much more complicated feelings about this topic than I did when I wrote it. Happy to elaborate, feel free to reach out to me! 😄
While working as a Sunlab consultant at Brown, my buddy and I would
frequently find ways to 'spice up' the workspace. If we ever found the other
person's workstation empty without being properly xlocked, we'd usually pull
pranks on each other: 'alias ls='eject; ls' being a popular harmless one, or
writing zwrite <
username>
-m "PAUL LOGGED OUT" on my .logout file,
executed anytime I logged out.
The sad thing about these pranks was that occasionally someone else would do a more malicious one, and we'd get blamed :( But there's still so much fun to be had from finding ways to shake things up.
This tweet by Coding Horror's Jeff Atwood gave me the idea for the next one:
by law, every fifth push to DVCS must be followed by this video link http://www.youtube.com/watch?v=vCadcBR95oU
Naturally, the youtube link plays this:
Gotta love the 80's.
Were I still there, I would love to institute this. But for now, I'm setting it up on my machine, to keep things from getting too boring. To do this yourself you'll need the following:
- mpg123, a simple command-line mp3 player. Easily installable.
- An mp3 of Salt-n-Pepa's Push It
Given all this, the rest is easy as pie. There are surely more elegant solutions than what I did:
- Store the number of pushes in an external file echo "1" > how_many_pushes.txt
- Write a script to keep track of and increment that number as time goes on.
Here's my Ruby script:
#!/usr/bin/ruby
FILENAME = "this_many_pushes.txt"
PUSH_IT_DIR = "/Users/pmeier/Desktop/projects/push_it"
command = "git push "
ARGV.each { |x| command += x + " " }
puts command
success = system(command)
if not success then puts "Push failed!"; Process.exit end
num_pushes = File.read(FILENAME).strip.to_i
puts num_pushes.to_s
if num_pushes == 0
puts "Push it!"
system("mpg123 #{PUSH_IT_DIR}/push_it.mp3 &")
system("echo '5' > #{FILENAME}")
else
system("echo '#{num_pushes - 1}' > #{FILENAME}")
end
- Execute git config --global alias.psh !push_wrapper.rb.
Now just use git psh instead of git push, and have a surprise every now and then ^_^
Thanks for the read! Disagreed? Violent agreement!? Feel free to join my mailing list, drop me a line at , or leave a comment below! I'd love to hear from you 😄