Skip to content

Instantly share code, notes, and snippets.

View scotttam's full-sized avatar

Scott Tamosunas scotttam

View GitHub Profile
@scotttam
scotttam / tracker.rb
Created May 26, 2011 17:24
Pull down the tracker stories
begin
require 'pivotal_tracker'
rescue LoadError
puts "This script requires the pivotal-tracker gem: gem install pivotal-tracker"
exit(1)
end
CLIENT_TOKEN = 'GET YER OWN'
PROJECT_ID = 12345
MILESTONE_LABELS = ['m1', 'm2', 'm3', 'm4']
@scotttam
scotttam / watch_unicorn.sh
Created April 13, 2011 12:56
script to watch the unicorns
#!/bin/sh
loop_count=10000
while [ $loop_count -gt 0 ]; do
clear
ls -l /data/server/current
uptime
ps wax --forest | grep [u]nicorn
sleep 1
echo "Refreshing..."
@scotttam
scotttam / decrypt.rb
Created March 17, 2011 14:56
decrypt PBKDF2/SHA1 and AES
require "base64"
require 'openssl'
require 'iconv'
CIPHER = "aes-256-cbc"
#http://www.ruby-doc.org/ruby-1.9/classes/OpenSSL/PKCS5.html
PASSPHRASE = "12345"
IV = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16].pack("c*")
@scotttam
scotttam / Decrypter.java
Created March 17, 2011 14:37
encrypt and decrypt with PBKDF2/SHA1 and AES
import javax.crypto.Cipher;
import java.security.spec.KeySpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.SecretKeyFactory;
import java.security.AlgorithmParameters;
import javax.crypto.spec.IvParameterSpec;
public class Decrypter {
@scotttam
scotttam / app_start_time_mixpanel.rb
Created January 26, 2011 20:56
Recording app start times with mixpanel.rb
#If you see 1 on the terminal, that's success. 0 is bad.
require 'rubygems'
require 'base64'
require 'json'
event_hash = {}
event_hash['event'] = "app_start"
event_hash['properties'] = {:token => "4130e0e1bf5ade215e80ebc0b7765b6f", :time => Time.now.to_i, :publisher_id => "1234", :app_id => "5678", :start_time => Time.now.to_i}
@scotttam
scotttam / app_duration_mixpanel.rb
Created January 26, 2011 20:53
Putting app running time metrics into mixpanel
#If you see 1 on the terminal, that's success. 0 is bad.
require 'rubygems'
require 'base64'
require 'json'
event_hash = {}
event_hash['event'] = "app_time"
event_hash['properties'] = {:token => "4130e0e1bf5ade215e80ebc0b7765b6f", :publisher_id => "1234", :app_id => "5678", :time => Time.now.to_i, :duration => rand(10000)}