Skip to content

Instantly share code, notes, and snippets.

View ggreer's full-sized avatar

Geoff Greer ggreer

View GitHub Profile
#!/bin/sh
if [ $# -lt 2 ]
then
echo "Usage: $0 path command"
exit 1
fi
WATCH_PATH="$1"
shift
WSGIDaemonProcess floobits.com python-path=/data/web:/usr/local/lib/python2.7/site-packages processes=4 threads=8 display-name=%{GROUP}
# Same as python -O
WSGIPythonOptimize 1
# For HSTS
LoadModule headers_module modules/mod_headers.so
# For admin interface
LoadModule authn_yubikey_module /usr/lib/apache2/modules/mod_authn_yubikey.so
# Socket.io stuff
# For HSTS
<IfModule !headers_module>
LoadModule headers_module modules/mod_headers.so
</IfModule>
# For admin interface
<IfModule !authn_yubikey_module>
LoadModule authn_yubikey_module /usr/lib/apache2/modules/mod_authn_yubikey.so
</IfModule>
@ggreer
ggreer / gist:44f56cf666bcd717cdb2
Created November 3, 2014 03:47
some ag benchmarks
["0.10", null, null, 7.463871, 6.844699, 4.362767],
["0.11", null, null, 4.026023, 3.817754, 3.970790],
["0.11.1", null, null, 4.070635, 3.743139, 4.049678],
["0.12", null, null, 3.891555, 3.729462, 3.896247],
["0.13", null, null, 5.108643, 4.418995, 4.739771],
["0.13.1", null, null, 4.779619, 4.525622, 4.785116],
["0.14", null, null, 3.638291, 4.615545, 3.662663],
["0.15", null, null, 3.535910, 4.641111, 3.596484],
["0.16", null, null, 3.764384, 4.484346, 3.533717],
["0.17", null, null, 3.785167, 4.467971, 3.641007],
@ggreer
ggreer / birth_month.py
Created January 26, 2015 18:30
Pypy is *fast*
#!/usr/bin/env python
import random
matches = 0
total = 1000000
people = 5
for i in range(total):
month = random.randrange(12)
for j in reversed(range(people - 1)):
@ggreer
ggreer / gist:4be72856ec6eee6d96b1
Last active August 29, 2015 14:14
Freenode email

From: Geoff Greer
Subject: Registering #ag
Date: Mon, 19 Jan 2015 15:08:03 -0800
To: projects@freenode.net

Dear Freenode staff,

I, ggreer, would like to register #ag on Freenode. I am the creator and owner of ag, an open source code-searching tool similar to grep or ack.[1][2] The command name is ag. Likewise, most people refer to the utility as “ag” in conversation.

@ggreer
ggreer / Terminal 1
Last active August 29, 2015 14:21
OS X `leaks` command doesn't detect leaks from anonymous mmap()s
ggreer@carbon:~/Desktop% gcc anon_mmap.c -o anon_mmap
ggreer@carbon:~/Desktop% ./anon_mmap
Buf is 'TESTING 123'
Run...
sudo leaks 48974
...in the next 100 seconds
@ggreer
ggreer / redshift.sh
Created August 4, 2015 06:59
Redshift
#!/bin/sh
# San Fran!
/usr/bin/screen redshift -l 37:-122 -t 6500:2600 -v
@ggreer
ggreer / power.sh
Created August 4, 2015 07:00
Power.sh
# Disable the NMI watchdog
echo 0 > /proc/sys/kernel/watchdog
# Runtime power-management for PCI devices
for i in /sys/bus/pci/devices/*/power/control ; do
echo auto > ${i}
done
# Runtime power-management for USB devices
for i in /sys/bus/usb/devices/*/power/control ; do
set nocompatible
filetype off
set rtp+=~/.nvim/bundle/Vundle.vim
call vundle#begin('~/.nvim/bundle')
Plugin 'gmarik/Vundle.vim'
Plugin 'Floobits/floobits-neovim'