Skip to content

Instantly share code, notes, and snippets.

shu.chen sirpengi

Block or report user

Report or block sirpengi

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
@sirpengi
sirpengi / blah.py
Created Aug 2, 2017
cached requests
View blah.py
from datetime import datetime, timedelta
from os import stat, unlink
import requests
import vcr
CFILE = "blah.cassette"
TTL = timedelta(minutes=15)
try:
cstat = stat(CFILE)
View keybase.md

Keybase proof

I hereby claim:

  • I am sirpengi on github.
  • I am sirpengi (https://keybase.io/sirpengi) on keybase.
  • I have a public key whose fingerprint is DD4A 1501 C3EA 961E F29D 6CE0 8043 C5BD 77C3 C053

To claim this, I am signing this object:

View blah.js
var evaluate = function(f) {
var args = copyArgs(arguments, 1)
if (_.isFunction(f)) {
return f.apply(f, args);
}
return f
};
View yolodb.py
class YOLODBType(object):
pass
def YOLODB():
class val():
v = None
def _T(f, c, g, is_root=False):
class T(YOLODBType):
def __str__(self):
return str(g.v)
View saml.py
import time
def cry():
print "T.T;"
time.sleep(1)
T = type('T', tuple(), {'__getattr__': lambda s, k: cry()})()
lonely = True
while lonely:
@sirpengi
sirpengi / lol.js
Created Sep 4, 2014
wtf javascript
View lol.js
var assert = require("assert");
assert.equal(
({lol: 'LOL', javascript: 'JAVASCRIPT'})['lol', 'wtf', 'javascript'],
"JAVASCRIPT"
);
assert.equal(
({lol: 'LOL', javascript: 'JAVASCRIPT'})[['javascript']],
"JAVASCRIPT"
@sirpengi
sirpengi / fsm_test.js
Last active Aug 29, 2015
sample usage of backbone-fsm
View fsm_test.js
module.paths.push(".");
var assert = require("assert");
var _ = require("underscore");
var Backbone = require("backbone");
var FSM = require("backbone-fsm").BackboneFSM;
/* Implementation of a turnstile (i.e., at train station). Turnstile is
initially locked and won't let people through. Once a coin is
inserted, the turnstile becomes unlocked, and lets one person through before
@sirpengi
sirpengi / touch.js
Created Jul 18, 2014
emulate touch event
View touch.js
// go to http://patrickhlauke.github.io/touch/tests/event-listener.html
el = document.getElementsByClassName("button")[0];
e = new Event("touch");
e.initEvent("touchstart", true, true);
el.dispatchEvent(e);
@sirpengi
sirpengi / hmmm.py
Created Jul 10, 2014
looks bad when I outline it like this
View hmmm.py
if:
if:
if not:
raise
if:
elif:
if not:
raise
if:
elif:
@sirpengi
sirpengi / output.txt
Last active Aug 29, 2015
some sandpile thing
We couldn’t find that file to show.
You can’t perform that action at this time.