-
Notifications
You must be signed in to change notification settings - Fork 7
/
functions.zsh
68 lines (55 loc) · 1.42 KB
/
functions.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
autoload -Uz zmv
# make sudo respect aliases, the space does the trick
alias sudo='sudo '
alias vim='nvim'
alias vi='nvim'
alias grep="grep --color"
alias ls='ls --color=auto'
alias sc="systemctl"
alias jc="journalctl"
alias uu="udiskie-umount"
lspath () {
if [ "$1" = "${1##/}" ]; then
pathlist=(/ ${(s:/:)PWD} ${(s:/:)1})
else
pathlist=(/ ${(s:/:)1})
fi
allpaths=()
filepath=$pathlist[0]
shift pathlist
for i in $pathlist[@]; do
allpaths=($allpaths[@] $filepath)
filepath="${filepath%/}/$i"
done
allpaths=($allpaths[@] $filepath)
ls -ld "$allpaths[@]"
}
mkday() {
DIRNAME="$(date +'%Y%m%d')_$1"
echo $DIRNAME
mkdir $DIRNAME
cd $DIRNAME
cp /run/media/$USER/disk/DCIM/*/*(.) .
}
up() {
local name=$(uuidgen | cut -d- -f5)
local ext="txt"
local place="p"
if [ -n "$1" ]; then
ext="${1##*.}"
local ext_length="$(expr length "$ext")"
if [ "$ext_length" -ne 3 -a "$ext_length" -ne 4 ]; then
echo "$ext $ext_length"
echo "extensions should be 3 or 4!"
return 1
fi
place="f"
fi
if [ -n "$1" ]; then
scp "$1" verne:hiler.eu/$place/$name.$ext
else
ssh verne cat \> hiler.eu/$place/$name.$ext
fi
ssh verne chmod 644 hiler.eu/$place/$name.$ext
echo https://ivyl.gg/$place/$name.$ext
}