View android-captive.sh
#!/usr/bin/env sh
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
View clean_code_wcc
#!/usr/bin/env sh
# Clean up the control characters of documents
# See also: https://wdd.js.org/vscode-control-characters-problem.html
# https://github.com/Microsoft/vscode/issues/37114
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' {} +
View README.rst

Run with Python:

pip-2.7 install cffi
PYTHON=python2.7 sh go.sh

Run with PyPy:

pip-pypy install cffi
PYTHON=pypy sh go.sh
View supervisord.service
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf
ExecReload=/usr/bin/supervisorctl reload
ExecStop=/usr/bin/supervisorctl shutdown
View mysql-backup.sh
#!/bin/sh
set -e
MYSQL_USERNAME='root'
MYSQL_PASSWORD=''
MYSQL_HOST='127.0.0.1'
MYSQL_PORT='3306'
MYSQL_DATADIR='/var/lib/mysql'
View vimrc
syntax on
filetype off
" format and user interface
set nocompatible
set number
set softtabstop=4 tabstop=4 shiftwidth=4
set expandtab
set autoindent
set hlsearch
View brew-cask-upgrade
#!/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})
View README.md

Downgrade Sketch Document

Why

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

View namedtuple.py
import operator
class Node(tuple):
path = property(operator.itemgetter(0))
data = property(operator.itemgetter(1))
stat = property(operator.itemgetter(2))