Skip to content

Instantly share code, notes, and snippets.

View NorthIsUp's full-sized avatar
🥯

Adam Hitchcock NorthIsUp

🥯
View GitHub Profile
@NorthIsUp
NorthIsUp / helpers.py
Created August 29, 2012 17:09
flask helpers
"""
disqus.flask.helpers
~~~~~~~~~~~
:author: Adam Hitchcock
:copyright: (c) 2011 DISQUS, Inc.
:license: Apache License 2.0, see LICENSE for more details.
"""
from flask import current_app
@NorthIsUp
NorthIsUp / thoonk_extensions.py
Created August 28, 2012 01:55
extensions for thoonk jobs
from thoonk.feeds import Job
from thoonk.feeds.queue import Empty
import time
# To use this do the super horrible following actions:
# job = pubsub.job(channel)
# job.__class__ = JobExtended
class JobExtended(Job):
@NorthIsUp
NorthIsUp / tmp.uNfPcmmUXB.py
Created August 1, 2012 21:47
greenlet generators
from gevent import spawn
from gevent import sleep
def gen():
def _gen():
i = 0
while True:
yield i
i += 1
@NorthIsUp
NorthIsUp / tmp.C46PsDfPAz.py
Created July 19, 2012 18:49
sys.setrecursionlimit
import sys
def recur(i=0):
print i
sys.setrecursionlimit(i + 2)
recur(i + 1)
recur(1)
@NorthIsUp
NorthIsUp / fap.py
Created July 16, 2012 15:56
fapwws test
#!/usr/bin/env python
from gevent import monkey
monkey.patch_all()
from gevent.queue import Queue
from gevent import sleep
from gevent import spawn
import fapws._evwsgi as evwsgi
from fapws import base
@NorthIsUp
NorthIsUp / spawn.py
Created July 5, 2012 12:46
gevent spawn helpers
"""
realertime.lib.spawn
~~~~~~~~~~~~~~~~~~~~
:author: Adam Hitchcock
:copyright: (c) 2012 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from __future__ import absolute_import
{
"auto_complete": true,
"auto_complete_commit_on_tab": false,
"auto_complete_delay": 0,
"auto_complete_selector": "source - comment",
"auto_complete_size_limit": 4194304,
"auto_complete_triggers":
[
{
"characters": "<",
[color]
# this sets * = auto for all color sections
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
#!/bin/bash
#
# A git hook for automatically running commands
# based on the name of files modified in the
# previous changeset
#
# To install as a post-merge hook (on `git pull`):
# $ cp hook.sh .git/hooks/post-merge && chmod 755 $_
#
# To install as a post-checkout hook (changing branches):
import json
import os
seed = []
foo = os.path.expanduser("~/foo.json")
def load():
with open(foo, 'r') as fp:
return json.load(fp)