Skip to content

Instantly share code, notes, and snippets.

View nateware's full-sized avatar

Nate Wiger nateware

View GitHub Profile
nateware / rake_changelog.rb
Created October 17, 2014 22:40
Simple rake task to spit out git log for
desc "show changelog"
task :changelog do
latest = `git tag |tail -1`.chomp
system "git log --pretty=format:'* %s %b [%an]' #{latest}..HEAD"
nateware /
Last active August 29, 2015 14:05
git merge for deployment purposes
git merge #{from_branch} -s recursive -X theirs --commit -m 'merge #{from_branch} to #{rails_env}'
nateware /
Last active April 8, 2024 05:48
Imagemagick to create favicon.ico with 16x16 and 32x32 sizes in it
# IE is still braindead so still use favicon.ico
convert -resize x16 -gravity center -crop 16x16+0+0 -flatten -colors 256 input.png output-16x16.ico
convert -resize x32 -gravity center -crop 32x32+0+0 -flatten -colors 256 input.png output-32x32.ico
convert output-16x16.ico output-32x32.ico favicon.ico
# Then, HTML needs to specify size="XxY" as largest size due to browser bugs
<link rel="shortcut icon" href="/favicon.ico" sizes="32x32">
nateware / unhappy_orchard
Created May 11, 2014 19:51
unhappy orchard
$ orchard hosts create
Orchard username: nateware
Default host running at
$ orchard docker ps
$ orchard docker run ubuntu echo hello world
nateware /
Last active July 14, 2017 02:44
Getting started with Vagrant and VirtualBox to test Chef with AWS OpsWorks
# Create vagrant image
vagrant init ubuntu12_64
vagrant up
vagrant ssh
# Fork aws/opsworks-cookbooks on github
# Clone locally
git clone
cd opsworks-cookbooks
nateware /
Last active December 20, 2015 23:29
Hadoop with Mahout simple setup
hadoop fs -rmr temp
MAHOUT_HOME/bin/mahout --input ~/Workspace/beerstats/beer-ratings-by-userid.csv --output ratings-pearson --similarityClassname SIMILARITY_PEARSON_CORRELATION
hadoop jar mahout-examples-0.8-job.jar --input ~/Workspace/beerstats/beer-ratings-by-userid.csv --output beer-ratings --similarityClassname SIMILARITY_LOGLIKELIHOOD --maxSimilaritiesPerItem 50
nateware /
Created February 8, 2013 21:24
DynamoDB example Leaderboard using boto
import boto
from boto.dynamodb.exceptions import *
from boto.dynamodb.batch import *
import pprint
class Leaderboard:
def __init__(self, game_mode):
self.conn = boto.connect_dynamodb()
self.table = self.conn.get_table("leaderboard_" + game_mode)
nateware /
Last active February 1, 2023 22:07
Check local files vs what's on S3, and upload any that have changed.
#!/usr/bin/env python
# Compare a file on S3 to see if we have the latest version
# If not, upload it and invalidate CloudFront
import fnmatch
import os
import boto
import pprint
import re
nateware / health.rb
Last active December 10, 2015 17:38
Healthcheck in Sinatra
# Ruby/Sinatra ELB health check example - GET /healthchk
get '/health' do
# any DB connection errors below will throw exceptions
Timeout.timeout(5) do
nkeys = Redis.current.dbsize
status = DB.fetch("show engine innodb status").first[:Status]