Skip to content

Instantly share code, notes, and snippets.

View thomasbhatia's full-sized avatar

Thomas Bhatia thomasbhatia

View GitHub Profile
@wilsaj
wilsaj / hello_soap_flask.py
Created February 23, 2011 19:37
Flask + Soaplib
import soaplib
from soaplib.core.service import rpc, soap, DefinitionBase
from soaplib.core.model.primitive import String, Integer
from soaplib.core.server import wsgi
from soaplib.core.model.clazz import Array
from flask import Flask
flask_app = Flask(__name__)
@joestump
joestump / gist:938824
Created April 23, 2011 17:48
An example of a python-oauth2 provider
class BaseRequestHandler(tornado.web.RequestHandler):
"""Base class for all SimpleGeo request handlers."""
def _handle_request_exception(self, e):
status_code = getattr(e, 'status_code', 500)
self.set_status(status_code)
error = {
'code' : status_code,
'message' : str(e)
@lrvick
lrvick / flask_geventwebsocket_example.py
Created September 1, 2011 07:17
Simple Websocket echo client/server with Flask and gevent / gevent-websocket
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@isaacsanders
isaacsanders / Equity.md
Created January 21, 2012 15:32
Joel Spolsky on Equity for Startups

This is a post by Joel Spolsky. The original post is linked at the bottom.

This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.

The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea was it anyway, etc. That is why I would always rather split a new company 50-50 with a friend than insist on owning 60% because "it was my idea," or because "I was more experienced" or anything else. Why? Because if I split the company 60-40, the company is going to fail when we argue ourselves to death. And if you ju

@thomasbhatia
thomasbhatia / qos-opendpi.sh
Created July 22, 2012 20:45 — forked from nacx/qos-opendpi.sh
Basic QoS with iproute2 and OpenDPI Netfilter wrapper
#!/bin/bash
# Basic QoS script that uses OpenDPI (http://www.opendpi.org/)
# Netfilter wrapper to identify packets by the protocol.
#
# This script enqueues packets in three queues, each one
# with a different priority:
#
# The first queue has the higher priority and gets the TCP SYN
# packets, ACKs, ICMPs and packets with Minimize-Delay TOS.
@solso
solso / autossh.sh
Created July 26, 2012 13:56
Support material for blog post of redis replication
#!/bin/sh
## --- tunnel_to_master_redis
REDIS_MASTER=XYZ
REDIS_SLAVE_PORT=6280
AUTOSSH_POLL=300
AUTOSSH_PORT=20000
AUTOSSH_GATETIME=10
AUTOSSH_LOGFILE=/var/log/autossh/autossh.log
@antond
antond / redis install
Created August 6, 2012 19:34 — forked from ponych/redis install
redis install on CentOS
1.CentOS 6.3
#yum install make gcc
#cd /opt
$wget http://redis.googlecode.com/files/redis-2.x.xx.tar.gz
$tar zxf redis-2.x.xx.tar.gz
$cd redis-2.x.xx
$make
$make install
//////
@codebullies
codebullies / README.md
Last active August 11, 2021 03:36
An example of CZMQ Multicast using PUB/SUB

To use the scheme epgm:// or pgm:// you must configure libzmq 3.x (HEAD) using the --with-pgm.

./configure --with-pgm
./make
./make install

Remember to set you LD_LIBRARY_PATH to the location of the libzmq installation parameter For bash:

export LD_LIBRARY_PATH=/usr/local/lib

@gburd
gburd / bitpop.erl
Last active July 2, 2018 06:27
Hamming weight of 64bit integers in Erlang using the popcount_3() method found http://en.wikipedia.org/wiki/Hamming_weight counts the number of bits set to 1.
%% -*- coding: utf-8 -*-
%%
%% %CopyrightBegin%
%%
%% Copyright (C) 2013 Gregory Burd. All Rights Reserved.
%%
%% The contents of this file are subject to the Mozilla Public License,
%% Version 2, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Mozilla Public License along with this software. If not, it can be
@j2labs
j2labs / gist:5081768
Last active December 14, 2015 11:48
>>> from schematics.models import Model
>>> from schematics.types.base import StringType, DateTimeType, IntType, BooleanType
>>> from schematics.types.compound import ListType, ModelType
>>>
>>> class ProtoStep(Model):
... step_type = StringType(required=True) # enum type?
... deadline = DateTimeType()
...
>>> class DocumentStep(ProtoStep):
... doc_name = StringType()