Skip to content

Instantly share code, notes, and snippets.

View andyfowler's full-sized avatar

Andy Fowler andyfowler

View GitHub Profile
@andyfowler
andyfowler / .vimrc
Created September 5, 2011 18:08
Swap iTerm2 cursors in vim insert mode when using tmux
" tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence
" http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
@andyfowler
andyfowler / Vagrantfile
Created October 4, 2011 19:15
cpu_count in Vagrant
Vagrant::Config.run do |config|
config.vm.box = "natty"
config.vm.customize do |vm|
vm.memory_size = 2048
vm.cpu_count = 2 # this.
end
config.vm.share_folder 'aptcache', '/var/cache/apt', '/var/cache/apt' # and this
end
@andyfowler
andyfowler / gist:1355424
Created November 10, 2011 17:07
Unicode git.io :(
# curl -i http://git.io -F "url=https://github.com/andyfowler/" -F "code=%E2%9C%88"
HTTP/1.1 100 Continue
HTTP/1.1 201 Created
Server: nginx/1.0.4
X-Node: gitio1
X-Sha: d0b3b3eeb4b0c1b06ba46abc008d3db839b319f6
Content-Type: text/html;charset=utf-8
Date: Thu, 10 Nov 2011 16:54:36 GMT
@andyfowler
andyfowler / gist:3291314
Created August 8, 2012 01:45
3-second tapped song vs password

Back-of-napkin thoughts prompted by https://twitter.com/soapko/statuses/233009083446349825

3-second song clip, in taps

Say the typical song is 120 BPM.

( 120BPM / 60s = 2 beats per second) * 3 seconds = 6 beats (quarter-notes)

Biggest assumption is that 6 beats in 3 seconds @ sixteenth note resolution = 24 available notes of resolution

@andyfowler
andyfowler / gist:5030607
Created February 25, 2013 15:29
vagrant box export hackage
# https://github.com/WNRI/route.is/wiki/Making-a-vagrant-box
# http://docs.vagrantup.com/v1/docs/base_boxes.html
# https://github.com/abramhindle/vagrant-ubuntu-precise-32
# update vbox additions
sudo sudo mount /dev/sr0 /mnt
sudo /mnt/VBoxLinuxAdditions.run
sudo rm -rf /usr/src/vboxguest*
sudo aptitude purge build-essential
<?
class a {
protected $foo;
public function showFoo() {
echo $this->foo;
}
}
@andyfowler
andyfowler / php-mocking.md
Last active August 29, 2015 13:56
Frustrating landscape of PHP mocking

Why are PHP's mocking libraries so weak?

Kludgy, disgusting syntax.

Seems to have the most momentum, but I don't like its DSL, which seems more complex than 95% of cases need. Bad docs: a 1,600-line README?

Keybase proof

I hereby claim:

  • I am andyfowler on github.
  • I am andyfowler (https://keybase.io/andyfowler) on keybase.
  • I have a public key whose fingerprint is C729 E43A BE22 52BA 67E8 08E5 D1E2 5574 B09F C6E9

To claim this, I am signing this object:

@andyfowler
andyfowler / gist:10068879
Created April 7, 2014 22:27
testing a libssl update in vagrant for heartbleed
vagrant@vagrant:~$ openssl version -a
OpenSSL 1.0.1 14 Mar 2012
built on: Wed Jan 8 20:45:51 UTC 2014
platform: debian-amd64
options: bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx)
compiler: cc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -DTERMIO -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DOPENSSL_NO_TLS1_2_CLIENT -DOPENSSL_MAX_TLS1_2_CIPHER_LENGTH=50 -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
OPENSSLDIR: "/usr/lib/ssl"
vagrant@vagrant:~$ sudo apt-get update
@andyfowler
andyfowler / gist:10281760
Created April 9, 2014 15:13
Check if your RapidSSL cert is revoked in their OCSP server
# download the rapidssl intermediate bundle
curl https://knowledge.rapidssl.com/library/VERISIGN/ALL_OTHER/RapidSSL%20Intermediate/RapidSSL_CA_bundle.pem > rapidssl-bundle.pem
# check if your (presumably revoked) cert is revoked via its OCSP server
# this OCSP url is also in your cert, in the Authority Information Access section
openssl ocsp -issuer rapidssl-bundle.pem -cert YOURCERT.crt -url http://rapidssl-ocsp.geotrust.com