Skip to content

Instantly share code, notes, and snippets.

View jodell's full-sized avatar

Jeffrey ODell jodell

View GitHub Profile
SELECT
nspname AS schemaname,relname,reltuples
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE
nspname NOT IN ('pg_catalog', 'information_schema') AND
relkind='r'
ORDER BY reltuples DESC;
@jodell
jodell / restart-haproxy.sh
Created March 20, 2013 16:52
graceful haproxy restart
haproxy -f /etc/haproxy.cfg -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)
#!/bin/bash
# http://archives.postgresql.org/pgsql-admin/2010-05/msg00285.php
# Output lines suitable for sysctl configuration based
# on total amount of RAM on the system. The output
# will allow up to 50% of physical memory to be allocated
# into shared memory.
# On Linux, you can use it as follows (as root):
#
# ./shmsetup >> /etc/sysctl.conf
ctags -R --exclude=.git --exclude=log * `ruby -r rubygems -e 'puts Gem.path.map { |p| "#{p}/*" }.join " "'`
ctags -R --exclude=.git --exclude=log * `ruby -r rubygems -e 'puts Gem.path.map { |p| "#{p}/*" }.join " "'`
module RecursiveHashExtensions
def rmap(&blk)
self.reduce({}) do |acc, (k, v)|
acc[k] = v.is_a?(Hash) ? v.rmap(&blk) : blk.call(k, v)
end
end
end
class Hash
include RecursiveHashExtensions
class Object
def use(lib)
puts "seriously, just use #{lib}"
lib
end
alias :just :require
end
@jodell
jodell / gist:4061438
Created November 12, 2012 19:41
find entry points for obj-c literals
# Grep for Objective-C methods that can generally be replaced with the new literal syntax.
grep -rE ‘arrayWith|numberWith|dictionaryWith|setObject|objectAt’ Classes
#!/usr/bin/env python
"""Reset admin password in Chef Server WebUI by removing admin user from DB"""
# based on http://lists.opscode.com/sympa/arc/chef/2011-08/msg00151.html
# and someone else's gist that I can't find --jodell
import urllib2
import json
@jodell
jodell / xclang-grep-example.sh
Created September 27, 2012 15:28
xcode lang grep
cd /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources
grep -rohE 'xcode.lang.(\w*)' * | sort -u