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
SELECT pilot_name
, DATEDIFF(NOW(), MAX(IF(instructor_name IS NOT NULL, schedule_end, 0))) as days_since_last_dual_flight
, SUM(hobb_duration) as hours_past_year
, SUM(landings) as landings_past_year
, COUNT(id) as flights_past_year
, SUM(IF( schedule_end > (NOW() - INTERVAL 180 DAY), hobb_duration, 0)) as hours_180_days
, SUM(IF( schedule_end > (NOW() - INTERVAL 180 DAY), landings, 0)) as landings_180_days
, SUM(IF( schedule_end > (NOW() - INTERVAL 180 DAY), 1, 0)) as flights_180_days
, SUM(IF( schedule_end > (NOW() - INTERVAL 90 DAY), hobb_duration, 0)) as hours_90_days
, SUM(IF( schedule_end > (NOW() - INTERVAL 90 DAY), landings, 0)) as landings_90_days
@andyfowler
andyfowler / lessjs.rb
Created October 23, 2010 21:46
Jekyll plugin to render less.js - fixed for new versions of jekyll
module Jekyll
class LessCssFile < StaticFile
def write(dest)
# do nothing
end
end
# Expects a lessc: key in your _config.yml file with the path to a local less.js/bin/lessc
# Less.js will require node.js to be installed
@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
<?
class a {
protected $foo;
public function showFoo() {
echo $this->foo;
}
}
@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
@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: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 / 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:885187
Created March 24, 2011 14:54
Reminders for HTML5 <video> + flash fall-through encoding from h.264 mov
# reminder for h.264 + theora <video> preflighting. ignoring stupid webm for now.
# html5 code looks like (yes, the single/double quotes are correct)
# use medieelement.js for flash fall-through
#
# <video width="600" height="450">
# <source src="http://.../screencast.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
# <source src="http://.../screencast.ogv" type='video/ogg; codecs="theora, vorbis"'>
# </video>
# convert mov container to mpeg-4