Skip to content

Instantly share code, notes, and snippets.

View LImoritakeU's full-sized avatar
🏠
Working from home

ShihHao Liu LImoritakeU

🏠
Working from home
View GitHub Profile
@LImoritakeU
LImoritakeU / airtag-to-gpx-sync.sh
Created December 2, 2022 22:59 — forked from henrik242/airtag-to-gpx-sync.sh
Read AirTag data from the FindMy.app cache and convert to GPX
#!/usr/bin/env bash
#
# Reads AirTag data from the FindMy.app cache and converts it to a daily GPX file
#
# Rsyncs the data to a web accessible folder that can be displayed with e.g.
# https://gist.github.com/henrik242/84ad80dd2170385fe819df1d40224cc4
#
# This should typically be run as a cron job
#
@LImoritakeU
LImoritakeU / postgres_CE_to_ROC_date.sql
Last active November 2, 2020 20:59
西元轉民國 SQL function
西元紀年改民國, 格式為七碼數字,民國100年前添加'0'前綴
CREATE OR REPLACE FUNCTION pg_temp.AD_to_formatted_ROC(date) RETURNS TEXT AS
$$
SELECT LPAD(
REPLACE(
REPLACE(
$1::text, to_char($1, 'YYYY'), (to_char($1, 'YYYY')::integer-1911)::TEXT
), '-', ''
), 7, '0')
;