mirror of
https://github.com/notwa/rc
synced 2025-02-05 07:43:22 -08:00
add http file stuff; update sc accordingly
This commit is contained in:
parent
4cded095fe
commit
7caa55f2bc
4 changed files with 41 additions and 12 deletions
|
@ -144,3 +144,4 @@ unset cdrive
|
||||||
|
|
||||||
[ -e ~/sh/z/z.sh ] && . ~/sh/z/z.sh
|
[ -e ~/sh/z/z.sh ] && . ~/sh/z/z.sh
|
||||||
. ~/.streamcrap
|
. ~/.streamcrap
|
||||||
|
. ~/.ea
|
||||||
|
|
34
home/ea
Normal file
34
home/ea
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# remote file access (http file-sharing shenanigans)
|
||||||
|
|
||||||
|
_REMOTE_DOMAIN="https://eaguru.guru"
|
||||||
|
_REMOTE_DIR="t"
|
||||||
|
_REMOTE_AUTH="auth"
|
||||||
|
|
||||||
|
eahead() {
|
||||||
|
curl -I "$_REMOTE_DOMAIN/$_REMOTE_DIR/$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
eaput() {
|
||||||
|
curl -n -T "$1" "$_REMOTE_DOMAIN/$_REMOTE_AUTH/"
|
||||||
|
}
|
||||||
|
|
||||||
|
eamove() {
|
||||||
|
local src="$_REMOTE_DOMAIN/$_REMOTE_AUTH/$1"
|
||||||
|
local dst="$_REMOTE_DOMAIN/$_REMOTE_DIR/$2"
|
||||||
|
curl -n -X MOVE -H "Destination: $dst" "$src"
|
||||||
|
}
|
||||||
|
|
||||||
|
eacopy() {
|
||||||
|
local src="$_REMOTE_DOMAIN/$_REMOTE_AUTH/$1"
|
||||||
|
local dst="$_REMOTE_DOMAIN/$_REMOTE_DIR/$2"
|
||||||
|
curl -n -X COPY -H "Destination: $dst" "$src"
|
||||||
|
}
|
||||||
|
|
||||||
|
eadelete() {
|
||||||
|
curl -n -X DELETE "$_REMOTE_DOMAIN/$_REMOTE_AUTH/$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
alias eamv=eamove
|
||||||
|
alias eacp=eacopy
|
||||||
|
alias earm=eadelete
|
2
install
2
install
|
@ -101,7 +101,7 @@ PATH="${PATH:?No existing PATH}:$rc/sh"
|
||||||
|
|
||||||
backup_dir="$rc/backup-$(date '+%s')"
|
backup_dir="$rc/backup-$(date '+%s')"
|
||||||
|
|
||||||
for f in .bashrc .zshrc .-shrc .streamcrap .vimrc \
|
for f in .bashrc .zshrc .-shrc .streamcrap .ea .vimrc \
|
||||||
.inputrc .Xresources .screenrc .indent.pro .uncrustify.cfg; do
|
.inputrc .Xresources .screenrc .indent.pro .uncrustify.cfg; do
|
||||||
dotless "$f"
|
dotless "$f"
|
||||||
r="$rc/home/$REPLY"
|
r="$rc/home/$REPLY"
|
||||||
|
|
16
sh/sc
16
sh/sc
|
@ -1,8 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
: ${SC_DBD:="/home/$USER/Dropbox"}
|
. ~/.ea
|
||||||
: ${SC_DBS:="$SC_DBD/Public/screenshots"}
|
|
||||||
: ${SC_DBT:="$SC_DBD/Public/temp"}
|
|
||||||
: ${SC_DOM:="https://eaguru.guru"}
|
|
||||||
|
|
||||||
sc_shorten() {
|
sc_shorten() {
|
||||||
REPLY="${1:2:2}${1:5:2}${1:8:2}${1:11:12}"
|
REPLY="${1:2:2}${1:5:2}${1:8:2}${1:11:12}"
|
||||||
|
@ -20,23 +17,20 @@ copy_scr() {
|
||||||
local r='20\d\d-\d\d-\d\d_\d\d\d\d\d\d\d\d.(png|jpg)'
|
local r='20\d\d-\d\d-\d\d_\d\d\d\d\d\d\d\d.(png|jpg)'
|
||||||
grep -Pq "$r" <<<"$short" || return 1
|
grep -Pq "$r" <<<"$short" || return 1
|
||||||
|
|
||||||
cp "$fn" "$SC_DBS/"
|
eaput "$fn" "$short"
|
||||||
sc_shorten "$short"
|
sc_shorten "$short"
|
||||||
uri_encode "$REPLY"
|
uri_encode "$REPLY"
|
||||||
REPLY="$SC_DOM/s/$REPLY"
|
REPLY="$_REMOTE_DOMAIN/s/$REPLY"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_tmp() {
|
copy_tmp() {
|
||||||
local fn="$1"
|
local fn="$1"
|
||||||
local dlen=${#SC_DBT}
|
|
||||||
if [ "${fn:0:dlen}" != "${SC_DBT}" ]; then
|
|
||||||
cp "$fn" "$SC_DBT/"
|
|
||||||
fi
|
|
||||||
local short="$(basename "$fn")"
|
local short="$(basename "$fn")"
|
||||||
|
|
||||||
|
eaput "$fn" "$short"
|
||||||
uri_encode "$short"
|
uri_encode "$short"
|
||||||
REPLY="$SC_DOM/t/$REPLY"
|
REPLY="$_REMOTE_DOMAIN/t/$REPLY"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue