Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am gvarela on github.
* I am gvarela (https://keybase.io/gvarela) on keybase.
* I have a public key whose fingerprint is 8FF2 8DDF 3216 467C 9AAD D96C 491A 5FE0 05DA 02F9
To claim this, I am signing this object:
@gvarela
gvarela / dev-dns
Created April 28, 2015 16:34
Mimic pow and powder by generating a local nginx conf file that is symlinked to the homebrew nginx configuration. requires dnsmasq and nginx to be installed.
#!/bin/bash
rm .nginx.conf
while [[ $# > 1 ]]
do
key="$1"
case $key in
-p|--port)
PORT="$2"
config.action_controller.asset_host = Proc.new { |source|
if source.starts_with?('/javascripts') || source.starts_with?('/stylesheets')
nil # bundle_fu friendly
else
"http://asset%d.domain.com" % ( (source.hash % 4) )
end
}
#!/usr/bin/env bash
# 2D dock
defaults write com.apple.dock no-glass -boolean YES
# highlight on mouse over
defaults write com.apple.dock mouse-over-hilte-stack -boolean yes
# spring load all dock items
defaults write com.apple.dock enable-spring-load-actions-on-all-items -boolean yes
# recent items stack
defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'
#!/usr/bin/env bash
cd $1 && \
find ./ -type f -name \geminstaller*.yml -exec sudo geminstaller -c {} \;
#!/usr/bin/env bash
sudo cp -R $1 /usr/local/mysql/data/$1
sudo chown -R _mysql /usr/local/mysql/data/$1
sudo chmod -R 660 /usr/local/mysql/data/$1
sudo chmod 750 /usr/local/mysql/data/$1
#!/usr/bin/env bash
if [ -d sphinx-0.9.8.1 ]; then
rm -rf sphinx-0.9.8.1
fi
if [ -e sphinx-0.9.8.1.tar.gz ]; then
rm sphinx-0.9.8.1.tar.gz
fi
curl -O http://www.sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz
class UrlEncodedPairParser < StringScanner #:nodoc:
attr_reader :top, :parent, :result
def initialize(pairs = [])
super('')
@result = {}
pairs.each { |key, value| parse(key, value) }
end
KEY_REGEXP = %r{([^\[\]=&]+)}
We couldn’t find that file to show.
#!/bin/sh
#
# This script starts and stops the Dj daemon
# This script belongs in /engineyard/bin/dj
#
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
CURDIR=`pwd`
usage() {
echo "Usage: $0 <appname> {start|stop} enviroment [name maximum_priority minimum_priority]"