Skip to content

Instantly share code, notes, and snippets.


Chao-Kuei Hung ckhung

View GitHub Profile
ckhung /
Created Aug 30, 2022
find deal-breakers for 'iconv -f utf8 -t big5'
# find deal-breakers for 'iconv -f utf8 -t big5'
# 例: 清冠一號中醫診所清單裡面有一些簡體字「号」「络」和放大鏡符號等等,
# 會造成 iconv 從 utf8 轉 big5 時失敗。 這個程式可以列出有哪幾列有問題。
# 使用方式: python3 db-iconv 某中文utf8編碼檔
# 每列呼叫一次 iconv, 有點慢
import argparse, re
ckhung / batting.csv
Created May 15, 2022
juxtaposed "binary" Marimekko charts, good for visualizing Simplson's paradox invloving some "hit" ratios
View batting.csv
year Derek Derek_hit David David_hit
1995 48 12 411 104
1996 582 183 140 45
ckhung / country-codes.csv
Last active May 22, 2022
Prepend the 3-letter ISO country code and continent name to every line, except the 1st line, of a csv file containing country names
View country-codes.csv
No name iso m49 reg1 reg2 continent
1 Afghanistan AFG 004 Southern Asia Asia
2 Åland Islands ALA 248 Northern Europe Europe
3 Albania ALB 008 Southern Europe Europe
4 Algeria DZA 012 Northern Africa Africa
5 American Samoa ASM 016 Polynesia Oceania
6 Andorra AND 020 Southern Europe Europe
7 Angola AGO 024 Middle Africa Sub-Saharan Africa Africa
8 Anguilla AIA 660 Caribbean Latin America and the Caribbean North America
9 Antarctica ATA 010 Antarctica Antarctica
ckhung /
Last active Jan 12, 2022
priority first search on a graphviz dot file
# See this article for more explanations:
# pip3 install pqdict pydot networkx
# python3 -a dijk -0 E
# python3 -a prim -0 G
# pip3 install bip_utils
# python3
# For the 1st example, private key and address of path0
# have been verified using exodus wallet.
# For the 2nd example, the computed master key does not match the article...?
# If you have a private key stored in a file named priv_key_file.txt
# this program will also create a derived pair of keys from it
# as a 3rd example.
ckhung / gecko.php
Last active Dec 5, 2021
generate a csv listing of your favorite cryptocurrencies, suitable for importing into a google sheet
View gecko.php
// usage:
// http://.../gecko.pgp??q=bitcoin,ethereum,solana,polkadot
// or
// http://.../gecko.pgp??q=mycrypto.csv
// where mycrypto.csv contains the id of a coin on each line.
// Find the exact id of your coin in this list:
// See this doc for more info:
ckhung / example.pdmenu
Last active Dec 3, 2021
pdmenu example
View example.pdmenu
# pdmenu 幫麻瓜製作常用功能文字選單
title:貴哥的 pdmenu 教學範例
ckhung /
Last active Dec 3, 2021
multicast netcat
# multicast netcat
# 齊步走! 用 netcat 同步指揮教室裡的所有電腦
import argparse, sys, re, readline
from warnings import warn
from subprocess import Popen, PIPE
ckhung /
Last active Sep 4, 2021
primitive voice command interface w/ pocketsphinx as backend
import argparse, os, re
from warnings import warn
import subprocess
parser = argparse.ArgumentParser(
description='invoke pocketsphinx and produce keystrokes',
parser.add_argument('-k', '--kwokfn', type=str, default='',
ckhung /
Created Sep 4, 2021
把 「xml-js 所轉出的噗浪 rss => json」 再轉成 html
# for f in *.xml ; do xml-js $f --compact | jq . > ${f/%xml/json} ; done
# python3 *.json > new.html
# 詳見
import argparse, json, re
from warnings import warn