Skip to content

Instantly share code, notes, and snippets.

View PatrickTulskie's full-sized avatar

patrick tulskie PatrickTulskie

View GitHub Profile
@PatrickTulskie
PatrickTulskie / adhoc.scpt
Created January 20, 2012 19:40
Create an adhoc network with your WiFi card on Lion
property NetworkName : "adhoc_network"
property NetworkPassword : "password"
property CreateMenuName : "Create Network…"
try
do shell script "/usr/sbin/scselect " & NetworkName
delay 2
end try
tell application "System Events"
@PatrickTulskie
PatrickTulskie / chromium_updater.sh
Created January 13, 2012 05:03
Updater for Chromium trunk snapshots for Mac.
#!/bin/sh
# setup ------------------------------------------------------------------------
tempDir="/tmp/`whoami`/chrome-nightly/";
baseURL="http://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac";
baseName="chrome-mac";
baseExt="zip";
appName="Chromium.app";
appDir="/Applications";
version=~/.CURRENT_CHROME;
@PatrickTulskie
PatrickTulskie / autofire.js
Created September 28, 2011 20:55
Autofire
// For http://www.fas.org/man/dod-101/sys/land/bullets.htm
var sound = '<EMBED SRC="biggun.wav" HIDDEN="True"><BGSOUND SRC="biggun.wav">';
for (var i=0; i <= 100; i++) { document.body.insertAdjacentHTML('beforeEnd', sound); }
@PatrickTulskie
PatrickTulskie / colorme.sh
Created August 26, 2011 18:30
Take an image and make it pretty!
#!/bin/bash
COLORS=( red green blue cyan magenta yellow orange pink purple )
TMP_DIR=/tmp/colorme/`date +%s`
OUTPUT="$HOME/Desktop/animated.gif"
DELAY=5
# Create us a temp directory
mkdir -p $TMP_DIR
# Create a base grayscale image to colorize
@PatrickTulskie
PatrickTulskie / Folder Preferences
Created August 11, 2011 18:47 — forked from chrisyour/Folder Preferences
Show hidden files and hidden folders (except .git) in your TextMate project drawer
# Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences.
# Instructions:
# Go to TextMate > Preferences...
# Click Advanced
# Select Folder References
# Replace the following:
# File Pattern
@PatrickTulskie
PatrickTulskie / caveatPatchor.js
Created July 29, 2011 18:53 — forked from protocool/caveatPatchor.js
Sample Propane caveatPatchor.js file
/**
Sample Propane caveatPatchor.js file based on tmm1's avatar hack.
You'll need at least version 1.1.1 to experiment with this:
http://propaneapp.com/appcast/Propane.1.1.1.zip
Once I'm sure exposing this hack-injection point doesn't cause problems
I'll do an official auto-updating version.
As of version 1.1.1, Propane will load and execute the contents of
@PatrickTulskie
PatrickTulskie / widgets_com.conf
Created July 27, 2011 16:56
nginx, unicorn, memcached
server {
error_log /usr/local/var/log/nginx/error.log;
listen widgets.local:80;
server_name widgets.local;
client_max_body_size 4G;
keepalive_timeout 70;
root /Users/username/rails/widgets/public;
error_page 502 /502.html;
@PatrickTulskie
PatrickTulskie / resque_retry.rb
Created July 25, 2011 19:15 — forked from clemens/resque_retry.rb
Retry failed Resque jobs in Ruby
# inspired by http://ariejan.net/2010/08/23/resque-how-to-requeue-failed-jobs
# retry all failed Resque jobs except the ones that have already been retried
# This is, for instance, useful if you have already retried some jobs via the web interface.
Resque::Failure.count.times do |i|
Resque::Failure.requeue(i) unless Resque::Failure.all(i, 1)['retried_at'].present?
end
# retry all :)
Resque::Failure.count.times do |i|
upstream unicorn {
server unix:/var/www/example/current/tmp/sockets/unicorn.sock;
}
server {
listen 80;
server_name example.org www.example.org;
access_log /var/log/nginx/example.access.log;
location / {
root /var/www/example/current/public/;
if (-f $request_filename) {
@PatrickTulskie
PatrickTulskie / passenger_unicorn_cap.rb
Created May 27, 2011 23:01
Restart Passenger or Unicorn in Capistrano
task :restart, :roles => :app, :except => { :no_release => true } do
socket_path = "#{shared_path}/sockets/unicorn.sock"
restart_command = "if [ -e #{socket_path} ]; then /etc/init.d/beenverified_com upgrade; else touch #{current_path}/tmp/restart.txt; fi"
run restart_command
end