Skip to content

Instantly share code, notes, and snippets.

View imlucas's full-sized avatar
⚒️

Lucas Hrabovsky imlucas

⚒️
  • CNN
  • Philadelphia, PA
View GitHub Profile
@imlucas
imlucas / add_users.py
Created April 12, 2012 12:58
Using Amazon Cloudsearch with Python and Boto
from cloudsearch import connect_cloudsearch, get_document_service
endpoint = 'paste your doc service endpoint here'
service = get_document_service(endpoint=endpoint) # Get a new instance of cloudsearch.DocumentServiceConnection
# Presumably get some users from your db of choice.
users = [
{
'id': 1,
import sys
from zmq import FORWARDER, PUB, SUB, SUBSCRIBE
from zmq.devices import Device
if __name__ == "__main__":
usage = 'usage: chat_bridge pub_address sub_address'
if len (sys.argv) != 3:
print usage
sys.exit(1)
import eventlet
from thrift.server.TServer import TServer
from thrift.transport import TSocket;
from thrift.transport.TTransport import TTransportException
class TEventletServer(TServer):
"""Eventlet Thrift Server. Each client gets its own green thread."""
running = False
backdoor = 0
def __init__(self, *args, **kwargs):
# Add this to .profile or .bash_profile
#
# Or the cool way:
# cd ~/ && git clone git://gist.github.com/114160.git .githelper && echo "# Add me to your .profile or .bash_profile. Save the file, open a new terminal, and you'll have all of this." && echo "" && echo "source ~/.githelper/gistfile1.sh"
#
# - When inside a git working directory, modifies prompt to be (git)$wd[$branch]/
# - Adds a number of short hand aliases, ie pull instead of git pull, k instead of gitk
# - Adds one command calls for making new branches, deleting branches
# - Adds one command call for freebasing (fetch and rebase)
# - And a few other nuggets