Skip to content

Instantly share code, notes, and snippets.

View myusuf3's full-sized avatar
🏠
Working from home

Mahdi Yusuf myusuf3

🏠
Working from home
View GitHub Profile
@kennethreitz
kennethreitz / README.rst
Created September 8, 2011 05:57
Plans for Python-Resources.

Resources for Python

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.
@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@brodul
brodul / streaming.sh
Created July 25, 2012 19:39
Twitch.tv script for streaming
#! /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
@jacobb
jacobb / key_bindings.json
Created August 30, 2012 19:15
sublimetext 2 conf
[
{ "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],
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 22, 2024 09:57
Useful PostgreSQL Queries and Commands
-- 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%'
@mt3
mt3 / pandas-heroku.md
Created September 8, 2012 23:10 — forked from nicolashery/pandas-heroku.md
Deploy Python app using Pandas on Heroku

Deploy Python app using Pandas on Heroku

2012-09-08

This document explains how to deploy a Python app that uses the Pandas library on Heroku.

Heroku builds Numpy (one of Pandas' requirements) fine. However, when trying to deploy an app with both numpy and pandas in its requirements.txt file (or even just pandas), for some reason it fails

@agnoster
agnoster / README.md
Last active July 13, 2024 19:26
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

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
@Nurdok
Nurdok / python_conversion.md
Last active July 11, 2024 15:00
Python Conversion

Python Number Conversion Chart

From To Expression
@ionelmc
ionelmc / requirements.txt
Created May 9, 2013 15:33
golden celery
# 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