Continuous Deployment Resources

Posted in Operations, Software Development by on February 1, 2013 No Comments yet

Between one and two years ago Continuous Deployment seemed to have a lot of buzz, whether it was praise or condemnation. Now seems to be the period after the storm. Continuous Deployment has been proven by the likes of Flickr, Facebook, Etsy, IMVU, and Wealthfront, to name a few.

This blog post is simply a categorized list of links and resources to learn more about continuous deployment. Unlike a traditional blog post, I’ll likely be updating this over time much as I find more resources.

Updated: February 7, 2013

More…

Scripts to Send an SMS Text Message When You’re Idle on Adium (for Mac OS X)

Posted in Programming by on May 10, 2012 No Comments yet

I work in an industry, technology, where we’re basically working around the clock. Even “after hours” I’m checking work email and monitoring the team chat room. Every so often, I miss out on the fact that somebody is trying to reach me in the chat room. Either the sound on my computer is muted, not loud enough, or I’m just out of the house. To solve this problem I decided that it would be great if I could receive an SMS text message whenever somebody tries to reach me via chat after my computer has been idle for 15 minutes.

I started down the path of writing an AppleScript (since this is already built into Adium) to make this work but quickly became frustrated by this approach when I discovered that the sender nor the message were accessible in the AppleScripts. I eventually found a blog post announcing an Adium Xtra, called Pipe Events, which, when triggered, will run a shell script with the message as STDIN and the sender as the first argument. It’s a decent plugin but has a pretty frustrating bug, if you script has an output to STDOUT or the shell, the script will stop running at that point with a broken pipe. So make sure your scripts are silent.

Setup

You’ll need a few things to get started.

  1. An account on If This Then That, a great tool to glue together different API driven sites on the internet using very elementary scripts.
  2. Use this recipe on If This Then That:  Send email to ifttt with #adium in the subject and receive SMS text message.
  3. Next you’ll need the mail gem. I use rvm but if you do not, then ignore the first line.
$ rvm use 1.9.2-p180
$ gem install mail

The Script to Run the Script

I decided to run my script using ruby but since I’m using rvm, I ran into some issues trying to get /usr/bin/ruby working with the gems required to make this work. Therefore, the first step was to write a bash script to invoke rvm. Using the rvm docs on scripting as a guide, I created this script to invoke my ruby script.

#!/bin/bash
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"
else
logger "ERROR: An RVM installation was not found." 1>&2
fi

# Uncomment this log the output of this command to system.log
# The output should be: "rvm is a function"
# logger `type rvm | head -1`

# Suppress output or else the Adium Xtra, Pipe Events will break
rvm use 1.9.2-p180 > /dev/null

# Run ruby script
ruby ~/bin/adium_alert.rb $1 < /dev/stdin

The Ruby Script

The following script will retrieve the ide time of the system and send an email, via gmail, to ifttt to trigger the SMS text message. In the script below I also log all messages to a log file regardless of the idle time.  To get the idle time, I used the method described in this Mac OS X Hints article. The only thing I don’t like about this script is that it has to contain my email password. I would eventually like to change it to use Google OAuth for IMAP/SMTP.

require 'rubygems'
require 'mail'

time = Time.now
#idle_time = `ioreg -c IOHIDSystem | perl -ane 'if (/Idle/) {$idle=(pop @F)/1000000000; print $idle,"";last}'`

# Get the system idle time
idle_time = `ioreg -c IOHIDSystem | sed -e '/HIDIdleTime/!{ d' -e 't' -e '}' -e 's/.* = //g' -e 'q'`.to_f / 1000000000

# Format the message
msg = "#{time.strftime('%y-%m-%d %H:%M:%S')}: from #{ARGV[0]} - #{STDIN.read.strip} (idle: #{idle_time})"

# Log the message to a file
File.open("#{ENV['HOME']}/adium.log", "a+") do |f|
  f.puts msg
end

# If idle time is greater than 15 miuntes, send an email
if idle_time.to_i >= 15*60
  begin
    Mail.defaults do
      delivery_method :smtp, {
        :address => 'smtp.gmail.com',
        :port => '587',
        :user_name => 'gmail_user_name',
        :password => 'gmail_password',
        :authentication => :plain,
        :enable_starttls_auto => true
      }
    end
    Mail.deliver do
      to "trigger@ifttt.com"
      from "email_address_expected_by_ifttt@example.com"
      subject "#adium"
      body msg
    end
  rescue Exception => e
    # Log errors
    File.open("#{ENV['HOME']}/adium.log", "a+") do |f|
      f.puts "#{e.message}: #{e.backtrace}"
    end
  end
end

nginx Rewrite for AtomPub on WordPress with Clean URLs

Posted in Operations by on March 13, 2012 No Comments yet

For my other blogs, Axis & Allies.org and Beer 47, I’ve shortened my workflow by pushing the photos directly from Adobe Lightroom to WordPress using the plugin LR/Blog. However, since I’m using nginx as my webserver, the AtomPub url was not working out of the box but I figured it out and I have the solution in this post.

