Delete all files but one

This comes in handy whenever you want to delete all files but one with a regex filename in particular. Quite ugly but does the job (in csh).

ls | grep -v <pattern> | xargs rm

Color scheme button generator for Android

Screen Shot 2014-02-10 at 9.49.21 PM

I was sicking tired of having to manually modify the HEX values of my XMLs every time I wanted to make a little change in the color. Also you have to modify three files: the idle, the pressed and the selector (at least for a basic rounded coloured button). The problem is actually bigger when you want to use a complete set of colours. I’m one of the most laziest persons all over the world and I’m a programmer so something smart was obligated to come up.

My solution for this problem is a perl script that receives the name of your color scheme, and a file with the Radius, Stroke and Color array information. At the end you will have three files per color inside a folder which you can put inside the drawable directory of your Android project.

Katziders-MacBook:Button Schemes katzider$ perl -scheme_name Windows_8 -input_file windows_8.txt; ls -la Windows_8 | grep sky_blue

-rw-r--r--   1 katzider  staff  676 Feb 10 21:25 button_bg_sky_blue.xml

-rw-r--r--   1 katzider  staff  763 Feb 10 21:25 button_idle_sky_blue.xml

-rw-r--r--   1 katzider  staff  763 Feb 10 21:25 button_pressed_sky_blue.xml

Find detailed instructions in the header of the perl script. Even though the usage of this program should be straight forward, you can contact me in case of any problem =)

Download it here, includes the Windows 8 schema (or a very similar).

Screen Shot 2014-02-10 at 9.44.45 PM

P.S. I tried hard to do a good work on, post your feedback if you have some.