Skip to content

Instantly share code, notes, and snippets.

View nateware's full-sized avatar

Nate Wiger nateware

View GitHub Profile
@nateware
nateware / rake_changelog.rb
Created October 17, 2014 22:40
Simple rake task to spit out git log for changelog.md
desc "show changelog"
task :changelog do
latest = `git tag |tail -1`.chomp
system "git log --pretty=format:'* %s %b [%an]' #{latest}..HEAD"
end
@nateware
nateware / git_merge_force.sh
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
nateware / make_favicon.sh
Last active June 27, 2024 16:02
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
nateware / unhappy_orchard
Created May 11, 2014 19:51
unhappy orchard
$ orchard hosts create
Orchard username: nateware
Password:
Default host running at 107.170.120.216
$ orchard docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ orchard docker run ubuntu echo hello world
@nateware
nateware / chef_vagrant.sh
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 http://files.vagrantup.com/precise64.box
vagrant up
vagrant ssh
# Fork aws/opsworks-cookbooks on github
# https://github.com/aws/opsworks-cookbooks
# Clone locally
git clone [email protected]:yourusername/opsworks-cookbooks.git
cd opsworks-cookbooks
@nateware
nateware / hadoop_cmds.sh
Last active June 27, 2024 16:03
Hadoop with Mahout simple setup
hadoop fs -rmr temp
MAHOUT_HOME/bin/mahout org.apache.mahout.cf.taste.hadoop.similarity.item.ItemSimilarityJob --input ~/Workspace/beerstats/beer-ratings-by-userid.csv --output ratings-pearson --similarityClassname SIMILARITY_PEARSON_CORRELATION
hadoop jar mahout-examples-0.8-job.jar org.apache.mahout.cf.taste.hadoop.item.RecommenderJob --input ~/Workspace/beerstats/beer-ratings-by-userid.csv --output beer-ratings --similarityClassname SIMILARITY_LOGLIKELIHOOD --maxSimilaritiesPerItem 50
@nateware
nateware / leaderboard_boto.py
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
nateware / s3update.py
Last active May 31, 2024 18:35
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
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]
end
end