Skip to content

Instantly share code, notes, and snippets.

@dmerrick
dmerrick / ethers.rb
Created June 8, 2009 18:22
For Morgan: parses an ethers file to generate a dhcpd.conf file.
#!/usr/bin/env ruby -wKU
# This program scans your ethers file to generate a valid dhcpd.conf file
# (or at least a segment of one). In addition, it will read your hosts file
# to see if there are any known aliases it can add. It then prints the
# formatted results to standard out.
#
# Author:: Dana Merrick (mailto:letterkills+ethers@gmail.com)
# Copyright:: Copyright (c) 2009 Dana Merrick
# License:: Released under the MIT license
#!/usr/bin/ruby
# as of 20100101 requires the latest yajl-ruby
# http://github.com/brianmario/yajl-ruby
require 'rubygems'
require "yajl/http_stream"
require 'em-http'
require 'mq'
@andruby
andruby / dyndns_update.rb
Created April 17, 2010 11:01
Zerigo dynamic dns updater
#!/usr/bin/env ruby
# Dynamic DNS updater by Andruby for Zerigo
# www.andrewsblog.org
ApiKey = 'myzerigoapikey' # your Zerigo API key
Host = 'test.example.com' # the host you want to dynamically update
User = 'user@domain.com' # your Zerigo username
NameServer = 'a.ns.zerigo.net' # Zerigo nameserver to query
LastIpTmpFile = '/tmp/dyn_update_last_ip' # a temporary file where we store the last ip adress
@objectoriented
objectoriented / aws_cf_invalidate.rb
Created September 28, 2010 17:37 — forked from jmlacroix/aws_cf_invalidate.rb
Ruby script to invalidate objects on Amazon's CloudFront CDN (shows status of recent requests also)
require 'rubygems'
require 'hmac-sha1' # on OS X: sudo gem install ruby-hmac
require 'net/https'
require 'base64'
#
# CHANGE ME: S3 access credentials go here, along with CloudFront Distribution ID
#
s3_access=''
s3_secret=''
@billdueber
billdueber / gist:1154163
Created August 18, 2011 14:29
OSX command-line args
1. Go to the app directory
cd /Applications/Google\ Chrome.app/Contents/MacOS/
2. Rename the app to app.orig
mv Google\ Chrome Google\ Chrome.orig
3. Create a shell script with the original name that uses the args you want
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@alanbriolat
alanbriolat / default.conf
Created September 28, 2011 14:01
nginx userdir + PHP-FPM
server {
listen 80;
server_name localhost;
# ... other default site stuff, document root, etc. ...
location ~ ^/~(?<userdir_user>.+?)(?<userdir_uri>/.*)?$ {
alias /home/$userdir_user/public_html$userdir_uri;
index index.html index.htm index.php;
autoindex on;
@phpdude
phpdude / nginx.conf
Last active February 28, 2024 04:36
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@felipelavinz
felipelavinz / apache
Created February 9, 2012 14:00
Canonical redirects for Apache, lighttpd and nginx
## Canonical redirect for Apache
# BEGIN Canonical Redirect
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC] ## will match any domain that's not our main domain
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
</IfModule>
# END Canonical Redirect
@jblyberg
jblyberg / ripper.sh
Created October 9, 2012 13:10
Totally basic script to rip audiobook CDs into a single file.
#!/bin/sh
#
# Totally basic script to rip audiobook CDs into a single file.
# I then use Audiobookbinder to create .m4b files so I can listen to them
# on my iPhone
#
# You'll need to:
# brew install cdparanoia
# brew install shntool
# brew install lame