This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# coding=utf-8 | |
# -*- coding: utf-8 -*- | |
# This script adds an "area" field (in square meters) | |
# and a "centroid" field to feature.geometry | |
# for Polygon's and MultiPolygon's in a geojson file. | |
# Usage example: | |
# ./gj-area-centroid.py university.geojson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# find deal-breakers for 'iconv -f utf8 -t big5' | |
# 例: 清冠一號中醫診所清單裡面有一些簡體字「号」「络」和放大鏡符號等等, | |
# 會造成 iconv 從 utf8 轉 big5 時失敗。 這個程式可以列出有哪幾列有問題。 | |
# https://docs.google.com/spreadsheets/d/e/2PACX-1vQjf_HNeEZKM-XJX-q5v4cfNrB3kcv4gOT8kFbV9rurfoX_H5Qv9112Pv0PgYNFSzbReyNlQkLrJib3/pubhtml# | |
# 使用方式: python3 db-iconv 某中文utf8編碼檔 | |
# 每列呼叫一次 iconv, 有點慢 | |
import argparse, re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
year | Derek | Derek_hit | David | David_hit | |
---|---|---|---|---|---|
1995 | 48 | 12 | 411 | 104 | |
1996 | 582 | 183 | 140 | 45 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# PTX (公共運輸整合資訊流通服務平臺) 的 bash 查詢範例 | |
# 詳見: https://newtoypia.blogspot.tw/2018/01/ptx-bash-php.html | |
# 需要安裝 httpie 及 openssl 等套件 | |
# 使用方式: | |
# ./ptx-example.bash 'https://ptx.transportdata.tw/MOTC/v2/Bus/DisplayStopOfRoute/City/Taichung/151?%24format=JSON' | |
# 或 | |
# ./ptx-example.bash 'https://ptx.transportdata.tw/MOTC/v2/Bus/DisplayStopOfRoute/City/Taichung/151?%24format=JSON' 'Thu, 10 Feb 2022 09:07:10 GMT' | |
# 會印出 (1) http 指令 (2) 查詢結果 | |
# (3) 查詢用的時間戳記及簽章 (在五分鐘內可供再次使用) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# PTX (公共運輸整合資訊流通服務平臺) 的 php 查詢範例 | |
# 詳見: https://newtoypia.blogspot.tw/2018/01/ptx-bash-php.html | |
# 使用方式: | |
# php ptx-example.php 'https://ptx.transportdata.tw/MOTC/v2/Bus/DisplayStopOfRoute/City/Taichung/151?%24format=JSON' | |
# 或 | |
# php ptx-example.php 'https://ptx.transportdata.tw/MOTC/v2/Bus/DisplayStopOfRoute/City/Taichung/151?%24format=JSON' 'Thu, 10 Feb 2022 09:07:10 GMT' | |
# 本程式不需要任何外加套件; 但關於 「如何保護私密資訊」, 請見 | |
# http://phpsec.org/projects/guide/3.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# https://medium.com/mycrypto/the-journey-from-mnemonic-phrase-to-address-6c5e86e11e14 | |
# pip3 install bip_utils | |
# python3 bip_demo.py | |
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# See this article for more explanations: | |
# https://ckhung.medium.com/4-in-1-priority-first-search-in-python-bfs-dfs-prims-and-dijkstra-s-algorithms-4e9fe8ccba87 | |
# pip3 install pqdict pydot networkx | |
# python3 pfs.py -a dijk -0 E t02.dot | |
# python3 pfs.py -a prim -0 G t02.dot | |
# https://github.com/nvictus/priority-queue-dictionary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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: | |
// https://api.coingecko.com/api/v3/coins/list | |
// See this doc for more info: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# multicast netcat | |
# https://newtoypia.blogspot.com/2021/09/netcat.html | |
# 齊步走! 用 netcat 同步指揮教室裡的所有電腦 | |
import argparse, sys, re, readline | |
from warnings import warn | |
from subprocess import Popen, PIPE |