- lxml - Pythonic binding for the C libraries libxml2 and libxslt.
- boto - Python interface to Amazon Web Services
- Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
- Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
- PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
- Celery - Task queue to distribute work across threads or machines.
- pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from concurrent.futures import ThreadPoolExecutor, Future | |
import asyncio | |
import time | |
async def sum_numbers(x, y): | |
await asyncio.sleep(1) | |
return x + y | |
def sum_numbers_blocking(x, y): | |
time.sleep(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original code at http://code.activestate.com/recipes/203871/ | |
# I have added a limit for the number of tasks waiting | |
# The method queueTask will block if the current taskList size | |
# exceeds the specified limit | |
import threading | |
from time import sleep | |
# Ensure booleans exist (not needed for Python 2.2.1 or higher) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--------------------------------------------- | |
# TINT2 CONFIG FILE | |
#--------------------------------------------- | |
# For more information about tint2, see: | |
# http://code.google.com/p/tint2/wiki/Welcome | |
# | |
# For more config file examples, see: | |
# http://bunsenlabs.org/topic/3232/my-tint2-config/ | |
# Background definitions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from gevent import server | |
from gevent.monkey import patch_all; patch_all() | |
from multiprocessing import Process, current_process, cpu_count | |
def note(format, *args): | |
sys.stderr.write('[%s]\t%s\n' % (current_process().name, format%args)) | |
def echo(socket, address): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from gevent import server | |
from gevent.baseserver import _tcp_listener | |
from gevent import pywsgi | |
from gevent.monkey import patch_all; patch_all() | |
from multiprocessing import Process, current_process, cpu_count | |
def hello_world(env, start_response): | |
if env['PATH_INFO'] == '/': | |
start_response('200 OK', [('Content-Type', 'text/html')]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Ubuntu Install | |
``` | |
sudo apt-get install mongodb | |
pip install pymongo | |
``` | |
Table - Collection | |
Column - Property | |
Row - Document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
################################################################ | |
# simpledb: a simple mysql db wrapper module with auto connect | |
# | |
# Author: Curu Wong | |
# Date: 2014-08-25 | |
# License: GPL v3 | |
########################################################## | |
import sys,time | |
import MySQLdb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
from copy import deepcopy | |
def fluent(method): | |
"""Used to define fluent API class methods""" | |
@wraps(method) | |
def wrapped(self, *args, **kwargs): | |
dupe = deepcopy(self) | |
method(dupe, *args, **kwargs) | |
return dupe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#foo")[0].selectize.addOption({ | |
//id: 35,// I use IDs instead | |
name: "Some User", | |
score: 1 | |
}); | |
$("#foo")[0].selectize.addItem( 'Some User' ); // If using IDs it should be 35 instead |