Skip to content

Instantly share code, notes, and snippets.

Jiangge Zhang tonyseek

Block or report user

Report or block tonyseek

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
tonyseek /
Last active Aug 9, 2019
Download IETF RFC
#!/usr/bin/env bash
set -e
set -o pipefail
if ! grep -qE '^[[:digit:]]+$' <<<"$RFC_ID"; then
printf >&2 'Usage: %s RFC_ID\n' "$(basename "$0")"
exit 2
tonyseek /
Last active Jul 4, 2019
Use TreeCache of Kazoo to get node data.
import logging
import threading
from kazoo.client import KazooClient
from kazoo.recipe.cache import TreeCache, TreeEvent
class TreeCacheListener(object):
tonyseek /
Last active Nov 21, 2018
The decorator on instance method as a descriptor
import functools
class Increment(object):
def __init__(self, wrapped, delta):
self.wrapped = wrapped = delta
def __get__(self, instance, owner=None):
method = self.wrapped.__get__(instance, owner)
tonyseek / clean_code_wcc
Last active Jul 21, 2018
Remove wild control characters from files which was edited by VSCode
View clean_code_wcc
#!/usr/bin/env sh
# Clean up the control characters of documents
# See also:
exec find . -type f -name '*.md' -exec perl -pi -e 's/[\x{0000}\x{0001}\x{0002}\x{0003}\x{0004}\x{0005}\x{0006}\x{0007}\x{0008}\x{000b}\x{000c}\x{000d}\x{000e}\x{000f}\x{0010}\x{0011}\x{0012}\x{0013}\x{0014}\x{0015}\x{0016}\x{0017}\x{0018}\x{0019}\x{001a}\x{001b}\x{001c}\x{001d}\x{001e}\x{001f}\x{001c}\x{007f}]//gm' {} +
tonyseek /
Last active May 28, 2018
Perform MySQL incremental backup with Percona XtraBackup
set -e
tonyseek /
Last active Oct 28, 2017
Downgrade Sketch documents

Downgrade Sketch Document


I don't wish to buy Sketch 3 again since I bought it from MacAppStore but lost continue upgrades and 5 devices support. A old version of Sketch will be restricted from opening documents created by the new versions of Sketch.

This is a workaround for some Sketch documents which don't depend on any

tonyseek /
Last active Nov 18, 2019
Overrides the captive portal settings of Android in the People's Republic China Mainland
#!/usr/bin/env sh
adb shell settings put global captive_portal_fallback_url
adb shell settings put global captive_portal_http_url
adb shell settings put global captive_portal_https_url
adb shell settings put global captive_portal_other_fallback_urls
import operator
class Node(tuple):
path = property(operator.itemgetter(0))
data = property(operator.itemgetter(1))
stat = property(operator.itemgetter(2))
tonyseek /
Last active Sep 8, 2016
The deadlock caused by inconsistent thread ident (RLock of logging handlers)
import logging
import itertools
import gevent.monkey
class SlowHandler(logging.Handler):
def emit(self, record):
tonyseek /
Created Aug 23, 2016
Migrate the Surge configuration to ShadowsocksX because the Surge Mac 2.0 restricts device numbers.
#!/usr/bin/env python3
"""ShadowsocksX Migration.
This script generates ShadowsocksX profiles from the Surge configuration.
import os
import json
import time
You can’t perform that action at this time.