Monday, February 17, 2014

Update node.js on Mac OS X

After installing node.js on Mac OS X using

 brew install node  


Do:

 brew update  
 brew upgrade node  
 npm update npm -g  
 node --version  

Sunday, February 16, 2014

Adding zlib to Wordpress on Heroku

You may need zlib in Heroku for Wordpress themes. Assuming you have compiled zlib.so already:

In the Wordpress repo directory,

 mkdir -p lib/php  
 mv zlib.so lib/php/  
 echo "extension = /app/www/lib/php/zlib.so" > php.ini  
 git add .  
 git push heroku production:master

Compiled on Heroku from source: https://s3.amazonaws.com/codesilo/zlib.so

Friday, October 4, 2013

My Computer Is Holding Me Hostage

My primary machine is the Macbook Pro I purchased in early 2011, right before the new model came out, of course. I ordered it with a "regular" 5,400 RPM SATA hard drive, with the intent that I would install an SSD myself.

Soon after I received it, I bought an SSD from a friend, installed it, and was absolutely blown away by the performance. Apps loaded instantly. Startup and shutdown times were less than 20 seconds. My productivity skyrocketed, and life was green.

Then the SSD crashed.

Pretty bummed, I re-installed the 5,400 RPM hard drive, intending to replace it with a new SSD as soon as I saved up a little scratch.

That was two years ago.

Let me tell you -- I have had a  new SSD sitting in my closet for about a year and a half, just waiting to be installed.

I can't do it.

I can't bring myself to sacrifice my working machine, that has all my software installed, and spend the (hopefully only) two days it will take to get the new OSes (I dual boot Windows 7 and Mac OS, much to the derision of my colleagues) and all my software back up-to-speed.

Sacrificing the time, and the effort, has proven to be too much risk. I guess a machine that works slowly is worth far more to me than the hassle of re-creating the machine to work more quickly.

I produce music and have a deadline next Friday. I simply can't waste two days without productivity right now.

Before that, I was working on a new software startup, and simply couldn't spare even a day of lost productivity, even if it meant that my app-launch times, and re-boot times were far slower.

And on and on ad infinitum.

This hard drive is holding me hostage.

At work I have a beautiful new Macbook Pro (also dual-booted; sue me) with 500GB flash storage option, and it is a dream machine.

Waiting for my home machine to boot (when I actually turn it off) gives me 3 minutes and 37 seconds to think about how much time I could save if only I weren't trying to be so productive.

The basic premise here is that a system that is working is worth a lot to me.

Maybe I'm too superstitious. Or lazy? I have enough experience to know that sometimes it doesn't just work out like it is supposed to.

Maybe next week I'll install that new SSD... but only if I can get it done before band practice!

Sunday, August 11, 2013

Friday, August 9, 2013

git commit deleted files

http://stackoverflow.com/questions/1402776/how-do-i-commit-all-deleted-files-in-git/1402793#1402793

To make git to automatically stage tracked files - including deleting the previously tracked files that were deleted without using git rm:

 $ git add -u  

Thursday, August 8, 2013

Using Amazon RDS MySQL with Heroku

https://devcenter.heroku.com/articles/amazon_rds

Install Java JRE

$ sudo apt-get install openjdk-6-jre  

Make sure JAVA_HOME is set

 $ export JAVA_HOME=/usr  
 $ echo $JAVA_HOME  
 $ export JAVA_HOME=/usr   
 $ echo $JAVA_HOME   
 $ $JAVA_HOME/bin/java -version   
 java version "1.6.0_27"   
 OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.2)   
 OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)   

Setup Amazon RDS Heroku CLI tools

http://docs.aws.amazon.com/AmazonRDS/latest/CommandLineReference/StartCLI.html

Download RDS CLI tools:

http://aws.amazon.com/developertools/2928

Unzip tools to /usr/local

$ export AWS_RDS_HOME=/usr/local/RDSCli-1.14.001/  
$ export PATH=$PATH:$AWS_RDS_HOME/bin
$ export AWS_CREDENTIAL_FILE=/usr/local/RDSCli-1.14.001/credential-file-path.template

Grant Heroku access to RDS using CLI tools:
(NOTE: 098166147350 is Heroku's secret number)

 $ rds-authorize-db-security-group-ingress \  
  --db-security-group-name default \  
  --ec2-security-group-name default \  
  --ec2-security-group-owner-id 098166147350 \  
  --aws-credential-file $AWS_CREDENTIAL_FILE  
 SECGROUP default default  
    EC2-SECGROUP default    sg-2**3 098166147350 authorizing  
    EC2-SECGROUP quicklaunch-1 sg-4**0 3***9 authorized  

Set DATABASE_URL in Heroku config


 heroku config:set DATABASE_URL=mysql2://username:password@rds-db-name.csisdr4twbmz.us-east-1.rds.amazonaws.com/database-name


Wednesday, August 7, 2013

Using Heroku - Common Usage

Show dynos / processes
heroku ps

Scale the number of web dynos to 1
heroku ps:scale web=1

Show heroku logs
heroku logs

Show environment variables for the app
heroku config

Add the SSL endpoint add-on
heroku addons:add ssl:endpoint

Add the SSL endpoint add-on (note, this is paid, $20/month)
heroku addons:add ssl:endpoint