This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | .[])) + ";"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create_empty_junit_report() { | |
mkdir -p test/reports && cat > test/reports/emptytest.xml <<"EOF" | |
<testsuite> | |
<testcase classname="foo" name="ASuccessfulTest"/> | |
</testsuite> | |
EOF | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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\$ " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo touch /var/log/wtmp | |
sudo chown root:utmp /var/log/wtmp | |
sudo chmod 0664 /var/log/wtmp |
NewerOlder