- http://www.gossamer-threads.com/lists/python/python/31447
- http://stackoverflow.com/questions/18892712/differnce-between-binary-add-and-inplace-add
- http://blog.ziade.org/2015/11/25/should-i-use-pythonoptimize/
- http://akaptur.com/blog/2013/08/14/python-bytecode-fun-with-dis/
- https://29a.ch/2009/2/20/atomic-get-and-increment-in-python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## I don't have any devices running Android OS now. These settings may have been outdated but I cannot verify it. | |
adb shell settings put global captive_portal_fallback_url http://g.cn/generate_204 | |
adb shell settings put global captive_portal_http_url http://www.google.cn/generate_204 | |
adb shell settings put global captive_portal_https_url https://www.google.cn/generate_204 | |
adb shell settings put global captive_portal_other_fallback_urls http://www.qualcomm.cn/generate_204 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import operator | |
class Node(tuple): | |
path = property(operator.itemgetter(0)) | |
data = property(operator.itemgetter(1)) | |
stat = property(operator.itemgetter(2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
ZooKeeper Monitor | |
================= | |
This is a simple script to monitor ZooKeeper node by "mntr" command. The | |
command response will be collected to the statsd server. | |
""" | |
import argparse | |
import logging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import itertools | |
import gevent.monkey | |
class SlowHandler(logging.Handler): | |
def emit(self, record): | |
gevent.sleep(1) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""ShadowsocksX Migration. | |
This script generates ShadowsocksX profiles from the Surge configuration. | |
""" | |
import os | |
import json | |
import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
set -e | |
mkdir -p ~/.oracle_jre_usage | |
sudo chown root:admin ~/.oracle_jre_usage | |
sudo chmod o= ~/.oracle_jre_usage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ansible all --ask-become-pass -i production -m shell -a 'curl http://update.aegis.aliyun.com/download/quartz_uninstall.sh | bash' | |
ansible all --ask-become-pass -i production -m shell -a 'rm -rf /usr/local/aegis' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
STAGING_LOCATION="$(brew cask doctor \ | |
| grep -A1 '==> Homebrew-cask Staging Location:' | tail -n1 \ | |
| awk '{print $1}')" | |
echo "==> Upgrading casks" | |
for cask in $(ls ${STAGING_LOCATION}) |