function rehaul

This commit is contained in:
2018-06-30 01:45:53 +04:00
parent aecd512e37
commit 75e4d26f39

View File

@@ -60,6 +60,10 @@ alias tmuxr="tmux new -ADs auto-session"
alias FUNCTION_PRELUDE="setopt LOCAL_OPTIONS PIPE_FAIL XTRACE ERR_RETURN" alias FUNCTION_PRELUDE="setopt LOCAL_OPTIONS PIPE_FAIL XTRACE ERR_RETURN"
is_local() {
[[ $(hostname) =~ '^abra0' ]]
}
publish() { publish() {
FUNCTION_PRELUDE FUNCTION_PRELUDE
@@ -72,26 +76,12 @@ twitch() {
livestreamer "http://www.twitch.tv/${1}" "${${@:2}:-best}" livestreamer "http://www.twitch.tv/${1}" "${${@:2}:-best}"
} }
test_default() {
# echo "${@:-$(whoami) at $(date)}"
for i in $@; do
echo "[$i]"
done
}
test_default2() {
test_default git commit -m "${@:-$(whoami) at $(date)}"
test_default .g commit -m "${@:-$(whoami) at $(date)}"
test_default .g commit -m "${@:-$(whoami) at $(date)}"
}
dcp() { dcp() {
FUNCTION_PRELUDE FUNCTION_PRELUDE
git add --all :/ git add --all :/
git commit -m "${@:-$(whoami) at $(date)}" git commit -m "${*:-$(whoami) at $(date)}"
git push git push
} }
@@ -100,11 +90,9 @@ dcp() {
.dcp() { .dcp() {
FUNCTION_PRELUDE FUNCTION_PRELUDE
local COMMIT_MESSAGE="${@:-$(whoami) at $(date)}"
.g add -u .g add -u
.g commit -m "$COMMIT_MESSAGE" .g commit -m "${*:-$(whoami) at $(date)}"
.g push .g push
} }
@@ -147,13 +135,21 @@ rsync2() {
--stats \ --stats \
--fuzzy \ --fuzzy \
--verbose \ --verbose \
"$@" "${(@)@}"
} }
sync_music() { sync_music() {
FUNCTION_PRELUDE FUNCTION_PRELUDE
rsync2 --delete dedi:/home/torrent-user/music-library/ /Users/abra/music/library/ if ! is_local; then
echo "Should be local"
return 1
fi
rsync2 \
--delete \
"dedi:/home/torrent-user/music-library/" \
"/Users/abra/music/library/"
} }
# function .g-init() { # function .g-init() {
@@ -165,9 +161,6 @@ sync_music() {
# .g remote add origin ssh://dedi/var/www/git.abra.me/dot.git # .g remote add origin ssh://dedi/var/www/git.abra.me/dot.git
# } # }
is_local() {
[[ $(hostname) =~ '^abra0' ]]
}
# make_user() { # make_user() {
# FUNCTION_PRELUDE # FUNCTION_PRELUDE
@@ -188,20 +181,33 @@ is_local() {
# echo -n ("${(@f)$(ls *(om[1,$1]))}") # echo -n ("${(@f)$(ls *(om[1,$1]))}")
# } # }
testo() {
local A="${@[2,3]}"
./t.py ${(t)A} "$A" ${A[@]}
unset A
local A=("$@[2,3]")
./t.py ${(t)A} "$A" ${A[@]}
unset A
./t.py "$@[2,3]"
}
# testo 1 "2 3" 4
# shit shit shit s hist h is htisthsi 2018-06-30
ffmpeg_timelapse() { ffmpeg_timelapse() {
FUNCTION_PRELUDE FUNCTION_PRELUDE
local DATE="$1" local DATE="$1"
local PRESET="${2:-"ultrafast"}" local PRESET="${2:-"ultrafast"}"
local REST="${@:3}" local REST=("${@:3}")
(ls "/mnt/a/snaps/$DATE" | wc -l) || return ls "/mnt/a/snaps/$DATE" | wc -l
ffmpeg \ ffmpeg \
-framerate 60 \ -framerate 60 \
-pattern_type glob -i "/mnt/a/snaps/$DATE/*.jpg" \ -pattern_type glob -i "/mnt/a/snaps/$DATE/*.jpg" \
-preset "$PRESET" \ -preset "$PRESET" \
"$REST" \ "${(@)REST}" \
-y "/mnt/a/$DATE.mp4" -y "/mnt/a/$DATE.mp4"
} }