This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# | |
# Feeds ganglia with web server error rate information. | |
# | |
# The latest version can be found on GitHub: | |
# | |
# http://gist.github.com/14352 | |
# | |
# This script can be called by Apache by setting up a special logger: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mechanize' | |
postal_codes = File.open("postal_codes.txt").read.split("\n") | |
# randomize to make the pattern slightly harder to see in logs | |
postal_codes = postal_codes.sort_by {|e| rand(10_000)} | |
@agent = WWW::Mechanize.new do |a| | |
a.user_agent_alias = 'Mac Safari' | |
a.max_history = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mechanize' | |
# Generates a CVS list: Postal Code, District ID, District Name | |
# Use like this: | |
# $~/postal_codes/A$ ruby /path/to/extract_elections_ca 2>/dev/null >> districts.csv | |
postal_codes = File.open("postal_codes.txt").read.split("\n") | |
postal_codes.each do |postcode| | |
postcode.sub! ' ', '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Displays the current git branch name and the dirty state in your Bash shell | |
# prompt. Add a line like this to your ~/.bashrc file: | |
# | |
# . ~/path/to/gist/bash-git-prompt | |
# | |
# To use this, you must enable "enable programmable completion features". | |
# Look at your ~/.bashrc for something like: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mechanize' | |
require 'net/http' | |
agent = WWW::Mechanize.new do |a| | |
a.user_agent_alias = 'Mac Safari' | |
end | |
archive = agent.get("http://railscasts.com/episodes/archive") | |
episodes = archive.links.select do |link| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mechanize' | |
require 'net/http' | |
agent = WWW::Mechanize.new do |a| | |
a.user_agent_alias = 'Mac Safari' | |
end | |
archive = agent.get("http://podcast.rubyonrails.org/programs/1/transcripts") | |
episodes = archive.links.select do |link| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read carefully. This script is mostly useless. | |
# It demonstrates how git could help keep two huge disks in sync, one bigger than the other. | |
# Execute like this: | |
# bash -xf git-travel-test | |
set -e | |
echo "suppose we build a really really big repo" | |
mkdir repo1 | |
cd repo1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Downloads Podcasts from www.nofluffjuststuff.com | |
require 'rubygems' | |
require 'mechanize' | |
agent = WWW::Mechanize.new do |a| | |
a.user_agent_alias = 'Mac Safari' | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mencoder in.flv -quiet -oac pcm -ovc xvid -ofps 15 -vf scale=160:-2 -xvidencopts bitrate=256:vhq=4:me_quality=4:max_bframes=0 -o tmp.avi && transcode -i tmp.avi -P1 -b 0,1 -o out.avi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Downloads podcasts from http://www.grailspodcast.com | |
# Creates files named like this example: | |
# grails_podcast_episode_17 - Interview with Jason Rudolph.mp3 | |
require 'rubygems' | |
require 'mechanize' | |
agent = WWW::Mechanize.new do |a| | |
a.user_agent_alias = 'Mac Safari' |
OlderNewer