Skip to content

Instantly share code, notes, and snippets.

@zhangtaii
zhangtaii / renameCH2Pinyin.py
Created November 19, 2018 08:16
To rename Unicode Chinese character file names to Pinyin, origin gist link broken: https://gist.github.com/hxinblog/5001033
#!/usr/bin/python
# ref: http://sunzhen.blogspot.com/2016/05/rename-chinese-filenames-to-pinyin.html
# origin gist: https://gist.github.com/hxinblog/5001033, broken
# renameCH2Pinyin.py
# Rename filename from Chinese characters to capitalized pinyin using the
# mapping file and taking out the tone numbers
# Download 'uni2pinyin' from ftp://ftp.cuhk.hk/pub/chinese/ifcss/software/data/Uni2Pinyin.gz
#
@zhangtaii
zhangtaii / batch_curl.sh
Last active March 21, 2018 18:01
Batch query API endpoint, feed cURL from loop with range and step, gzip decompress
#!/bin/bash
for offset in `seq 0 50 5000`; do
curl -H 'accept-encoding: br, gzip, deflate' "${API_ENDPOINT}/?offset=${offset}&limit=50" | gunzip - > "outputs/${offset}.json"
done
@zhangtaii
zhangtaii / jq_merge_json_array.sh
Created March 21, 2018 14:03
Merge array from "objects" key of multiple JSON file using jq
jq -s 'reduce .[] as $dot ({}; .objects += $dot.objects)' *.json > output.json

Keybase proof

I hereby claim:

  • I am zhangtaii on github.
  • I am tai (https://keybase.io/tai) on keybase.
  • I have a public key whose fingerprint is 2998 3044 4BF6 2BD3 8F13 C2EE CE80 552A 7F2B 33C9

To claim this, I am signing this object: