Skip to content

Instantly share code, notes, and snippets.

View jodell's full-sized avatar

Jeffrey ODell jodell

View GitHub Profile
@jodell
jodell / shmsetup.sh
Created October 13, 2011 18:54
kernel shared memory calculator
#!/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
@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
# https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/LocationsOfEdgeServers.html
curl http://d7uri8nf7uskq.cloudfront.net/tools/list-cloudfront-ips | jq -r '"set_real_ip_from " + ((.CLOUDFRONT_GLOBAL_IP_LIST | .[]), (.CLOUDFRONT_REGIONAL_EDGE_IP_LIST | .[])) + ";"'
create_empty_junit_report() {
mkdir -p test/reports && cat > test/reports/emptytest.xml <<"EOF"
<testsuite>
<testcase classname="foo" name="ASuccessfulTest"/>
</testsuite>
EOF
}
@jodell
jodell / git-bash.sh
Last active December 25, 2015 00:19
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
PS1="$RED\$(date +%H:%M) \w$YELLOW \$(parse_git_branch)$GREEN\$ "
" Strip trailing whitespace upon write
autocmd BufWritePre *.{m,h,rb,js,coffee,scss,css,yml} call StripTrailingWhiteSpace()
function! StripTrailingWhiteSpace()
let l:winview = winsaveview()
silent! %s/\s\+$//
call winrestview(l:winview)
endfunction
#!/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
# sysctl -p
# More Info here: http://unicorn.bogomips.org/Unicorn/OobGC.html
# require 'unicorn/oob_gc'
# GC every two requests that hit /expensive/foo or /more_expensive/foo
# in your app. By default, this will GC once every 5 requests
# for all endpoints in your app
# Example:
# use Unicorn::OobGC, 2, %r{\A/(?:admin/work_items/ast|admin/work_items/lp)}
# Use at least one worker per core if you're on a dedicated server,
# more will usually help for _short_ waits on databases/caches.
sudo touch /var/log/wtmp
sudo chown root:utmp /var/log/wtmp
sudo chmod 0664 /var/log/wtmp
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;