RESTful != HTTP.
Work in progress.
This is a framework for bringing RESTful Resources to your Python applications. It can be used in a few ways:
- To add a RESTful interface to your existing codebase.
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#! /bin/bash | |
# originaly from http://tinyurl.com/twitch-linux from taladan | |
# www.youtube.com/user/taladan | |
# gist created by brodul | |
INRES="1280x800" # input resolution | |
#OUTRES="1024x640" # Output resolution | |
OUTRES="800x500" # Output resolution |
[ | |
{ "keys": ["ctrl+f"], "command": "indentxml" }, | |
{ "keys": ["super+k", "super+b"], "command": "toggle_side_bar" }, | |
{ | |
"keys": ["super+shift+2"], | |
"command": "set_layout", | |
"args": | |
{ | |
"cols": [0.0, 1.0], | |
"rows": [0.0, 0.5, 1.0], |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
import time | |
from redis import ConnectionPool, Redis | |
class WaitingConnectionPool(ConnectionPool): | |
"Connection Pool that blocks if a connection is not available" | |
def make_connection(self): | |
while True: | |
if self._created_connections >= self.max_connections: | |
time.sleep(0.01) | |
self._created_connections += 1 |
# celery and it's dependencies | |
amqp==1.0.8 | |
anyjson==0.3.3 | |
kombu==2.5.6 | |
python-dateutil==1.5 | |
billiard==2.7.3.21 | |
celery==3.0.15 |