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
Patch to `/usr/libexec/path_helper` to prevent hangs with long `PATH`s. | |
--- path_helper_bak 2009-05-07 15:54:37.000000000 +0200 | |
+++ path_helper 2009-06-04 10:51:39.000000000 +0200 | |
@@ -15,7 +15,7 @@ | |
for f in "$DIR" "$DIR".d/* ; do | |
if [ -f "$f" ]; then | |
for p in $(< "$f") ; do | |
- [[ "$NEWPATH" = *(*:)${p}*(:*) ]] && continue | |
+ egrep -q "(^|${SEP})${p}($|${SEP})" <<<"$NEWPATH" && continue | |
[ ! -z "$NEWPATH" ] && SEP=":" |
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
# :PUBLISHER: markdown, shell, { command: 'rdiscount' } | |
# :BRACKET_CODE: '[ruby]', '[/ruby]' | |
# :TEXT: | |
# | |
# Have you ever started a long operation and walked away from the computer, and | |
# come back half an hour later only to find that the process is hung up waiting | |
# for some user input? It's a sub-optimal user experience, and in many cases it | |
# can be avoided by having the program choose a default if the user doesn't | |
# respond within a certain amount of time. One example of this UI technique in | |
# the wild is powering off your computer - most modern operating systems will |
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 'rack/utils' | |
module Rack | |
# | |
# EnforceSSL is a Rack middleware app that enforces that users visit | |
# specific paths via HTTPS. If a sensitive path is requested over | |
# plain-text HTTP, a 307 Redirect will be issued leading to the HTTPS | |
# version of the Requested URI. | |
# | |
# MIT License - Hal Brodigan (postmodern.mod3 at gmail.com) |
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/env ruby | |
require "irb" | |
load "#{ENV['HOME']}/.irbrc" | |
def IRB.run_config; end | |
ARGV.unshift "console" | |
load File.dirname(__FILE__) + "/rails" |
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
# Add all gems in the global gemset to the $LOAD_PATH so they can be used in rails3 console with bundler | |
if defined?(::Bundler) | |
$LOAD_PATH.concat Dir.glob("#{ENV['rvm_path']}/gems/#{ENV['rvm_ruby_string']}@global/gems/*/lib") | |
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
def transform_hash(original, options={}, &block) | |
options[:safe_descent] ||= {} | |
new_hash = {} | |
options[:safe_descent][original.object_id] = new_hash | |
original.inject(new_hash) { |result, (key,value)| | |
if (options[:deep] && Hash === value) | |
value = options[:safe_descent].fetch( value.object_id ) { | |
transform_hash(value, options, &block) | |
} | |
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
#!/bin/bash | |
# | |
# azilink for OS X Lion | |
# based on http://pastie.org/405289 but works with Tunnelblick only | |
# (no need to install a separate copy of OpenVPN2 from macports | |
# or building from source by hand, thankfully) | |
# Requires: | |
# - azilink running on android phone (http://code.google.com/p/azilink/) | |
# (run the app and check the box to start the service). | |
# - adb on system path (comes with the Android SDK; |
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
{ | |
/* ~/Library/KeyBindings/DefaultKeyBinding.dict | |
See https://gist.github.com/zsimic/1367779, prefix cheatsheet: | |
Char Short Key | |
$ S- Shift ⇧ | |
^ C- CTRL ⌃ | |
~ O- Option ⌥ (⊞ Win key position on PC) | |
@ M- Command ⌘ (Alt position on PC) | |
# Numeric Keypad |
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
Load up Terminal (Applications > Utilities > Terminal.app) and type the following. | |
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist | |
To turn it back on, just do the opposite: | |
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist |
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
# Add `gem 'heroku-api', :git => 'https://github.com/heroku/heroku.rb.git'` to your Gemfile | |
# Set the APP_NAME environment variable to the name of the Heroku app you wish to control. | |
# Set the HEROKU_API_KEY environment variable to the API key found on the Heroku 'My Account' page. | |
# You can now create a scheduler instance that runs `bundle exec rake heroku:web:restart` to automate | |
# restarting workers. The task will select a different web instance every 10 minutes, based on the number of instances that are running. | |
namespace :heroku | |
namespace :web do | |
task :restart do |
OlderNewer