aboutsummaryrefslogtreecommitdiffhomepage
path: root/alias
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2023-03-20 09:48:56 +0800
committerHsieh Chin Fan <pham@topo.tw>2023-03-20 09:49:02 +0800
commit4e5eb615606bef1619071ef89d4b34c20a7ac625 (patch)
tree0ad75a3d0a1bcd6b6b16f28c3aeac659cfa14dc7 /alias
parenta3c048ab4dc5e6e480e0331ac682dd69376856dd (diff)
Move image utilities into bin/
Diffstat (limited to 'alias')
-rw-r--r--alias35
1 files changed, 0 insertions, 35 deletions
diff --git a/alias b/alias
index 6931902..2481990 100644
--- a/alias
+++ b/alias
@@ -413,41 +413,6 @@ alias xii='`fc -ln -1` | head -1 | xsel -ib'
413alias xo='xsel -ob' 413alias xo='xsel -ob'
414alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob' 414alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob'
415 415
416# image
417image.vertical() {
418 suffix=${1##*.}
419 convert "$@" -append $(basename -s .$suffix $1)-$(basename -s .$suffix ${@: -1}).${format:-$suffix}
420}
421image.horizontal() {
422 ext=${1##*.}
423 convert "$@" +append output.$ext
424}
425image.from_data_url() {
426 [[ $1 == '' ]] && echo File name needed && return 1
427 xsel -ob | sed -E 's/^.+,//' | base64 -d >$1
428 identify $1
429}
430image.upload() {
431 local month=$(date +%Y-%m)
432 local filename=${2:-$(date +"%d_%Hh%Mm%Ss").${1##*.}}
433 local fpath='$HOME/data/s3.photos/'$month
434 cat $1 | ssh vps "mkdir -p $fpath && cat >$fpath/$filename" && \
435 echo https://topo.tw/photos/$month/$filename || \
436 echo Fail to upload
437}
438image.text() {
439 convert \
440 -size 230x130 \
441 -background lightblue \
442 -font Noto-Sans-Bold \
443 -pointsize 25 \
444 -fill black \
445 -gravity Center \
446 caption:"${1:=foo}" \
447 -flatten \
448 "${2:=foo}".jpg
449}
450
451# Reset clock 416# Reset clock
452date-reset() { 417date-reset() {
453 sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z" 418 sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"