This file contains 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 | |
# usage: gh2umap.sh directions.gpx > directions.geojson | |
# see http://newtoypia.blogspot.tw/2015/07/fs-biking.html | |
TMPDIR=/tmp/gh2umap-$$ | |
mkdir $TMPDIR | |
ogr2ogr -f geojson $TMPDIR/tr.geojson $1 tracks | |
jq '.features' $TMPDIR/tr.geojson > $TMPDIR/tracks.geojson | |
ogr2ogr -f geojson $TMPDIR/rp.geojson $1 route_points | |
opencc < $TMPDIR/rp.geojson | jq '.features | map(.properties+={_storage_options: {"iconClass": "Ball"}} | .properties.name=.properties.desc )' > $TMPDIR/route_points.geojson |
This file contains 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
#!/usr/bin/perl -w | |
# see http://newtoypia.blogspot.tw/2015/07/csv-geojson.html | |
$prev = 0; # was there any previous output? | |
print "[\n"; | |
while (<>) { | |
chomp; | |
next if (/^#/ or /^\s*$/); | |
@f = split /\s*,\s*/; | |
if (defined($F{lon}) and defined($F{lat})) { |
This file contains 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
title=zh_TW_test | |
author=ckhung | |
orientation=landscape |
This file contains 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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# http://newtoypia.blogspot.tw/2015/08/admin-boundary.html | |
# 「臺灣各級行政區域(縣市/鄉鎮/村里)邊界座標檔, 自選解析度、 存成 csv、 畫成 svg 」 | |
import json, argparse, sys, math, warnings | |
def area(coords): | |
n = len(coords) | |
if n < 3: |
This file contains 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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# http://newtoypia.blogspot.tw/2015/08/admin-boundary.html | |
# 「臺灣各級行政區域(縣市/鄉鎮/村里)邊界座標檔, 自選解析度、 存成 csv、 畫成 svg 」 | |
import json, argparse, sys, math, warnings | |
def ispoint(coords): | |
return isinstance(coords, list) and isinstance(coords[0], (int, long, float)) and len(coords)==2 |
This file contains 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
#!/usr/bin/perl -w | |
# http://newtoypia.blogspot.tw/2015/08/cordova-debug.html | |
# 徒手除錯 Cordova | |
$kw = ($ARGV[0] or "console"); | |
while (<STDIN>) { | |
if (m#console#i) { | |
print "\x1b[30;46m$_\x1b[m"; | |
} elsif (m#$kw#i) { | |
print "\x1b[31m$_\x1b[m"; | |
} elsif (not m#^[VDIW]/#) { |
This file contains 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
#!/usr/bin/python | |
# http://newtoypia.blogspot.com/2015/09/vector-tiles.html | |
# 用向量圖磚 (vector tiles) 自製陽春離線地圖 | |
import math, sys, argparse, os, re | |
def deg2tile_id(zoom,lon,lat): | |
lat_rad = math.radians(lat) | |
n = 2.0 ** zoom | |
xtile = int((lon + 180.0) / 360.0 * n) |
This file contains 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
#!/usr/bin/perl -w | |
# http://newtoypia.blogspot.com/2015/09/gmail-mbox.html | |
# 備份/清空 gmail, 以及命令列查詢/切割 mbox 格式檔案 | |
use MIME::Base64; | |
while (<STDIN>) { | |
foreach $kw (@ARGV) { | |
next unless (($line) = /^$kw:\s*(.*)/); | |
$line = decode_base64($1) | |
if $line =~ /=\?utf-8\?\w+\?(.*)/i; |
This file contains 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
#!/usr/bin/perl -wp | |
my @saved = (); | |
while (s#((['"]).*?\2)#<<toCammelSkip>>#) { | |
push @saved, $1; | |
} | |
while (/([a-z0-9]+)(_[a-z0-9]+)+/i) { | |
$cammelled = $orig = $&; | |
$cammelled =~ s/(_[a-z0-9]+)/$x=substr($1,1); "\u$x"/ieg; |
This file contains 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
<html> | |
<head> | |
</head> | |
<body> | |
<div id="main-content"> | |
</div> | |
<script type="text/javascript" src="d3.js"></script> | |
<script type="text/javascript" src="d3-legend.js"></script> | |
<script> | |
var canvas = d3.select('#main-content') |
OlderNewer