Skip to content

Instantly share code, notes, and snippets.

View bwghughes's full-sized avatar

Ben Hughes bwghughes

View GitHub Profile
"""
server.py
"""
from gevent import monkey
monkey.patch_all()
from time import sleep, time
import bottle
"""
server.py
"""
from gevent import monkey
monkey.patch_all()
from time import sleep, time
import bottle
@bwghughes
bwghughes / gist:2023191
Created March 12, 2012 16:32
Redis fulltext index
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
import time
import json
import datetime
from random import randrange
from datetime import timedelta
def date_range():
start_date = datetime.datetime.now().date() - timedelta(days=-365)
#!/bin/sh
setup_brew () {
if ![-f "/usr/local/bin/brew"]; then
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
fi
}
setup_ipython () {
brew install readline
@bwghughes
bwghughes / deploy.py
Created May 29, 2013 15:15
pushbutton
#!/usr/bin/env python
import sys, usb.core
dev = usb.core.find(idVendor=0x1d34, idProduct=0x0008)
if dev is None:
sys.exit("No Panic button found in the system");
try:
if dev.is_kernel_driver_active(0) is True:
### Keybase proof
I hereby claim:
* I am bwghughes on github.
* I am bwghughes (https://keybase.io/bwghughes) on keybase.
* I have a public key whose fingerprint is F56F F8CA AFA2 92A4 6252 746F F997 CCE3 41DD B60F
To claim this, I am signing this object:
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
@bwghughes
bwghughes / py
Created June 3, 2016 08:55
Problem with POST'ing BillExpenseItems
import os
import json
import requests
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
url = "http://0ba03adb.ngrok.io/api.rsc/BillExpenseItems"
import os
import json
import requests
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
url = "http://0ba03adb.ngrok.io/api.rsc/BillExpenseItems"