All your notes, scripts, config files and snippets deserve version control and tagging!
gist is a simple bash script for gist management.
It is lightweight(~700LOC) and dependency-free! Helps you to boost coding workflow.
This file contains hidden or 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
| SHELL := /bin/bash | |
| data/taiwan-latest.osm.pbf: | |
| mkdir -p data | |
| curl -o $@ http://download.geofabrik.de/asia/taiwan-latest.osm.pbf | |
| data/village.zip: | |
| mkdir -p data | |
| curl -o $@ 'https://whgis.nlsc.gov.tw/DownlaodFiles.ashx?oid=1008&path=Opendata/OpendataFiles/OFiles_71ae710e-fe25-4649-ab9c-779921dd02fb.zip' |
This file contains hidden or 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
| curl https://api.github.com/authorizations \ | |
| --user "typebrook" \ | |
| --data '{"scopes":["gist"], "note": "gist"}' | |
| read -p "2-factor code: " OTP | |
| curl https://api.github.com/authorizations \ | |
| --user typebrook -H "X-GitHub-OTP: $OTP" \ | |
| --data '{"scopes": ["gist"], "note": "gist"}' |
This file contains hidden or 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
| #.PHONY: road.[^g]* | |
| BUFFER = 10 | |
| all: overlapped.geojson | |
| taiwan-latest.osm.pbf: | |
| curl -o $@ http://download.geofabrik.de/asia/taiwan-latest.osm.pbf | |
| clean: |
This file contains hidden or 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 | |
| paste <(jq '.geometry.coordinates[]' $1 -c | sed -r 's/\[|\]//g' \ | |
| |sed -r 's/^([^,]+),([^,]+),.*/<trkpt lat="\2" lon="\1">/') \ | |
| <(jq '.properties.AbsoluteUtcMicroSec[]' $1 \ | |
| | sed -r 's/(.*)(.{3})$$/\1,\2/' \ | |
| | xargs -I time date -d @time +"%Y-%m-%dT%H:%M:%S") |\ | |
| # If you want to keep points at the same seconds, comment out the next line | |
| uniq -f3 |\ | |
| sed -r 's/\t(.*)/<time>\1<\/time><\/trkpt>/' |\ |
This file contains hidden or 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
| all: detail-layers detail-cats | |
| MOI_OSM.xml: | |
| curl -o $@ https://raw.githubusercontent.com/alpha-rudy/taiwan-topo/master/styles/mapsforge_style/MOI_OSM.xml | |
| rudymap.json: MOI_OSM.xml | |
| xq . <$< >$@ | |
| layers: rudymap.json | |
| @jq -r '.rendertheme.stylemenu.layer | map(select(has("overlay"))) + map(select(has("overlay") | not)) | .[] | .["@id"]' $< | tee $@ |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="zh-Hant"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| <meta name="description" content="Geo Locationing Service"> | |
| <meta name="author" content="Edwin Wang"> | |
| <meta property="og:title" content="FindMe 座標定位" /> | |
| <meta property="og:description" content="透過網頁提供座標定位服務"> | |
| <meta property="og:type" content="website" /> |
This file contains hidden or 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
| # stop postgres | |
| sudo pkill -u postgres | |
| # launch a postgis container with default user "postgres" | |
| docker run --name rex -e POSTGRES_PASSWORD=rex -d mdillon/postgis | |
| # into psql with identity postgres | |
| docker run -it --link rex:postgres --rm mdillon/postgis sh -c 'exec psql -h rex -p 5432 -U postgres' sh -c 'exec psql -h rex -p 5432 -U postgres' | |
| # launch a postgis container with db called rex |
This file contains hidden or 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
| { | |
| "options": { | |
| "paths": { | |
| "root": "", | |
| "fonts": "glyphs", | |
| "sprites": "sprites", | |
| "styles": "styles", | |
| "mbtiles": "data" | |
| }, | |
| "formatEncoding": { |
This file contains hidden or 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
| 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 |