Skip to content

Instantly share code, notes, and snippets.

View bradmontgomery's full-sized avatar

Brad Montgomery bradmontgomery

View GitHub Profile
@graphaelli
graphaelli / ganglia_mysql.py
Created February 21, 2012 17:32
Ganglia For MySQL Metrics
"""
The MIT License
Copyright (c) 2008 Gilad Raphaelli <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
#!/bin/sh
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
# fix the notorious perl locale error
sudo apt-get install -y multipath-tools
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
@bradmontgomery
bradmontgomery / line-highlighter.js
Created February 10, 2012 05:47
bookmarklet to highlight one line of text based on the position of your mouse
javascript:(function (){h=document.createElement("div");h.setAttribute("id","_bradshiliteline");h.setAttribute("style","width:100%;height:20px;background-color:yellow;font-size:inherit;line-height:inherit;position:absolute;left:0px;top:0px;z-index:999;opacity:0.4;");document.getElementsByTagName("body")[0].appendChild(h);window.onmousemove=function(e){var h=document.getElementById("_bradshiliteline");h.style.top=(e.pageY+15)+"px";h.setAttribute("class",e.pageY);}})();
@jtimberman
jtimberman / knife.rb
Created February 1, 2012 19:33
Commented knife.rb for all the things
# Knife Configuration File.
#
# This is a Ruby DSL to set configuration parameters for Knife's
# general options. The default location for this file is
# ~/.chef/knife.rb. If multiple Chef repositories are used,
# per-repository configuration files can be created. A per repository
# configuration file must be .chef/knife.rb in the base directory of
# the Chef repository. For example,
#
# ~/Development/chef-repo/.chef/knife.rb
def pearl_jam():
n = 1
while n < 10:
yield n
n += 1
n = pearl_jam()
n.next()
# OUT: 1
n.next()
@millisami
millisami / ubuntu-11.10-gems.erb
Created December 11, 2011 19:16 — forked from kashif/ubuntu-11.10-gems.erb
Chef bootstrap With rvm and ruby 1.9.3 on ubuntu 11.10
bash -c '
<% if knife_config[:bootstrap_proxy] -%>
(
cat <<'EOP'
<%= "proxy = #{knife_config[:bootstrap_proxy]}" %>
EOP
) > ~/.curlrc
<% end -%>
if [ ! -f /usr/bin/chef-client ]; then
@acdha
acdha / curl-ttfb.sh
Created November 28, 2011 23:03
Use curl to measure and report HTTP response times (pre-, start- and total transfer)
#!/bin/bash
#
# Report time to first byte for the provided URL using a cache buster to ensure
# that we're measuring full cold-cache performance
while (($#)); do
echo $1
curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" \
-w "%{http_code}\tPre-Transfer: %{time_pretransfer}\tStart Transfer: %{time_starttransfer}\tTotal: %{time_total}\tSize: %{size_download}\n" \
"$1?`date +%s`"
@binarymatt
binarymatt / manage_fabric.py
Created October 31, 2011 03:03 — forked from bradmontgomery/manage_fabric.py
A stab at running remote Django management commands via fabric.
def manage(management_command, args=[]):
with cd(REMOTE_PROJECT_DIR):
with prefix('source /path/to/virtualenv/bin/activate'):
run('python manage.py %s %s' % (management_command, ' '.join(args))
@alexle
alexle / pythonsms.py
Last active December 1, 2023 01:01
How to send a text message with python
# sms.py
# Sends sms message to any cell phone using gmail smtp gateway
# Written by Alex Le
import smtplib
# Use sms gateway provided by mobile carrier:
# at&t: [email protected]
# t-mobile: [email protected]
# verizon: [email protected]
@henrygarner
henrygarner / gist:1123179
Created August 3, 2011 17:14 — forked from timcowlishaw/gist:1123148
Resources for setting up RVM and Passenger on Chef
http://www.agileweboperations.com/chef-rvm-ruby-enterprise-edition-as-default-ruby
http://www.christophersamuelson.com/2010/10/22/chef-rvm-capistrano-bundler/
http://blog.ninjahideout.com/posts/a-guide-to-a-nginx-passenger-and-rvm-server
http://brandontilley.com/2011/01/29/serving-rails-apps-with-rvm-nginx-unicorn-and-upstart.html
http://brandontilley.com/2011/01/29/rvm-unicorn-and-upstart.html
Chef workflow
# Install cookbook from opscode community site. (Automatically commits to local repo)
knife cookbook site install <COOKBOOK_NAME>