Skip to content

Instantly share code, notes, and snippets.

View sublee's full-sized avatar
✔️
Hello, world!

Heungsub Lee sublee

✔️
Hello, world!
View GitHub Profile
@nzjrs
nzjrs / curses-demo.py
Created August 8, 2009 03:26
Helper for using curses from python
#!/usr/bin/env python
# This module provides a 'with' for using curses in Python.
# from: http://www.finalcog.com/python-with-curses-with_curses
from __future__ import with_statement
import curses
class WithCurses(object):
"""
@sanxiyn
sanxiyn / lisp.c
Created August 14, 2010 04:16
Lisp
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,
// Ported from http://blog.inspirit.ru/wp-content/uploads/qsort/Main.as
function flashSort( array ) {
var a = array, n = array.length;
var i = 0, j = 0, k = 0, t, hold, flash;
var m = ~~( n * 0.125 );
var l = [], anmin = a[ 0 ], nmax = 0, nmove = 0;
while ( ++i < n ) {
@mikelikespie
mikelikespie / refresh_css.js
Created October 27, 2010 18:31
This refreshes all the css on a page by changing the query string
/*
Add a bookmark to this
javascript:(function(){var c=document.getElementsByTagName("link");for(var d=0;d<c.length;d++){var a=c[d];if(a.rel=='stylesheet'||a.type=="text/css"){var e="css_buster_"+Math.floor(Math.random()*1000000000);var g=a.href.split("?",2);var f;if(g.length>1){var b=g[1].indexOf("&")==-1;if(b){f=e}else{f=g[1]+"&"+e}}else{f=e}a.href=g[0]+"?"+f}}})();
*/
(function() {
var links = document.getElementsByTagName('link');
for (var i = 0; i < links.length; i++) {
var l = links[i];
if (l.rel == 'stylesheet' || l.type == 'text/css') {
@nathforge
nathforge / gist:658336
Created November 1, 2010 15:22
Find the dominant colour in an image
import colorsys
def get_dominant_color(image):
"""
Find a PIL image's dominant color, returning an (r, g, b) tuple.
"""
image = image.convert('RGBA')
# Shrink the image, so we don't spend too long analysing color
@comfuture
comfuture / manage-daemon
Created November 11, 2010 06:28
init script sample for gunicorn daemonized flask app
#!/bin/bash
gunicorn="/usr/local/bin/gunicorn"
prog="dev.maroo.info"
PROJECT_HOME="/home/maroo/sites/$prog"
pid="/var/lock/$prog"
RETVAL=0
start() {
@lifthrasiir
lifthrasiir / ere2pcre.php
Created November 18, 2010 07:59
a drop-in replacement for ereg* functions in PHP
<?php
// ere2pcre -- a drop-in replacement for ereg* functions
// written by Kang Seonghoon <public+ere2pcre@mearie.org>.
//
// this library is dedicated to the public domain. for the jurisdictions that
// does not recognize the public domain, CC0 1.0 Universal Public Domain
// Dedication applies.
function _ere2pcre_escape($c) {
if ($c == "\0") {
@jongyeol
jongyeol / gist:745809
Created December 17, 2010 22:18
어떤 수 구하기 (Python) by jong10
# problem: http://club.filltong.net/codingdojo/27611
# coded by jong10
import unittest
# infix to prefix(s-expression)
# modified from http://news.ycombinator.com/item?id=284954
def parse(s):
for operator in ["+-", "*/"]:
depth = 0
@jongyeol
jongyeol / gmail sender
Created January 5, 2011 21:33
Sample code to send mail with GMail by smtp, python
#!/usr/bin/python
# coding: utf-8
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
import email.Charset
GMAIL_ID = '??????@gmail.com'
GMAIL_PW = 'password'
@qrush
qrush / Inconsolata-dz-Powerline.otf
Created January 11, 2012 16:50
vim-powerline patched fonts