Skip to content

Instantly share code, notes, and snippets.

@cliffxuan
cliffxuan / defer.py
Created April 28, 2012 23:16
wxPython non blocking gui with long running task and timeout
import sys
import threading
import Queue
import wx
_noTimeoutDefault = object()
def defer(
returnToFunction,
function,
@cliffxuan
cliffxuan / coroutine_io.py
Created May 9, 2012 18:45 — forked from markwatson/coroutine_io.py
A python IO class that writes to a coroutine.
import io
class CoroutineIO(io.TextIOBase):
"""
Creates an writable IO interface to a coroutine.
"""
def __init__(self, coroutine):
"""
Creates a new IO object with a coroutine. The
coroutine should take no arguments.
@cliffxuan
cliffxuan / introspect_primary_key.py
Created November 10, 2012 21:43
Introspect constraint on table's primary key in the entire database
import unittest
import itertools
import sqlalchemy as sa
from sqlalchemy import Table, Column, String, ForeignKey
from newman.schema.branch import tables
class Introspector(object):
def __init__(self, metadata):
self.metadata = metadata
import unittest
import sys
code_map = {
'a' : '2',
'b' : '22',
'c' : '222',
'd' : '3',
'e' : '33',
'f' : '333',
#!/bin/sh
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
echo "checkout submodules"
git submodule init
git submodule update
echo "symlink .vim"
if [ -d "$HOME/.vim" ]
then
This file has been truncated, but you can view the full file.
A
a
aa
aal
aalii
aam
Aani
aardvark
aardwolf
Aaron
@cliffxuan
cliffxuan / Responsive-flip-menu.-Pure-CSS..markdown
Last active August 29, 2015 14:19
Responsive flip menu. Pure CSS.
We can't make this file beautiful and searchable because it's too large.
AB1 0AA
AB1 0AB
AB1 0AD
AB1 0AE
AB1 0AF
AB1 0AG
AB1 0AJ
AB1 0AL
AB1 0AN
AB1 0AP

Get github repositories for an organisation

requirement

  • python

install

  • pip install requests
import logging
from contextlib import ContextDecorator
format = '%(asctime)s - %(levelname)s - %(message)s'
ch = logging.StreamHandler()
ch.setFormatter(logging.Formatter(format))
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.addHandler(ch)