Skip to content

Instantly share code, notes, and snippets.

View typebrook's full-sized avatar

Hsieh Chin Fan typebrook

View GitHub Profile
@typebrook
typebrook / README.md
Last active June 19, 2024 05:55
A bash script for gist management #bash #gist
@typebrook
typebrook / DownloadProgressLiveData.kt
Created April 19, 2021 15:03 — forked from FhdAlotaibi/DownloadProgressLiveData.kt
Observe Download manager progress using LiveData and Coroutine #android #kotlin #livedata
data class DownloadItem(
val bytesDownloadedSoFar: Long = -1,
val totalSizeBytes: Long = -1,
val status: Int,
val uri: String
)
class DownloadProgressLiveData(private val activity: Activity) :
LiveData<List<DownloadItem>>(),
CoroutineScope {
@typebrook
typebrook / MBTilesServer.kt
Last active January 12, 2024 08:46
How to make MBTiles valid on Mapbox Android SDK #mbtiles #android #mapbox
package com.example.sample.offline
import android.util.Log
import java.io.BufferedReader
import java.io.ByteArrayOutputStream
import java.io.FileNotFoundException
import java.io.PrintStream
import java.net.ServerSocket
import java.net.Socket
import kotlin.math.pow
@typebrook
typebrook / .env.template
Last active October 31, 2023 07:01
Docker Compose for nginx and gitea
GITEA_DATA_DIR=/tmp/gitea
input/
output/
upload/
**/.git
@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 February 25, 2023 11:32
A simple script to upload OsmChange file #osm #changeset #script

Upload OsmChange file with script

Usage

# By default, changeset would be uploaded to test server: 
# https://master.apis.dev.openstreetmap.org
./osm.api.changeset.commit <OSC FILE>

# Use --serious to upload changeset to normal OSM server
./osm.api.changeset.commit --serious <OSC FILE>
@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' $^