Skip to content

Instantly share code, notes, and snippets.

@hzqtc
hzqtc / main_AndroidManifest.xml
Last active December 11, 2018 04:36
Android FlowLayout demo.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="hzqtc.flowlayout"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19"/>
@hzqtc
hzqtc / private.xml
Created June 29, 2013 14:17
KeyRemap4MacBook private.xml
<?xml version="1.0"?>
<root>
<item>
<name>Dashboard as Left Mouse Button</name>
<identifier>dashboard_to_left_mouse_button</identifier>
<autogen>__KeyToPointingButton__ KeyCode::DASHBOARD, PointingButton::LEFT</autogen>
</item>
</root>
@hzqtc
hzqtc / simple.pac
Created May 18, 2013 06:23
My proxy rules.
function doesHostNeedProxy(host) {
var blocked = [
// twitter
'twitter.com',
// google sites
'feeds.feedburner.com',
'feedproxy.google.com',
'googlecode.com',
'plus.google.com',
'drive.google.com',
@hzqtc
hzqtc / dict-cli.py
Last active December 16, 2015 15:39
Command line English-Chinese dictionary. Data from http://www.iciba.com. Requires lxml, clint and mpg123 (for pronouncing only).
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import getopt
import lxml.html
import re
import subprocess
import sys
import urllib
@hzqtc
hzqtc / imgcmp.py
Last active December 16, 2015 10:28
Compare two image mathematically using Perceptual Hash Algorithm. http://hzqtc.github.io/2013/04/image-duplication-detection.html
#!/usr/bin/python
import sys
from PIL import Image
def avhash(im):
if not isinstance(im, Image.Image):
im = Image.open(im)
im = im.resize((8, 8), Image.ANTIALIAS).convert('L')
avg = reduce(lambda x, y: x + y, im.getdata()) / 64.
@hzqtc
hzqtc / jdooxx.py
Last active December 16, 2015 08:59
Download Jiandan OOXX gallery. http://jandan.net/ooxx
#!/usr/bin/env python
# Example:
# curl -s http://jandan.net/ooxx | ./jdooxx.py -o 5 -r 2.0 -u | wget -nv -i -
# This will download all pictures with oo >= 5 in the last page of Jiandan OOXX.
import HTMLParser
import sys
import getopt