Skip to content

Instantly share code, notes, and snippets.

💭
thoughts in chaos

Yutong Zhao proteneer

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am proteneer on github.
  • I am yutong (https://keybase.io/yutong) on keybase.
  • I have a public key whose fingerprint is A3DD C50A 4524 96E9 2A4F CFB3 91CE ACDB 2605 E878

To claim this, I am signing this object:

View gist:390ddd4ed4d165141a19
#include <OpenMM.h>
#include <iostream>
#include <fstream>
#include <limits>
using namespace OpenMM;
using namespace std;
extern "C" void registerSerializationProxies();
extern "C" void registerOpenCLPlatform();
View gist:a1bd29592809e1457f8d
import tornado.web
import tornado.httpserver
import tornado.ioloop
import process2
import tornado.netutil
import redis
import signal
import time
import sys
import os
View gist:cf5f480138d2f67cbcc1
import simtk.openmm
import simtk.unit as unit
import math
state = simtk.openmm.XmlSerializer.deserialize(open('state.xml').read())
system = simtk.openmm.XmlSerializer.deserialize(open('system.xml').read())
for i, force in enumerate(system.getForces()):
force.setForceGroup(i)
system.getForce(3).setReciprocalSpaceForceGroup(6)
@proteneer
proteneer / gist:8839171
Created Feb 6, 2014
Keyboard events Linux
View gist:8839171
#define LINUX
#ifndef LINUX
#include <conio.h> /* kbhit(), getch() */
#else
#include <sys/time.h> /* struct timeval, select() */
/* ICANON, ECHO, TCSANOW, struct termios */
#include <termios.h> /* tcgetattr(), tcsetattr() */
#include <cstdlib> /* atexit(), exit() */
View gist:7937406
count = 10000
start = time.time()
for i in range(count):
rc.set('bar',1)
rc.set('bar',1)
rc.set('bar',1)
rc.set('bar',1)
print time.time()-start
@proteneer
proteneer / gist:7916922
Last active Dec 31, 2015
python redis hash+set wrapper
View gist:7916922
import redis
rc = redis.Redis(port=6782)
rc.flushdb()
class HashSet(object):
_rc = None
_rmaps = []
@classmethod
View Polling redis
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)
View notify expiration
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)
You can’t perform that action at this time.