Skip to content

Instantly share code, notes, and snippets.

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:

@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
@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 / 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 / renameCH2Pinyin.py
Created November 19, 2018 08:28
To rename Unicode Chinese character file names to Pinyin
#!/usr/bin/python
# renameCH2Pinyin.py
# Rename filename from Chinese characters to capitalized pinyin using the
# mapping file and taking out the tone numbers
# 批量更改文件名, 中文 -> 拼音, 原gist: https://gist.github.com/hxinblog/5001033
# 使用参考: http://sunzhen.blogspot.com/2016/05/rename-chinese-filenames-to-pinyin.html
# Origin gist link, which is broken: https://gist.github.com/hxinblog/5001033,
@zhangtaii
zhangtaii / Podfile
Created November 25, 2018 16:17
Add launchPackager shell script to React Native with CocoaPods
# The target name is most likely the name of your project.
target 'NumberTileGame' do
# Your 'node_modules' directory is probably in the root of your project,
# but if not, adjust the `:path` accordingly
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
@zhangtaii
zhangtaii / azure-pipelines.yml
Last active February 24, 2021 22:41
Setup Azure Pipelines for React Native
trigger:
branches:
include:
- master
- releases/*
exclude:
- refs/tag/*
pool:
00 A4 04 00 0C A0 00 00 06 17 00 4F 97 A2 E9 49 01 00
F0 01 00 00 80 30 82 01 3c 30 81 e4 a0 03 02 01 02 02 0a 47 90 12 80 00 11 55 95 73 52 30 0a 06 08 2a 86 48 ce 3d 04 03 02 30 17 31 15 30 13 06 03 55 04 03 13 0c 47 6e 75 62 62 79 20 50 69 6c 6f 74 30 1e 17 0d 31 32 30 38 31 34 31 38 32 39 33 32 5a 17 0d 31 33 30 38 31 34 31 38 32 39 33 32 5a 30 31 31 2f 30 2d 06 03 55 04 03 13 26 50 69 6c 6f 74 47 6e 75 62 62 79 2d 30 2e 34 2e 31 2d 34 37 39 30
F0 01 00 80 80 31 32 38 30 30 30 31 31 35 35 39 35 37 33 35 32 30 59 30 13 06 07 2a 86 48 ce 3d 02 01 06 08 2a 86 48 ce 3d 03 01 07 03 42 00 04 8d 61 7e 65 c9 50 8e 64 bc c5 67 3a c8 2a 67 99 da 3c 14 46 68 2c 25 8c 46 3f ff df 58 df d2 fa 3e 6c 37 8b 53 d7 95 c4 a4 df fb 41 99 ed d7 86 2f 23 ab af 02 03 b4 b8 91 1b a0 56 99 94 e1 01 30 0a 06 08 2a 86 48 ce 3d 04 03 02 03 47 00 30 44 02 20 60 cd
F0 01 01 00 40 b6 06 1e 9c 22 26 2d 1a ac 1d 96 d8 c7 08 29 b2 36 65 31 dd a2 68 83 2c b8 36 bc d3 0d fa 02 20 63 1b 14 59 f0 9e 63 30 05 57 22 c8 d8 9b 7f 48 88 3b 90 89
@zhangtaii
zhangtaii / sublime regex replace
Created February 14, 2019 07:02
replace string sublime with regex group
Target content:
0x84
0xC
0x0
0x4C
Expeted result:
0x84
0x0C
0x00
{
"cuid": "9f7f2a47525300624901",
"data": {
"clientData": "eyJ0eXAiOiJuYXZpZ2F0b3IuaWQuZmluaXNoRW5yb2xsbWVudCIsImNoYWxsZW5nZSI6Ik15cFBZeURSNF9RSDlGNkVpU1I4Z1NWcTBkZ0pQR1drNTM0aU13dkhfZzQiLCJvcmlnaW4iOiJFVU5FWF9QQVkifQ==",
"registrationData": "BQSRalBa9V8hLm1DnyotA-Ym9yA6ctRDs98b2bbxhU2kVf2Jum2a9j-VAMPuhAXz4zXuyfngUGicFgvlru190Dq-QCEKU-bxv8yRdoCeB0fHOr9Y1B6khNxQYTvtDJu_SEFfcxp_LwCj3AVpNcl0p1oZ6nu8mXdIIJmtB_xXFEktdwwwggEdMIHDAgj4POOWfZt6qzAKBggqhkjOPQQDAjAXMRUwEwYDVQQDDAxHbnViYnkgUGlsb3QwHhcNMTkwMjI0MDMwNzAyWhcNMTkwMzA1MDg0NjM1WjAXMRUwEwYDVQQDDAxHbnViYnkgUGlsb3QwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATsSldyz8GZvnNat5FB6SxHb9bcB2DAPSCT0GJf_Yr3dTEhKE2yQaiymM9fj3mGRWqI4sCFR2STwokgLPJBBx77MAoGCCqGSM49BAMCA0kAMEYCIQD8TrGZ-APYgM4QwoX11OicvZqzPakftxHponLFe2ogiAIhAMF6kUvMOHsfiYBKp2yXxQiMBvwSVr1UjgdaHcS6xy8wMEYCIQD3AaFkm1QCmvFhzLNRs3AvjRPezw4LQA49B-q0uzj34QIhAO8bp8ZRkcAHAb860YUzCCgGANebFKhINHh6siPxDB6K"
}
}