fix2x.sh – automatically create/resize @2x and non-@2x images for IOS

IOS Product Development, Unix
I've put together a quick bash script to automatically generate @2x and non-@2x images for IOS. The script looks through a directory, auto creates missing @2x or non-@2x files, and auto resizes the non-@2x files. Instructions: Download fix2x.sh from the Coder Cowboy Scripts GitHub Repo Copy the script to a directory Copy your original .png or .jpg files to the directory Open terminal & do something like the following: $ cd ~/Desktop/2x/ $ chmod +x fix2x.sh $ ./fix2x.sh . Script output will look something like this: Now processing file: ./normal name.png CREATING ./normal name@2x.png Original width: 15, height: 11 Small width: 7, height: 5 /Users/jason/Desktop/2x/normal name.png libpng warning: zero length keyword libpng warning: Empty language field in iTXt chunk /Users/jason/Desktop/2x/normal name.png Now processing file: ./twox name@2x.png Creating ./twox name.png Original…
Read More

Custom OSX log file rotation / archiving

Tips, Unix
This is an updated/edited version of an article I posted years ago on World's Worst Software. Custom Log File Rotation In OSX It's not easy to figure out how to configure OSX's internal periodic tasks. I googled around a bit for info on integrating your own log rotation scheme into OSX's existing scheduled tasks, but I could not find any great documentation on the matter, so here's how I solved the problem. How OSX's log rotation works OSX (10.4+) automatically rotates your log files for you on a weekly basis. It first rotates older logs, then it gzips your current log file up, and then it creates a new log file for your system to continue logging to. The log files are gzipped into a file like logfile.0.gz where "logfile"…
Read More

TortoiseSVN not importing some files? Fix your permissions.

Tips, Unix, What I Just Learned
If TortoiseSVN (or SVN in general) seems to be skipping over some files when importing a project, there are a couple of causes to be careful of. First, make sure your permissions are set correctly, I just do the following in a dos box (after installing cygwin, of course..) in my project folder before import: chmod -R 777 * If you've already imported your project and the project folder is versioned, and TortoiseSVN is still giving you hell, you may have to right click on individual files it previously skipped and select tortoisesvn->add from the popup menu. Doing this at higher levels in the directory structure won't even show the permission-fixed files as addable :( If that doesnt seem to solve your problem, you may want to search for svn…
Read More

Stopping Axis2 in unix

Java, Unix
If you're having trouble killing axis2 via a init.d script or otherwise on unix, just do this: AXIS2_CHILD_PID=`ps aux | egrep "axis2server.sh|SimpleAxis2Server" | grep -v "egrep" | awk '{print $2;}'` echo "Killing stubborn AXIS2 child process that won't die with parent.. pid is ${AXIS2_CHILD_PID}" kill ${AXIS2_CHILD_PID} >/dev/null 2>&1 && echo OK || echo "failed, what now?" That works for axis 1.5.1, at least. The odd thing about axis2 is, there isn't any documentation mentioning axis2 daemonizing. The axis2server.sh script certainly does not appear to daemonize, and the axis2.xml config file doesnt seem to make any mention of a deamonizing configuration item. Yet, when you run axis2server.sh in a terminal, it's interactive, ctrl-c, and the the script and the child axis2 will be dead. Run axis2server.sh as a background process, like…
Read More

The Beauty of &&

Bash, Unix
I'm a big fan of bash. The first thing I do on any windows computer is install another browser, and the second thing I do is install cygwin. Cygwin gives me bash on windows, and fortunately on macs, OS X is based on unix, so bash is already there. Don't get me wrong, I'm not a true unix-head by any means. I don't live on the command line, I just know how to get things done with it. I don't prefer emacs or vi over a gui editor, and I couldn't tell you the history of bash, or whether bash is better than another shell option (aside from DOS, as any shell is better than that). And, honestly, there are quite a few linux commands that I'm not sure whether…
Read More