Skip to content

Instantly share code, notes, and snippets.

View systembell's full-sized avatar

Aaron Bell systembell

View GitHub Profile
@swinton
swinton / upstart_virtualenv_test.conf
Created March 5, 2012 15:44
Example of an upstart job running a python script under a virtualenv
########################################
##### upstart_virtualenv_test.conf #####
##### install in /etc/init #####
########################################
description "Testing virtualenv and upstart setup"
env PYTHON_HOME=/home/steve/.virtualenvs/upstart-test
start on runlevel [2345]
@mendelgusmao
mendelgusmao / gist:2356310
Created April 11, 2012 01:53
high performance URL shortener on steroids using nginx, redis and lua
# based on http://uberblo.gs/2011/06/high-performance-url-shortening-with-redis-backed-nginx
# using code from http://stackoverflow.com/questions/3554315/lua-base-converter
# "database scheme"
# database 0: id ~> url
# database 1: id ~> hits
# database 2: id ~> [{referer|user_agent}]
# database 3: id ~> hits (when id is not found)
# database 4: id ~> [{referer|user_agent}] (when id is not found)
# database 5: key "count" storing the number of shortened urls; the id is generated by (this number + 1) converted to base 62
@systembell
systembell / create_instance.rb
Created April 19, 2012 22:03
Create EC2 VPC Instance
#!/usr/bin/env ruby
require 'fog'
require 'trollop'
require 'yaml'
STDOUT.sync = true
@systembell
systembell / create_ebs.rb
Created May 12, 2012 03:12 — forked from lusis/create_ebs.rb
Small script to setup ec2 instances and EBS volumes for my blog post series
# Create 4 volumes and attach them to hdb
%w[sdi sdj sdk sdl].each do |dev|
volume = AWS.volumes.new :device => "/dev/#{dev}", :size => 5, :availability_zone => hdb.availability_zone
volume.server = hdb
volume.save
end
@muhh
muhh / pagerduty.coffee
Created May 30, 2012 16:45
partial hubot pagerduty integration
# Interacts with PagerDuty
# Author: Markus Heurung <[email protected]>
#
# pd inc(idents) [all|ack(nowledged)|res(olved)] - list incidents (only all for now)
# pd ack(nowledge) <key> - acknowledge incident - not fully working yet
# pd res(olve) <key> - resolve incident - not fully working yet
# pd #ID - show incident details - not working yet
# pd trigger <description> - create new incident
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active January 28, 2026 15:05
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@ChrisLundquist
ChrisLundquist / elasticsearch.coffee
Created November 10, 2012 11:04
elasticsearch plugin for Hubot
# Description:
# Log all the things to ElasticSearch then lets you ask hubot what you missed
#
# Dependencies:
# None
#
# Configuration:
# ELASTICSEARCH_HOSTNAME - E.G. elasticsearch.example.com:9200, where to send the put requests
# ELASTICSEARCH_USERNAME - OPTIONAL basic auth username
# ELASTICSEARCH_PASSWORD - OPTIONAL basic auth password
@leifg
leifg / Vagrantfile
Last active December 5, 2025 09:30
Add a second disk to system using vagrant
file_to_disk = './tmp/large_disk.vdi'
Vagrant::Config.run do |config|
config.vm.box = 'base'
config.vm.customize ['createhd', '--filename', file_to_disk, '--size', 500 * 1024]
config.vm.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
import sys
import subprocess
import tempfile
import urllib
text = sys.stdin.read()
chart_url_template = ('http://chart.apis.google.com/chart?'
'cht=qr&chs=300x300&chl={data}&chld=H|0')
chart_url = chart_url_template.format(data=urllib.quote(text))