diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2022-10-24 13:25:53 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2022-10-24 14:59:31 +0800 |
| commit | fdee2359aa6cb1d64d803a6004e176aa506ac04c (patch) | |
| tree | 00728dd9da46b3000c0432e8dc9896adcde2d660 /alias | |
| parent | aaa39d7c26ad7eeb552ae37b3fc83fb186ca7c29 (diff) | |
Update image functions
Diffstat (limited to 'alias')
| -rw-r--r-- | alias | 16 |
1 files changed, 14 insertions, 2 deletions
| @@ -192,7 +192,13 @@ vp() { | |||
| 192 | fi | 192 | fi |
| 193 | 193 | ||
| 194 | shift | 194 | shift |
| 195 | eval $PREFIX vim $@ "$post" | 195 | if [[ $HOST = vultr ]]; then |
| 196 | vim $@ "$post" | ||
| 197 | else | ||
| 198 | tmpfile=$(mktemp) | ||
| 199 | scp vps:"$post" $tmpfile | ||
| 200 | vim $tmpfile && scp $tmpfile vps:"$post" && rm $tmpfile | ||
| 201 | fi | ||
| 196 | } | 202 | } |
| 197 | 203 | ||
| 198 | # git | 204 | # git |
| @@ -350,7 +356,7 @@ alias sample.mbtiles='curl -O https://docs.mapbox.com/help/data/trails.mbtiles' | |||
| 350 | alias sample.kml='curl -O https://docs.mapbox.com/help/data/farmers_markets.kml' | 356 | alias sample.kml='curl -O https://docs.mapbox.com/help/data/farmers_markets.kml' |
| 351 | alias sample.osm='curl https://api.openstreetmap.org/api/0.6/node/3428095932' | 357 | alias sample.osm='curl https://api.openstreetmap.org/api/0.6/node/3428095932' |
| 352 | alias sample.poly='curl -O http://download.geofabrik.de/asia/taiwan.poly' | 358 | alias sample.poly='curl -O http://download.geofabrik.de/asia/taiwan.poly' |
| 353 | alias sample.image='curl -O https://file-examples-com.github.io/uploads/2017/10/file_example_JPG_100kB.jpg' | 359 | alias sample.image='curl -O https://file-examples.com/storage/fe4b4c6261634c76e91986b/2017/10/file_example_JPG_100kB.jpg' |
| 354 | alias sample.gpkg='curl -O http://www.geopackage.org/data/sample1_1.gpkg' | 360 | alias sample.gpkg='curl -O http://www.geopackage.org/data/sample1_1.gpkg' |
| 355 | alias sample.mvt='curl -O https://demotiles.maplibre.org/tiles/5/25/14.pbf' | 361 | alias sample.mvt='curl -O https://demotiles.maplibre.org/tiles/5/25/14.pbf' |
| 356 | alias sample.mp4='curl -O https://jsoncompare.org/LearningContainer/SampleFiles/Video/MP4/Sample-MP4-Video-File-Download.mp4' | 362 | alias sample.mp4='curl -O https://jsoncompare.org/LearningContainer/SampleFiles/Video/MP4/Sample-MP4-Video-File-Download.mp4' |
| @@ -406,6 +412,12 @@ image.from_data_url() { | |||
| 406 | xsel -ob | sed -E 's/^.+,//' | base64 -d >$1 | 412 | xsel -ob | sed -E 's/^.+,//' | base64 -d >$1 |
| 407 | identify $1 | 413 | identify $1 |
| 408 | } | 414 | } |
| 415 | image.upload() { | ||
| 416 | month=$(date +%Y-%m) | ||
| 417 | filename=$(date +"%d_%Hh%Mm%Ss").${1##*.} | ||
| 418 | scp $1 vps:~/data/s3.photos/$month/$filename | ||
| 419 | echo https://topo.tw/photos/$month/$filename | ||
| 420 | } | ||
| 409 | image.text() { | 421 | image.text() { |
| 410 | convert \ | 422 | convert \ |
| 411 | -size 230x130 \ | 423 | -size 230x130 \ |