Skip to content

Instantly share code, notes, and snippets.

View chanhosuh's full-sized avatar

Chan-Ho Suh chanhosuh

View GitHub Profile
#!/usr/bin/python3
from datetime import date, timedelta, datetime
# Disclaimer: not investment advice, and this is a sloppy script!
# Objective Inputs
GLOBAL_LOCKED_veCRV = 362000000
# Subjective Inputs
@maxfischer2781
maxfischer2781 / async_read.py
Last active April 7, 2025 02:10
example implementation for an async event loop
import time
import select
import socket
class AsyncSleep:
"""Event and action to sleep ``until`` a point in time"""
def __init__(self, until):
self.until = until
@harto
harto / before.js
Created April 20, 2016 17:33
Mocha before() & beforeEach() execution order with nested describe()
'use strict';
describe('mocha before hooks', function () {
before(() => console.log('*** top-level before()'));
beforeEach(() => console.log('*** top-level beforeEach()'));
describe('nesting', function () {
before(() => console.log('*** nested before()'));
beforeEach(() => console.log('*** nested beforeEach()'));
it('is a nested spec', () => true);
});
@venkatesh22
venkatesh22 / django custom signal
Created June 26, 2013 05:37
django custom signals creation example
#signals.py
from django.dispatch import Signal
user_login = Signal(providing_args=["request", "user"])
#views.py
from foo import signals
@aflaxman
aflaxman / mpl_cfaces.py
Created November 9, 2012 01:12
Chernoff Faces in Python with Matplotlib
from pylab import *
def cface(ax, x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18):
# x1 = height of upper face
# x2 = overlap of lower face
# x3 = half of vertical size of face
# x4 = width of upper face
# x5 = width of lower face
# x6 = length of nose
# x7 = vertical position of mouth
@tebeka
tebeka / gist:3949879
Created October 25, 2012 00:58
Use BaseHTTPServer for testing
#!/usr/bin/env python
# Using BaseHTTPServer for mocking servers
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from threading import Thread
from time import sleep, time
from urllib import urlopen
import httplib