View keybase.md

Keybase proof

I hereby claim:

  • I am grvgr on github.
  • I am grvgr (https://keybase.io/grvgr) on keybase.
  • I have a public key ASDz3AzFY99B_-8SNsjAu-seqK6mF7bUqRG1GHNWKr3d3go

To claim this, I am signing this object:

View prime.c
/* compile: gcc prime.c -o prime -fopenmp */
#include <stdio.h>
#include <time.h>
#include <omp.h>
int main(int argc, char *argv[]) {
double start, end, runTime;
int num = 1, primes = 0, limit;
View privateinternetaccess client download
Latest links are always available at:
https://www.privateinternetaccess.com/pages/client-support
https://www.privateinternetaccess.com/pages/downloads
In case you're unable to access the PIA website:
option 1:
macOS: https://installers.privateinternetaccess.com/download/pia-latest-mac.dmg
Windows: https://installers.privateinternetaccess.com/download/pia-latest-win.exe
Linux: https://installers.privateinternetaccess.com/download/pia-latest-linux.tar.gz
View gist:aea855e85b0a6230e282

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs
View auto.brightness.sh
#!/bin/bash
# -*- mode: shell-script -*-
execPath=/usr/local/bin/screenbrightness
brightApps=(iTerm iTerm2 Emacs)
ignoreApps=(Alfred)
logFile=/tmp/auto.brightness.log
logEnable=false
# logEnable=true
high='1.000000'
View git-recover-branch.md

Oops! I accidentally deleted a local git branch, and I haven't pushed it to a remote server yet. The branch has several important commits, and it hasn't been merged with any other branches yet. How do I find the missing branch?

1. Create a list of all dangling or unreachable commits.

$ git fsck --full --no-reflogs --unreachable --lost-found
unreachable tree 4a407b1b09e0d8a16be70aa1547332432a698e18
unreachable tree 5040d8cf08c78119e66b9a3f8c4b61a240229259
unreachable tree 60c0ce61b040f5e604850f747f525e88043dae12
unreachable tree f080522d06b9853a2f18eeeb898724da4af7aed9
View anim.control.sh
#-*- mode: shell-script; -*-
ARGV="$@"
case $ARGV in
start|enable)
defaults write -g NSAutomaticWindowAnimationsEnabled -bool true
defaults delete -g NSScrollAnimationEnabled
defaults delete -g NSWindowResizeTime
defaults delete -g QLPanelAnimationDuration
defaults delete -g NSScrollViewRubberbanding
View how-to-set-up-stress-free-ssl-on-os-x.md

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

View haproxy.cfg
# Bind SSL port with PFS-enabling cipher suite
bind :443 ssl crt path_to_certificate no-tls-tickets ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-RSA-RC4-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES128-SHA:AES256-SHA256:AES256-SHA:RC4-SHA
# Distinguish between secure and insecure requests
acl secure dst_port eq 443
# Mark all cookies as secure if sent over SSL
rsprep ^Set-Cookie:\ (.*) Set-Cookie:\ \1;\ Secure if secure