Skip to content

Instantly share code, notes, and snippets.

View jodell's full-sized avatar

Jeffrey ODell jodell

View GitHub Profile
# 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 | .[])) + ";"'
@jodell
jodell / gist:11122578
Created April 20, 2014 19:15
Ruby Time Parsing
ti = Time.now.to_i
t = Time.now.to_s
2.0.0-p451 :015 > puts Benchmark.measure { 100_000.times { Time.at(ti) } }
0.030000 0.000000 0.030000 ( 0.041530)
=> nil
2.0.0-p451 :016 > puts Benchmark.measure { 100_000.times { Time.parse(t) } }
2.680000 0.070000 2.750000 ( 2.755467)

Keybase proof

I hereby claim:

  • I am jodell on github.
  • I am jodell (https://keybase.io/jodell) on keybase.
  • I have a public key whose fingerprint is 5804 DCC2 C143 223A B290 A374 B8DF 254E 7DC1 4831

To claim this, I am signing this object:

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