Skip to content

Instantly share code, notes, and snippets.

🐝

Kaizhao Zhang zhangkaizhao

🐝
Block or report user

Report or block zhangkaizhao

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
@zhangkaizhao
zhangkaizhao / PKGBUILD
Last active Oct 3, 2018
Fixed `ModuleNotFoundError` problem in AUR package https://aur.archlinux.org/packages/python-black
View PKGBUILD
# Maintainer: Daniel M. Capella <polycitizen@gmail.com>
# Maintainer: James Zhu <jameszhu@berkeley.edu>
pkgname=python-black
pkgver=18.9b0
pkgrel=1
pkgdesc='Uncompromising Python code formatter'
arch=('any')
url=https://github.com/ambv/black
license=('MIT')
@zhangkaizhao
zhangkaizhao / Pipfile
Created Aug 15, 2018
Global async Redis connection in Tornado web demo
View Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
tornado = "==5.1"
asyncio-redis = "==0.15.1"
[dev-packages]
@zhangkaizhao
zhangkaizhao / app.py
Last active Apr 25, 2018
using tornado ioloop in multiple threads
View app.py
import random
import threading
import time
import tornado.gen
import tornado.ioloop
@tornado.gen.coroutine
def _work(i):
@zhangkaizhao
zhangkaizhao / closure.js
Last active Apr 10, 2018
Python `__eq__` compared to JavaScript closure
View closure.js
// via Telegram Desktop CPyUG group fy
// https://stackoverflow.com/a/48298565/2837824
const a = {
i: 1,
toString: function() {
return a.i++;
}
}
if (a == 1 && a == 2 && a == 3) {
console.log("Hello World!");
View PKGBUILD
# Maintainer: Miguel Peláez <kernelfreeze@outlook.com>
# Contributor: WFCody
pkgname=jdk8-openj9-bin
_pkgver_minor="162"
_pkgver_build="12"
_pkgver_openj9="0.8.0"
pkgver=8.${_pkgver_minor}
pkgrel=1
View pk.py
import pickle
FILENAME = 'dumped.pickle'
def dump(obj, mode='wb'):
with open(FILENAME, mode) as fp:
pickle.dump(obj, fp)
@zhangkaizhao
zhangkaizhao / test_periodic_callback.py
Created Feb 9, 2017
Test Tornado's periodic callback
View test_periodic_callback.py
import time
import tornado.gen
import tornado.ioloop
class Counter:
n = 0
You can’t perform that action at this time.