//clay richardson

ImageMagick Autocrop Scanned Documents

I needed to autocrop a bunch of handwritten 14.8cm x 21cm notes I scanned. This requires ImageMagick:

brew install imagemagick

Use the convert command:

convert ./*.png -fuzz 1% -trim +repage -set filename:f "$(date)-%f" "./CroppedScans/Cropped-%[filename:f]"

Brew Install All Available AWS Tools

If you happen to find yourself using a decent number of AWS services, you might find this useful. If there are any errata, please let me know.

As of this writing, this should install all of the formulas that inherit from AmazonWebServicesFormula:

brew install auto-scaling aws-cfn-tools aws-elasticache aws-elasticbeanstalk aws-iam-tools aws-sns-cli cloud-watch ec2-ami-tools ec2-api-tools elb-tools rds-command-line-tools

You’ll get some errors about failing to link service, which is the same file for all of the formulas which try to link it. You’ll have to force the link, but let’s make sure the files are all the same.

Create JPEGs With Random Content Using Python Multiprocessing

Recently, I had a need to quickly generate a large number of JPEGs. I wrote this python script to generate JPEG images with random dimensions and content, as well as uuid4 filenames:

Python Multiprocessing Queues and Pipes

I’m currently working on something that requires the use of parallel processing, so I decided to write a sample implementation to become familiar with Python’s Multiprocessing module.

TI LaunchPad Development on Ubuntu 11.10 Running in VirtualBox

In my previous post, I was having trouble debugging and writing the binary files to the TI LaunchPad from Ubuntu 11.10 running in VirtualBox on Mac OS X Lion. I also tried using the VirtualBox ExtensionPack with USB 2.0 support to no avail.

This is an extension of the previous post if you’re running Ubuntu 11.10 in VirtualBox 4.1.10 on OS X Lion.

So I’ve figured out how to program and debug the Launchpad from within the guest OS. Albeit with a couple of caveats:

  1. The driver from osx-launchpad will need to be installed on the host OS.
  2. You have to use remote debugging via the GDB remote stub that mspdebug creates.
  3. When you use “target remote” from msp430-gdb, it will segfault, yeay!
  4. There will be some compiling from source to avoid the segfault party.

TI LaunchPad Development on Ubuntu 11.10

I got my hands on a couple of TI LaunchPads and was surprised there is no official support for Linux. Sad day. Regardless, at $4.30 each + shipping, they’re a steal.

Interested in getting development running on Ubuntu, I was reading Hack A Day’s LaunchPad on Ubuntu article until I got to the mspgcc4 project page and noticed

mspgcc4 is no longer supported. All contributions have been incorporated into mspgcc, which has newer versions of all components. Following the link to the GCC toolchain for MSP430 web site, you’ll find install instructions for “Ubuntu and other Debian-derived distributions” which will tell you “mspgcc will be available in Ubuntu Oneiric. Packages are listed here, and were shepherded by Luca Bruno.”

tl;dr: Seeing the Hack A Day article was from August of 2010, I figured I would try to go with the more updated toolchain.

How to Get Latest Stable Version of Nginx on Ubuntu

[latest nginx] (latest_nginx.sh) download
sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx
nginx -v
sudo service nginx start