Introduction to The Suicidal Jumpman Ruby game aka ROFLBALT

Hi folks, the last 3 days were MADLY fun for me @ Railscamp X (Adelaide). I was blown away with beers, whiskey, Werewolfs, foods, geeks, hackers and their SUPERCOOL hacks. Dennis Hotson (@dennishotson) and Paul Annesley (@pda) decided to join force to create a game that if was released before Mario, it would probably take on the world. (Unfortunately it was 25 years later). The game goal is to sustain alive by jumping on the top of the building as long as possible.

It is interesting to see the progress that Paul and Dennis made, from such few characters to draw the man (not knowing jumping yet) and build blocks to animated jumpman chasing the helicopter which blasted to pieces if bumped into buildings (/w blood trails on the building). Paul and Dennis called the game ROLFBALT, for me I would call it the Suicidal Jumpan for its bloody ending scene. I rank this game 2nd after the Wolf3D clone Rubystein. Give it a try now at https://github.com/pda/roflbalt

Open Cubic Player (ocp) is now available under Homebrew for all MacOS X

For whom who doesn’t know what Open Cublic Player (ocp) is, this application is a pure console music player for DOS and *NIX based platform. It was one of the most popular app of the DOS era. Though lacking mouse control and a graphical user interface, many hackers/developers still prefer it to other GUI music players for its light overhead and rich features.

Today, I am delighted to announce that ocp Formula is officially committed into Homebrew repository. I’d like to thank Stian for the great app and for being patient with me on many emails back and forth on fixing nested functions compiling issues with gcc on OSX. To all console lovers out there, you can start trying out this great app right now:

$ brew update
$ brew install ocp
$ ocp

Bugs reports are greatly welcomed. Enjoy!

Shell Tips: How to recursively archive many folders

In this short tutorial, I’ll show you how to recursively archive (tar.bz2) folders into archives file with same folder names. I’ll use find to list all directories; then archive each folder using tar and parallel.

Scenario

Let’s assume that we have following directories:

drwxr-xr-x 37 macbookair staff 1258 Nov 22 18:16 folder_number_one
-rw-r--r-- 1 macbookair staff 35342662 Nov 22 18:16 foo_file.txt
drwxr-xr-x 9 macbookair staff 306 Nov 22 18:16 folder_number_two
-rw-r--r-- 1 macbookair staff 16505 Nov 22 18:16 foo_bar.txt
drwxr-xr-x 7 macbookair staff 238 Nov 22 18:16 folder_number_three
drwxr-xr-x 7 macbookair staff 238 Nov 22 18:17 folder with space

Objective

The objective is to recursively archive folder_number_one, folder_number_two, folder_number_three into folder_number_one.tar.bz2, folder_number_two.tar.bz2, folder_number_three.tar.bz2 respectively.

Solution

One magic command does ALL:

$ find ./* -type d -print | parallel tar cjvf {}.tar.bz2 {}

How it works?

$ find ./* -type d -print
./folder with space
./folder_number_one
./folder_number_three
./folder_number_two

Next, I used parallel to parse in the list to tar:

find ./* -type d -print | parallel tar cjvf {}.tar.bz2 {}

{} represents every single folder name in the list. You could customize the archive name easily by amending to this {} symbol. For example:

find ./* -type d -print | parallel tar cjvf {}-archived.tar.bz2 {}

which append -achived into the filename to give you:

folder_number_one-archived.tar.bz2
...

Why this solution is better than using ls and awk?

There are many solutions, one is to use ls -l to list all directories then pipe the output to awk to grep the last field start with d (that is directory type). Yet that solution suffers one flaw: directory names’spaces will be omitted in the output.

Follow

Get every new post delivered to your Inbox.

Join 57 other followers