diff options
Diffstat (limited to 'alias')
| -rw-r--r-- | alias | 35 |
1 files changed, 0 insertions, 35 deletions
| @@ -413,41 +413,6 @@ alias xii='`fc -ln -1` | head -1 | xsel -ib' | |||
| 413 | alias xo='xsel -ob' | 413 | alias xo='xsel -ob' |
| 414 | alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob' | 414 | alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob' |
| 415 | 415 | ||
| 416 | # image | ||
| 417 | image.vertical() { | ||
| 418 | suffix=${1##*.} | ||
| 419 | convert "$@" -append $(basename -s .$suffix $1)-$(basename -s .$suffix ${@: -1}).${format:-$suffix} | ||
| 420 | } | ||
| 421 | image.horizontal() { | ||
| 422 | ext=${1##*.} | ||
| 423 | convert "$@" +append output.$ext | ||
| 424 | } | ||
| 425 | image.from_data_url() { | ||
| 426 | [[ $1 == '' ]] && echo File name needed && return 1 | ||
| 427 | xsel -ob | sed -E 's/^.+,//' | base64 -d >$1 | ||
| 428 | identify $1 | ||
| 429 | } | ||
| 430 | image.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 | } | ||
| 438 | image.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 |
| 452 | date-reset() { | 417 | date-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" |