For it’s WordPress integration, LR/Blog can use either XML-RPC or AtomPub to publish photos. Each have their benefits and drawbacks: XML-RPC doesn’t transfer the metadata for the photo, such as the title and caption, and AtomPub does not allow the photos to be updated. Since I only publish my photos one, I would much rather use AtomPub to include the titles and captions.

The default URL for the WordPress AtomPub integration is /wp-app.php/service but since I did not have a rewrite rule in nginx, I simply received a 404 error, file not found. After some experimentation I added this rewrite rule.

if ($request_uri ~* "^/wp-app.php.*$" ) {
rewrite ^/wp-app.php/(.+)$ /wp-app.php?q=$1 last;
    break;
}

If you are using clean urls, you will likely have a rewrite block something like this:

if (!-e $request_filename) {
    rewrite ^(.+)$ /index.php?q=$1 last;
    break;
}

Be sure to put your new rewrite rule before your clean url rewrite rule.

Build 47 is Now Live on a New Host

Posted in Announcements by on June 15, 2011 No Comments yet

I have just migrated Build 47 to a new VPS host. If you’re seeing this post, you’re reading from the newserver. Enjoy!

Scala at Twitter at E2E SF Tech Talks

Posted in Events by on August 11, 2010 No Comments yet

Ever since the SDForum panel on emerging languages I’ve been very intrigued by the Scala programming language but have not been able to invest some time in a project to try it out. I got as far as setting up Eclipse with Scala and Lift but got no further. When I heard about the Engineer-to-Engineer Tech Talk, hosted at Redfin, about the use of Scala at Twitter, I made every effort to attend. The presentation was at Redfin on April 30, 2010  given by Alex Payne, who, at the time, was at Twitter and was one of the primary advocates of the introduction of Scala at Twitter. The talk really focused mostly on the good points of Scala and some of the reasons not to use Scala were possibly underplayed.

More…

Riak at Appush, San Francisco NoSQL Meetup

Posted in Events by on May 13, 2010 2 Comments

A few weeks ago the San Francisco NoSQL Meetup Group held its first meeting at CBS Interactive in San Francisco with the topic of Riak at Appush presented by Dan Reverri from Appush. I had not previously heard of Riak so before attending the talk I very briefly looked up what it is. I discovered it was a key-value created by Basho and since I had been doing some reading about Redis and Voldemort that was enough information to get me interested. After the talk, thanks to Dan’s great presentation, I discovered Riak has a lot more capabilities than just a simple key-value store. More…

SF Selenium Meetup Testing Tools Demo Night

Posted in Events by on April 30, 2010 No Comments yet

Several months ago I downloaded a copy of Selenium to evaluate how we could use it to improve automated acceptance or functional testing at Spoke. It was quite an useful tool but we didn’t have cycles for setting up some sort of infrastructure for running the tests. When I saw there was going to be an upcoming meetup, I thought it would be a good opportunity to try to get inspired on using Selenium again and also learn what is new in the world of Selenium. On April 20, 2010 I attended the San Francisco Selenium Meetup at Sauce Labs (the folks behind Selenium) where the topic of the evening was “Testing Tools Demo Night.” The night included 4 speakers and demos and an opportunity to talk to the folks at Sauce Labs about their products. I even won 1000 minutes of Sauce OnDemand. More…

Neo4J Presentation at Twitter Headquaters

Posted in Events by on April 27, 2010 No Comments yet

Several weeks ago, on March 31, 2010, Twitter hosted a talk about Neo4j at the Twitter headquarters in San Francisco. If you are not familiar with Neo4J it is a database that stores data as a graph, with nodes, relationships (edges), and attributes (of the node). As far as I could glean from the presentation the graph is directed and can be weighted as well. From my perspective there are a few aspects of Neo4J that are quite impressive. First, the simplicity of the API let’s you get up and running in very little time. Next, the performance is quite remarkable with 1M nodes with each node having 50 connections, it takes only 2 milliseconds to find out if there is a path between two randomly chosen nodes. It also allows for transactions and rollbacks. More…

Social Search with Aardvark SDForum Meeting

Posted in Events by on April 1, 2010 No Comments yet

The Search SIG of SDForum has a really interesting talk on March 30, 2010 about social search with the co-founder of Aardvark, Damon Horowitz. When I saw that this talk was coming up, I was immediately drawn to it for a few reasons. First, social search is a somewhat new idea, the definition of which differs depending on who you talk to or what you read. Second, I’m an active Aardvark user and I was interested in some of the inner workings of this very effective and powerful service. More…

The First SF Redis Meetup

Posted in Events by on March 26, 2010 No Comments yet

Although I am not a Redis user, yet, I do have an interest in NOSQL (Not Only SQL) data storage and Redis has come up in readings and discussions as a very slick piece of technology. I figured that the First San Francisco Redis Meetup would be a good opportunity to find out more about Redis and how other software developers and companies have deployed it. Even though I was one of two or three who have not used Redis, this meetup met my expectations. More…

Next Page »