Skip to content

Instantly share code, notes, and snippets.

View jperras's full-sized avatar
💨
what what is this where am I

Joël Perras jperras

💨
what what is this where am I
View GitHub Profile
@jperras
jperras / stfl.diff
Created January 3, 2012 18:24
STFL diff for OS X compatibility.
diff --git a/Makefile b/Makefile
index d481e68..0f8b4de 100644
--- a/Makefile
+++ b/Makefile
@@ -22,12 +22,12 @@ include Makefile.cfg
export CC = gcc -pthread
export CFLAGS += -I. -Wall -Os -ggdb -D_GNU_SOURCE -fPIC
-export LDLIBS += -lncursesw
+export LDLIBS += $(LDFLAGS) -lncurses -liconv
@jperras
jperras / post-receive.sh
Created December 22, 2011 21:05
A git post-receive hook for making puppet suck less.
#!/bin/sh
echo "[NOTICE] *** Starting post-receive hook."
cd /etc/puppet
unset GIT_DIR
git fetch origin
if [ "$?" -ne "0" ]; then
@jperras
jperras / twitter-tornado.py
Created December 5, 2011 16:33
Tornado Twitter Streaming Example
from tornado.httpclient import HTTPClient, HTTPRequest
import simplejson
def handle_tweet_stream(response):
try:
# Print the parsed twitter stream.
print simplejson.loads(response)
except ValueError:
return
print
@jperras
jperras / pretty.sh
Created November 22, 2011 20:36
Mass prettification of JSON files.
for f in `find . -path "*.json"`; do python -mjson.tool $f $f.output && mv $f.output $f; done
" Statusline
hi User1 guifg=#eea040 guibg=#222222
hi User2 guifg=#dd3333 guibg=#222222
hi User3 guifg=#ff66ff guibg=#222222
hi User4 guifg=#a0ee40 guibg=#222222
hi User5 guifg=#eeee40 guibg=#222222
set laststatus=2
set statusline=
set statusline +=%1*\ %n\ %* "buffer number
@jperras
jperras / pre-commit
Created November 17, 2011 04:00 — forked from spulec/pre-commit
Yipit Pre-commit Hook
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
<!DOCTYPE html>
<head><title>Scroller demo</title></head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var i = 0;
setInterval(function() {
var max_elements = 10;
@jperras
jperras / ec2.pp
Created June 14, 2011 20:29
EC2 Puppet utilities
# ec2utils: puppet recipes for use with Amazon's Elastic Compute Cloud (and
# associated services)
#
# Copyright 2009 Flock, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@jperras
jperras / elasticsearch.json
Created May 14, 2011 21:22
elasticsearch.json
{
"cluster": {"name": "testcluster"},
"cloud": {
"aws": {
"access_key": "<redacted>",
"secret_key": "<redacted>"
}
},
"discovery": { "type": "ec2" },
"index": {
@jperras
jperras / imap.py
Created April 29, 2011 21:21
Did imaplib just tell me to go fuck myself?
import getpass, imaplib
# The following snippet will fetch all emails from an IMAP server.
M = imaplib.IMAP4()
M.login(getpass.getuser(), getpass.getpass())
M.select()
typ, data = M.search(None, 'ALL')
for num in data[0].split():
typ, data = M.fetch(num, '(RFC822)')