Skip to content

Instantly share code, notes, and snippets.

@coldclimate
coldclimate / gist:8831241
Created February 5, 2014 19:28
How I got hubot running and talking to hipchat on Ubuntu 13
sudo apt-get update
sudo apt-get install nodejs npm
sudo apt-get install build-essential libssl-dev git-core redis-server libexpat1-dev
npm install -g coffee-script
sudo npm install -g coffee-script
sudo npm install -g hubot coffee-script
sudo mkdir myrobot
sudo chown ubuntu:ubuntu myrobot
hubot --create myrobot
cd myrobot/
{
"BrowserGUID" : "aa558a9bdba8b2558260e168bd79f3ff",
"ContactId" : "961f9d23c127472507b8441b25e1025f",
"Duration" : 0,
"GoalNo" : 2,
"GoalTitle" : "Form submission",
"GoalType" : "form",
"PageTypeId" : 3,
"ProcessedPPA" : [
"ProcessActions_FieldToCompany_Post_input_2",
@coldclimate
coldclimate / gist:9994931
Created April 5, 2014 17:22
Grab your last.fm all time stats and see what you've contributed to the world listening stats.
import lastfm
api_key = 'REPLACEME'
api = lastfm.Api(api_key)
user = api.get_user('REPLACEME')
tracks = user.top_tracks
for track in tracks:
gcount = api.get_track(artist=track.artist.name,track=track.name).stats.playcount
print "%s %s %s of %s (%f )" % (track.artist.name,track.name, track.stats.playcount, gcount, track.stats.playcount/gcount)
@coldclimate
coldclimate / gist:11288076
Last active August 29, 2015 14:00
This time last week
var last_week = new Date();
last_week.setDate(last_week.getDate() -7);
03-Jun-2014 17:02:21 Jekyll output:
03-Jun-2014 17:02:21 Configuration file: _config-live.yml
03-Jun-2014 17:02:21 Source: /home/bamboo/bamboo-agent-home/xml-data/build-dir/CAMPAIGNDIGITAL-CANDDI-GRUNT
03-Jun-2014 17:02:21 Destination: /home/bamboo/bamboo-agent-home/xml-data/build-dir/CAMPAIGNDIGITAL-CANDDI-GRUNT/_site
03-Jun-2014 17:02:21 Generating...
03-Jun-2014 17:02:21 jekyll 2.0.3 | Error: No such file or directory - /home/bamboo/bamboo-agent-home/xml-data/build-dir/CAMPAIGNDIGITAL-CANDDI-GRUNT/_site/sitemap.xml
03-Jun-2014 17:02:21 Warning: Command failed:  Use --force to continue.
03-Jun-20
### Keybase proof
I hereby claim:
* I am coldclimate on github.
* I am coldclimate (https://keybase.io/coldclimate) on keybase.
* I have a public key whose fingerprint is 8696 1302 2C89 6D7E 8E53 4256 DE45 8702 1053 08E4
To claim this, I am signing this object:
@coldclimate
coldclimate / gist:7eee74748750ab51c6e7
Created November 29, 2014 18:15
Hello World in Rails
vagrant@vagrant-ubuntu-trusty-64:/vagrant/helloworld$ history
1 sudo apt-get update
2 sudo apt-get install ruby
3 ruby -v
4 sudo apt-get install rubygems
5 gem install rails
6 sudo gem install rails (cancelled - wondered if I should use the version in the tutorial)
7 sudo gem install rails -v 4.2.0.rc1 (also failed)
8 sudo gem remove rails
9 sudo gem install rails (might as well just check)

AWS CLI Profiles

Use named profiles if you have to connect using more than one set of credencials. No more editing .aws_config http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-multiple-profiles

(sub tip: don't set a default and thus never accidentally conenct to the wrong place) aws --profile=prod ec2

Monitoring S3

There is no CloudWatch integration with S3. Roll you own by bolting together readin S3 and pushing it into CloudWatch (or other monitoring tools). Use awk to slice out the columns you are interested in.

@coldclimate
coldclimate / gist:740230020f9c8cc077b7
Created December 14, 2014 19:39
Getting @github pages to work on ubuntu 14.04 vagrant box
1 sudo apt-get update
2 sudo -i
3 gem install bundler
4 sudo gem install bundler
5 cd /vagrant/
6 vi Gemfile
7 bundler install
8 vi Gemfile
9 bundler install
10 vi Gemfile
{
'invocation': {
'module_name': u 'ec2_vpc',
'module_args': ''
},
u 'vpc_id': u 'vpc-42b1d027',
u 'changed': False,
u 'vpc': {
u 'dhcp_options_id': u 'dopt-331f0551', u 'region': u 'us-east-1', u 'cidr_block': u '10.181.208.0/22', u 'state': u 'available', u 'id': u 'vpc-42b1d027'
},