Skip to content

Instantly share code, notes, and snippets.

View ejsarge's full-sized avatar

Edward Sargisson ejsarge

  • Vancouver, BC, Canada
View GitHub Profile
@ejsarge
ejsarge / user-data
Last active December 12, 2015 07:38
Ubuntu user data for bootstrapping chef with the omnibus installer
#!/bin/bash
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
curl -L https://www.opscode.com/chef/install.sh | sudo bash -s -- -v 10.18.2
mkdir -p /var/log/chef
mkdir -p /var/backups/chef
mkdir -p /var/run/chef
mkdir -p /var/cache/chef
mkdir -p /var/lib/chef
mkdir /etc/chef
cat - >/etc/chef/bootstrap.json <<EOF
@ejsarge
ejsarge / gist:2351238
Created April 10, 2012 13:06
TrailHunger.com Setup AWS Auto Scaling Notifications
as-put-notification-configuration MyGroup --topic-arn arn:placeholder:MyTopic
--notification-types autoscaling:EC2_INSTANCE_LAUNCH, autoscaling:EC2_INSTANCE_TERMINATE,
autoscaling:EC2_INSTANCE_LAUNCH_ERROR, autoscaling:EC2_INSTANCE_TERMINATE_ERROR,
autoscaling:TEST_NOTIFICATION
@ejsarge
ejsarge / trailhunger-course-elevation-profile-sample.html
Created April 6, 2012 22:01
Sample code for displaying a Course Elevation Profile from TrailHunger.com
<img src="/api/1/course/26/1/chartElevationProfile.png?apikey=azdpyy7vwm&size=600x305"
alt="Dirty Duo 25km Course Elevation Profile" height="305" width="600" border="0"/>
@ejsarge
ejsarge / embedded-snippet.html
Created April 5, 2012 04:16
TrailHunger.com Embedded Course Map and Download to Device
<div class="thgr_downloadtodevicetop"/>
<p>Have a Garmin watch? <a href="http://www.trailhunger.com/dl-crs/25">Download this course straight to your watch</a> and know where you're going! <strong><em>FREE!</em></strong> </p>
</div>
<div class="thgr_cmap" style="width:100%;height:400px">
<a href="http://www.trailhunger.com/course/25"><img src="http://maps.googleapis.com/maps/api/staticmap?center=49.340640652173064,-122.99643894999997&zoom=12&size=649x400&maptype=terrain&sensor=false" alt="Dirty Duo 50km Course Map"/>
</a>
</div>
<script type="text/javascript">
(function() {
_thgr_course_map_class='thgr_cmap'; _thgr_api_key="8h93yrhqkl";
@ejsarge
ejsarge / JazzToGitIssues.rb
Created February 2, 2012 14:24
Jazz Rational Team Concert Work Items to GitHub Issues
# This script converts unresolved work items in IBM Rational Team Concert and
# imports them into GitHub as issues.
#
# Copyright (C) 2012 TrailHunger.com Trail Data Inc.
# Contact: edward@trailhunger.com
# Licence: Creative Commons Attribution Share-Alike (http://creativecommons.org/licenses/by-sa/2.5/ca/)
# To attribute: Please credit TrailHunger.com and link to any page on the site.
# Usage:
# 1. Replace github-username and github-password with your GitHub username and password.
@ejsarge
ejsarge / Snippet.html
Created January 10, 2012 13:24
TrailHunger.com Course Map
<div id="course-map" style="width:100%;height:400px"></div>
<script type="text/javascript">
(function() {
_thgr_course_map_element='course-map';_thgr_course_id=40; _thgr_api_key="azdpyy7vwm";
var _thgr = document.createElement('script'); _thgr.type = 'text/javascript'; _thgr.async = true;
_thgr.src = document.location.protocol + '//cdn.trailhunger.com/emb/r1/course-widget-min.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(_thgr);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://www.trailhunger.com/course/40">Orcas Island 50km course map</a> powered by TrailHunger.com.</noscript>
@ejsarge
ejsarge / Crontab entry
Created October 27, 2011 02:54
Purging ec2 snapshots using tags
# Chef Name: osm_db_snapshot.sh
00 01 * * * /usr/local/sbin/osm_db_snapshot.sh
# Chef Name: ec2-purge-snapshots-osm-db
10 03 * * * /usr/local/sbin/ec2-purge-snapshots.rb -t env=prod -t contents=osm_db -h 48 -d 0 -w 0 -m 0 -a /root/.aws_access_key -e /root/.aws_secret_key