Skip to content

Instantly share code, notes, and snippets.

View boyd's full-sized avatar

Patrick Boyd boyd

  • San Francisco, CA
View GitHub Profile
@boyd
boyd / .vimrc
Created February 22, 2012 01:25
My .vimrc
set number
set filetype=true
set nowrap
set sw=2
set ignorecase
set smartcase
set ts=2
syntax enable
set hlsearch
@boyd
boyd / webcache.rb
Created September 9, 2012 00:31
Simple web request file caching system (similar to wget)
require 'FileUtils'
require 'net/http'
require 'uri'
class WebCache
def initialize
@download_cache_root = "./downloads"
end
def url_to_path(url)
@boyd
boyd / check_internet.py
Created October 22, 2012 03:27
Script for monitoring internet
import datetime
import time
import urllib2
def log(s, ts=None):
ts = datetime.datetime.now()
print ts.strftime("%H:%M:%S ") + s
def main():
last_state_change = time.time()
@boyd
boyd / bedtime.sh
Created February 8, 2013 05:53
Command to put Macbook Pro to sleep in X minutes (e.g. ./bedtime.sh 20)
sleep `python -c "print 60*$1"` && osascript -e 'tell application "System Events" to sleep'