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
Created February 20, 2023 04:29
Print ics parts of Taiwan holidays from open data #gov #ics #icalendar
.ONESHELL:
# https://data.gov.tw/dataset/14718
data.csv:
curl -L 'https://www.dgpa.gov.tw/FileConversion?filename=dgpa/files/202206/d52179b9-5e82-489b-86fd-716e959bfa5c.csv&nfix=&name=112%e5%b9%b4%e4%b8%ad%e8%8f%af%e6%b0%91%e5%9c%8b%e6%94%bf%e5%ba%9c%e8%a1%8c%e6%94%bf%e6%a9%9f%e9%97%9c%e8%be%a6%e5%85%ac%e6%97%a5%e6%9b%86%e8%a1%a8.csv' | \
iconv -f BIG-5 -t UTF-8 | \
dos2unix >$@
clean: data.csv
sed -i '1d; /,$$/d' $^
@typebrook
typebrook / mermaid.md
Created September 15, 2022 03:58
Test mermaid diagram
gantt
dateFormat  YYYY-MM-DD
title Adding GANTT diagram to mermaid
excludes weekdays 2014-01-10

section A section
Completed task            :done,    des1, 2014-01-06,2014-01-08
Active task               :active,  des2, 2014-01-09, 3d
Future task : des3, after des2, 5d
@typebrook
typebrook / .gitignore
Last active July 30, 2022 03:22
Slide for coscup 2022
dist/
plugin/
css/
*.html
assets/
@typebrook
typebrook / .env.template
Last active February 4, 2023 02:15
Invoice API
CARD_TYPE=
CARD_NO=
APPID=
CARD_ENCRYPT=
input/
output/
upload/
**/.git
@typebrook
typebrook / Makefile
Created May 15, 2022 05:24
Panorama solution with hugin
.ONESHELL:
all:
GID=`getent group gitea | cut -d: -f3` \
docker-compose up -d
down:
GID=`getent group gitea | cut -d: -f3` \
docker-compose down
install:
sudo systemctl enable gitea.service
@typebrook
typebrook / .gitignore
Last active April 15, 2023 09:10
Panorama solution2 for insta360 images (deprecated)
*.insp
*.jpg
@typebrook
typebrook / Makefile
Created May 5, 2022 04:06
Panorama solution for insta360 images (deprecated)
.ONESHELL:
test: xmap.pgm ymap.pgm
ffmpeg -y -i test.jpg -i xmap.pgm -i ymap.pgm -filter_complex remap out.jpg
exiftool -UsePanoramaViewer=TRUE -ProjectionType="equirectangular" out.jpg
which SimplePanoramaViewer 2>/dev/null && SimplePanoramaViewer out.jpg
pgm: dualfisheye2equirectangular
cd $<
gcc -o projection projection.c -lm
@typebrook
typebrook / README.md
Last active June 2, 2022 07:57
1922 SMS message statistics
# Backup telephony data as telephony.ab
adb backup -apk com.android.providers.telephony -f telephony.ab &>/dev/null

# Extract .ab file with tail, pigz and tar
# Notice we need to ignore the first 24 bytes and then fo decoding
tail -c +25 telephony.ab | pigz -d | tar -xf -

# Get JSON data with files: XXXXXXsms_backup
for sms in **/*sms_backup; do 
@typebrook
typebrook / cnn_news.sh
Last active January 4, 2023 13:26
Coninuouly print news from RSS
#! /bin/sh
RSS_URL=http://feeds.bbci.co.uk/news/rss.xml
#RSS_URL=http://feeds.bbci.co.uk/news/rss.xml
PRINT_INTERVAL=${PRING_INTERVAL:-30}
FETCH_INTERVAL=${FETCH_INTERVAL:-600}
RSS=$(mktemp)
LOCK=$(mktemp)