Skip to content

Instantly share code, notes, and snippets.

View typebrook's full-sized avatar

Hsieh Chin Fan typebrook

View GitHub Profile
@typebrook
typebrook / Makefile
Last active July 30, 2022 23:58
sprite for rudymap #rudymap #sprite #mapbox #icon
.ONESHELL:
all: sprite
clean:
rm *.svg *.json *.png 2>/dev/null
svg:
while read svg _ _ url; do
curl $$url | sed '/stroke="#000000"/d' >$$svg
@typebrook
typebrook / index.html
Last active July 27, 2020 02:19
大屯九連峰 #hike #gpx #磐石
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Display a map</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://api.mapbox.com/mapbox-gl-js/v1.11.1/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v1.11.1/mapbox-gl.css" rel="stylesheet" />
<style>
body { margin: 0; padding: 0; }
@typebrook
typebrook / README.md
Last active November 21, 2020 03:59
quick script for 黃超群 #script #rescue #jq

轉換 NetMonster 資料

產製GeoJSON

  1. 下載本頁面下方的ntm2geojson.exe(點選Raw按鈕)
  2. 將JSON格式檔案和exe檔案放在同一資料夾
  3. 點兩下exe檔案,產生出新的.geojson檔案

檢視地圖

可至下列網站點選open,將GeoJSON格式檔案上傳,以在地圖中檢視
http://geojson.io

@typebrook
typebrook / README.md
Last active July 26, 2020 16:19
Merge all <trkseg> into a single <trk> in gpx file. Donload exe file at https://git.io/JfQeW #sed #gpx #track #trk #trkseg #bat #磐石

Make .EXE file on Windows for GPX track merging

  1. Get bat-to-ext-converter and sed
  2. Open bat-to-ext-converter, and wrap merge.bat, sed.exe, merge.sed into a single exe file
  3. Run signtool /a /tr http://tsa.starfieldtech.com merge.exe to sign exe file
@typebrook
typebrook / github.graphql
Last active July 30, 2022 23:59
A simple github graphql example to fetch user gists #graphql #wip
curl -d @- -X POST --header "Authorization: token $(token github)" https://api.github.com/graphql <<EOF
{
"query": "{
user(login: \"typebrook\") {
gists(last: 50) {
nodes {
isPublic
resourcePath
description
stargazerCount
@typebrook
typebrook / sh
Last active August 17, 2020 06:34
Sync 2 files between different git repos with blob object #script #git #sync
#!/usr/bin/env bash
target=$(cd $(dirname $1) && git rev-parse --show-toplevel)
cd $target
file=${1#$target/}
anchor=$(git rev-parse HEAD:$file)
cd $2
if ! git cat-file -e $anchor 2>/dev/null; then
echo $anchor not found
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 8 columns, instead of 7. in line 9.
圖號,行政區1,行政區2,行政區3,起始頁,結束頁,新頁碼,連結
1916-1,澎湖縣,,,2,3,6,https://map.happyman.idv.tw/~happyman/cv/comicview.php?filename=.%2Fcontents/TW3.zip#&gid=1&pid=6
1917-2,澎湖縣,,,4,5,7,https://map.happyman.idv.tw/~happyman/cv/comicview.php?filename=.%2Fcontents/TW3.zip#&gid=1&pid=7
2017-4,澎湖縣,,,6,19,8,https://map.happyman.idv.tw/~happyman/cv/comicview.php?filename=.%2Fcontents/TW3.zip#&gid=1&pid=8
2018-3,澎湖縣,,,20,21,15,https://map.happyman.idv.tw/~happyman/cv/comicview.php?filename=.%2Fcontents/TW3.zip#&gid=1&pid=15
2114-1,高雄縣,屏東縣,高雄市,22,38,16,https://map.happyman.idv.tw/~happyman/cv/comicview.php?filename=.%2Fcontents/TW3.zip#&gid=1&pid=16
2114-2,高雄縣,屏東縣,,38,45,24,https://map.happyman.idv.tw/~happyman/cv/comicview.php?filename=.%2Fcontents/TW3.zip#&gid=1&pid=24
2115-1,高雄縣,台南縣,,46,66,28,https://map.happyman.idv.tw/~happyman/cv/comicview.php?filename=.%2Fcontents/TW3.zip#&gid=1&pid=28
2115-2,高雄縣,屏東縣,,66,90,38,https://map.happyman.idv.tw/~happyman/cv/comicview.php?filename=.%2Fcontents/TW3.zip#&gid=1&pid=38
2115-3,高雄縣,,,90,92,
@typebrook
typebrook / Makefile
Last active July 30, 2022 23:59
[gov-data] Address location in Tainan, thanks kiang! #gov #data #addr #csv
all: 108.csv output.csv output.geojson
# CSV file for address in Tainan
# see dataset at web page: https://data.tainan.gov.tw/dataset/108-address-location
108.csv:
curl -LO https://data.tainan.gov.tw/dataset/32d604ed-9c9e-4d12-9c55-d33b1bb5fd60/resource/2389d5b2-451b-4b6a-b808-d2803717b196/download/108.csv
# Transform from TWD97 to EPSG:4326
# see GDAL release page: https://gdal.org/download.html
# and doc for CSV driver: https://gdal.org/drivers/vector/csv.html
@typebrook
typebrook / layer.list.md
Last active April 26, 2020 10:24
[tilemaker] Note for mvt layers with OMT compability #tilemaker #omt #mbtiles #mvt

TODO

  • Add functions into docs (osm_lua_processing.cpp)
    • Area
    • Length
    • Holds
    • IsClosed
    • ScaleToMeter
    • ScaleToKiloMeter
    • Length
  • Set OSM IDs
@typebrook
typebrook / github-release.sh
Last active August 12, 2021 08:08
[Github-release] A script manages release note or its asset with GitHub API v3 #github #release #curl #asset
#!/usr/bin/env sh
#
# Author: Hsieh Chin Fan (typebrook) <typebrook@gmail.com>
# License: MIT
# https://gist.github.com/typebrook/4947769e266173303d8848f496e272c9
#
# Originally created by stefanbuck
# fork from: https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
# --