Skip to content

Instantly share code, notes, and snippets.

@austra
austra / puma_ssl.sh
Created May 22, 2017 20:42 — forked from PragmaticEd/puma_ssl.sh
Run Puma server with https
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@austra
austra / gist:7dc8429145d386499872
Created October 27, 2015 14:57 — forked from deevis/gist:b4f71ba52067531575ca
Get list of users with occurrence count who had a certain type of error occur
for request in `grep -e "undefined local variable or method .*html_safe" log/production.log -B 1 | grep FATAL | sed 's/.*FATAL.*\[\(.*\)\]/\1/g'`;do grep "$request" log/production.log | head -n 20 | grep current_user;done | sed 's/.*current_user\(.*\).*/\1/g' | sort | uniq -c | sort -n
@austra
austra / gist:07225957f9f173fff422
Created October 26, 2015 21:01 — forked from deevis/gist:61113a95429e219fd108
Parse Vibe logs for slowest showing time to render, user, path, and time of request
zgrep "END: current_user" production.log.2.gz | sed 's/\(.*\) \[.*INFO.*current_user\[\(.*\)\] (\(.*\)) \(.*\)/\3\t\4\t\2\t\1/g' | sort -n | tail -n 20
# with process:request
grep "END: current_user" production.log | sed 's/\(.*\) \[.*INFO.*\[\(.*\)\].*current_user\[\(.*\)\] (\(.*\)) \(.*\)/\4\t\2\t\1\t\3\t\5/g' | sort -n | tail -n 100
# find with process:request, then loop back and find problems for each...
# Part 1
grep "END: current_user" production.log | sed 's/\(.*\) \[.*INFO.*\[\(.*\)\].*current_user\[\(.*\)\] (\(.*\)) \(.*\)/\4\t\2\t\1\t\3\t\5/g' | sort -n | tail -n 100 > slow_requests_10_26_2015.txt
# Part 2
for rqid in `cat slow_requests_10_26_2015.txt | sed 's/.*seconds\t\(.*\)\s.*2015.*/\1/g'`;do echo -e "API Calls for [$rqid]\n---------------------------\n"; grep $rqid production.log | grep "request to api.exigo.com" -A 1; echo -e "\n\n";done > exigo_slow_calls_report_10_26_2015.txt
@austra
austra / gist:53721da86b149718160b
Created October 26, 2015 21:01 — forked from deevis/gist:359741f1e498da14f9e3
Choose multiple files from current branch as the 'merge conflict winner'
# All the files that match with 'coverage' and tell git to use the branch we're on currenthl (ours, opposed to theirs)
git status | grep coverage | sed 's/.*: \(.*\)/\1/g' | xargs git checkout --ours