Skip to content

Instantly share code, notes, and snippets.

@blaz
blaz / gist:8a66df7a6dffe692e004
Last active August 27, 2015 08:35
Connect to VPN from the commandline on Mac OS X
# Case-insensitve matching on beginning of VPN name
# To list all your VPNs use: scutil --nc list
function vpngrep {
vpn_name=$(scutil --nc list | sed -E 's/.*"([^"]+)".*/\1/' | grep -i "^${1}" | tail -1)
}
function vpncon {
vpngrep $1
/usr/bin/env osascript <<-EOF
\set PROMPT1 '%[%033[1m%]%M %n@%/%R%[%033[0m%]%# '
\set PROMPT2 '[more] %R > '
-- By default, NULL displays as an empty space. Is it actually an empty
-- string, or is it null? This makes that distinction visible.
\pset null '[NULL]'
-- Use table format (with headers across the top) by default, but switch to
-- expanded table format when there's a lot of data, which makes it much
-- easier to read.
\x auto
@blaz
blaz / config.ru
Last active August 29, 2015 14:04
config.ru for heroku with oobgc and unicorn killer
### UNICORN KILLER
if Integer(ENV['UNICORN_KILLER'] || 0) != 0
require 'unicorn/worker_killer'
# Randomly kill worker between sizes 350M-400M, check every 30 requests,
# and log memory checks
min_mem = Integer(ENV['UNICORN_MEM_MIN'] || 350)
max_mem = Integer(ENV['UNICORN_MEM_MAX'] || 400)
puts "Unicorn killer enabled between #{min_mem}-#{max_mem}MB RSS usage"
@blaz
blaz / config.ru
Created July 17, 2014 10:03
unicorn.rb heroku oobgc killer config
require './lib/configuration/active_record'
require './lib/configuration/processors'
worker_processes Integer(ENV["UNICORN_WORKERS"] || ::Configuration::Processors.count)
timeout 25
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
@blaz
blaz / hack.sh
Created October 13, 2012 07:49 — forked from caycefischer/hack.sh
Sensible defaults for OS X 10.6+
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://gist.github.com/raw/3883734/1d82131bcea3e06252b0ac702b7ca7c49f89b374/hack.sh | sh
#
@blaz
blaz / postgresql.rb
Created September 6, 2012 09:31 — forked from trisweb/postgresql.rb
Homebrew PostgreSQL 9.2 RC1 Formula
require 'formula'
class Postgresql < Formula
homepage 'http://www.postgresql.org/'
url 'http://ftp.postgresql.org/pub/source/v9.2rc1/postgresql-9.2rc1.tar.bz2'
md5 'e5a8434d70573ffe49259b8c52a9f7f9'
depends_on 'readline'
depends_on 'libxml2' if MacOS.leopard? # Leopard libxml is too old
depends_on 'ossp-uuid'
MMMMMMMMMM .,MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMM. OMM. ~MM.. MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMDMMZ7MMMMMMMMN7DMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMDMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMZ IMMM ..MMN= ,8MO 8 IN +DM8 ?MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMM ..OI . 8I...MMMO 8 IN M7 ,MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMN, . +MMMMMO 8 IN =O M~ ~..$MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMM~... +MMMMMMO 8 IN . . IN I..+MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMI . OMMMMMMMO 8 IN := ,O =8 MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMD ... .MMMMMMO 8 IN =O + .MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM