diff options
author | Hsieh Chin Fan <typebrook@gmail.com> | 2021-08-06 18:49:18 +0800 |
---|---|---|
committer | Hsieh Chin Fan <typebrook@gmail.com> | 2021-08-06 18:49:18 +0800 |
commit | 3c534bf7141b01fcd15101bedb599f32214f6a91 (patch) | |
tree | 238bdafe11e10c46efdfbf6db11dfbb2c6218d9e | |
parent | 2c6f6f675f33004f5ed99c094ba059d7c5b3f52e (diff) |
update
-rw-r--r-- | alias | 3 | ||||
-rwxr-xr-x | tools/misc/transfer.sh | 22 |
2 files changed, 24 insertions, 1 deletions
@@ -219,6 +219,8 @@ alias ptt='ssh bbsu@ptt.cc' | |||
219 | alias topo='ssh topo.tw' | 219 | alias topo='ssh topo.tw' |
220 | alias geothings-test='ssh geothings@test.geothings.tw' | 220 | alias geothings-test='ssh geothings@test.geothings.tw' |
221 | alias demo='ssh -i ~/.ssh/ec2-nlsc-tileservice.pem ubuntu@demo.geosurvey.io' | 221 | alias demo='ssh -i ~/.ssh/ec2-nlsc-tileservice.pem ubuntu@demo.geosurvey.io' |
222 | alias demo2='ssh -i ~/.ssh/ec2-nlsc-tileservice.pem ubuntu@dev.geosurvey.io' | ||
223 | alias cool='ssh pham@10.0.0.2' | ||
222 | 224 | ||
223 | # Android | 225 | # Android |
224 | alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_' | 226 | alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_' |
@@ -364,7 +366,6 @@ alias cdtrash='cd ~/.local/share/Trash' | |||
364 | trash() { | 366 | trash() { |
365 | mv $@ ~/.local/share/Trash | 367 | mv $@ ~/.local/share/Trash |
366 | } | 368 | } |
367 | transfer(){ if [ $# -eq 0 ];then echo "No arguments specified.\nUsage:\n transfer <file|directory>\n ... | transfer <file_name>">&2;return 1;fi;if tty -s;then file="$1";file_name=$(basename "$file");if [ ! -e "$file" ];then echo "$file: No such file or directory">&2;return 1;fi;if [ -d "$file" ];then file_name="$file_name.zip" ,;(cd "$file"&&zip -r -q - .)|curl --progress-bar --upload-file "-" "https://topo.tw/up/$file_name"|tee /dev/null,;else cat "$file"|curl --progress-bar --upload-file "-" "https://topo.tw/up/$file_name"|tee /dev/null;fi;else file_name=$1;curl --progress-bar --upload-file "-" "https://topo.tw/up/$file_name"|tee /dev/null;fi;} | ||
368 | 369 | ||
369 | # task | 370 | # task |
370 | alias tk='task' | 371 | alias tk='task' |
diff --git a/tools/misc/transfer.sh b/tools/misc/transfer.sh new file mode 100755 index 0000000..41fa6c9 --- /dev/null +++ b/tools/misc/transfer.sh | |||
@@ -0,0 +1,22 @@ | |||
1 | #! /bin/env sh | ||
2 | |||
3 | if [ $# -eq 0 ];then | ||
4 | echo "No arguments specified.\nUsage:\n transfer <file|directory>\n ... | transfer <file_name>">&2; | ||
5 | return 1; | ||
6 | fi; | ||
7 | if tty -s; then | ||
8 | file="$1"; file_name=$(basename "$file"); | ||
9 | if [ ! -e "$file" ]; then | ||
10 | echo "$file: No such file or directory">&2; | ||
11 | return 1; | ||
12 | fi; | ||
13 | if [ -d "$file" ];then | ||
14 | file_name="$file_name.zip" ,; | ||
15 | (cd "$file" && zip -r -q - .) | curl --progress-bar --upload-file "-" "https://topo.tw/up/$file_name" | tee /dev/null,; | ||
16 | else | ||
17 | cat "$file" | curl --progress-bar --upload-file "-" "https://topo.tw/up/$file_name" | tee /dev/null; | ||
18 | fi; | ||
19 | else | ||
20 | file_name=$1; | ||
21 | curl --progress-bar --upload-file "-" "https://topo.tw/up/$file_name" | tee /dev/null; | ||
22 | fi; | ||