Skip to content

Instantly share code, notes, and snippets.

Grey Lee bcse

Block or report user

Report or block bcse

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bcse / app.yaml
Created Aug 28, 2015
Debian repository on Google App Engine
View app.yaml
application: altcanvas-repo
version: 1
runtime: python
api_version: 1
- url: .*
bcse / .clang-format
Created Mar 21, 2014
My ClangFormat configuration
View .clang-format
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignTrailingComments: false
ColumnLimit: 0
NamespaceIndentation: Inner
ObjCSpaceAfterProperty: true
IndentWidth: 4
BreakBeforeBraces: Stroustrup
View ASCIIzation.php
function asciize($str)
static $from = array('Á', 'À', 'Â', 'Ä', 'Ǎ', 'Ă', 'Ā', 'Ã', 'Å', 'Ǻ', 'Ą', 'Ɓ', 'Ć', 'Ċ', 'Ĉ', 'Č', 'Ç', 'Ď', 'Ḍ', 'Ɗ', 'É', 'È', 'Ė', 'Ê', 'Ë', 'Ě', 'Ĕ', 'Ē', 'Ę', 'Ẹ', 'Ǝ', 'Ə', 'Ɛ', 'Ġ', 'Ĝ', 'Ǧ', 'Ğ', 'Ģ', 'Ɣ', 'Ĥ', 'Ḥ', 'Ħ', 'I', 'Í', 'Ì', 'İ', 'Î', 'Ï', 'Ǐ', 'Ĭ', 'Ī', 'Ĩ', 'Į', 'Ị', 'Ĵ', 'Ķ', 'Ƙ', 'Ĺ', 'Ļ', 'Ł', 'Ľ', 'Ŀ', 'Ń', 'Ň', 'Ñ', 'Ņ', 'Ó', 'Ò', 'Ô', 'Ö', 'Ǒ', 'Ŏ', 'Ō', 'Õ', 'Ő', 'Ọ', 'Ø', 'Ǿ', 'Ơ', 'Ŕ', 'Ř', 'Ŗ', 'Ś', 'Ŝ', 'Š', 'Ş', 'Ș', 'Ṣ', 'Ť', 'Ţ', 'Ṭ', 'Ú', 'Ù', 'Û', 'Ü', 'Ǔ', 'Ŭ', 'Ū', 'Ũ', 'Ű', 'Ů', 'Ų', 'Ụ', 'Ư', 'Ẃ', 'Ẁ', 'Ŵ', 'Ẅ', 'Ƿ', 'Ý', 'Ỳ', 'Ŷ', 'Ÿ', 'Ȳ', 'Ỹ', 'Ƴ', 'Ź', 'Ż', 'Ž', 'Ẓ', 'á', 'à', 'â', 'ä', 'ǎ', 'ă', 'ā', 'ã', 'å', 'ǻ', 'ą', 'ɓ', 'ć', 'ċ', 'ĉ', 'č', 'ç', 'ď', 'ḍ', 'ɗ', 'é', 'è', 'ė', 'ê', 'ë', 'ě', 'ĕ', 'ē', 'ę', 'ẹ', 'ǝ', 'ə', 'ɛ', 'ġ', 'ĝ', 'ǧ', 'ğ', 'ģ', 'ɣ', 'ĥ', 'ḥ', 'ħ', 'ı', 'í', 'ì', 'i', 'î', 'ï', 'ǐ', 'ĭ', 'ī', 'ĩ', 'į', 'ị', 'ĵ', 'ķ', 'ƙ', 'ĸ', 'ĺ', 'ļ', 'ł', 'ľ', 'ŀ', 'ʼn', 'ń', 'ň', 'ñ', 'ņ', 'ó', 'ò', 'ô', 'ö', 'ǒ', 'ŏ'
from __future__ import with_statement
import glob
import os.path
import re
import urllib
import flickrapi
api_key = '________________________________'
api_secret = '________________'
user_id = '____________'
bcse /
Created Jan 29, 2011
streamlined + torrific (Depends on suds and Python 2.5 or higher)
from os.path import expanduser, join
from base64 import b64encode
from glob import glob
import webbrowser
from suds.client import Client
url = ''
client = Client(url)
files = glob(join(expanduser('~'), 'Downloads', '*.torrent'))
bcse /
Created Mar 8, 2011
Convert black to opaque and white to transparent. (Depends on pypng)
import png
def convert(fin, fout):
reader = png.Reader(filename=fin)
width, height, pixels, metadata = reader.asDirect()
#print metadata
out = list()
for row in pixels:
row_out = list()
bcse / dbbackup.php
Created Sep 8, 2011
Backup all MySQL databases and send to my E-mail
View dbbackup.php
$boundary = '==DBBACKUP-'.md5(uniqid(rand(), true));
$date = date('Ymd');
$header = "Content-Type: multipart/mixed; boundary=\"$boundary\"";
$message =
"This is a multi-part message in MIME format.\n".
bcse /
Created Sep 8, 2011
Automatic post latest smiley on your timeline (Plurk API 1.0)
#!/usr/bin/env python
#--- Setup ---------------------------------------------------
import sys, os, urllib, urllib2, cookielib
import json
bcse /
Last active Sep 27, 2015
Fetch top 100 popular photos from Flickr
import re
import json
import os
from urllib.request import urlopen, urlretrieve
from glob import glob
config = {
'api_key': 'YOUR_API_KEY',
'sort': 'interestingness-desc',
'per_page': 100
registry = {}
class MultiMethod(object):
def __init__(self, name): = name
self.typemap = {}
def __call__(self, *args):
types = tuple(arg.__class__ for arg in args) # a generator expression!
function = self.typemap.get(types)
if function is None:
You can’t perform that action at this time.