test test test

This commit is contained in:
2018-06-30 00:42:03 +04:00
parent a2e432b0b5
commit aecd512e37

View File

@@ -41,6 +41,7 @@ alias .gs='.g status -uno'
alias .gp='.g commit -am "auto" && .g push' alias .gp='.g commit -am "auto" && .g push'
alias p="perl -pe" alias p="perl -pe"
alias p0="perl -0pe"
alias -g LATEST='*(om[1])' alias -g LATEST='*(om[1])'
@@ -57,50 +58,81 @@ alias tmuxr="tmux new -ADs auto-session"
# ===== FUNCTIONS ===== # ===== FUNCTIONS =====
function publish() { alias FUNCTION_PRELUDE="setopt LOCAL_OPTIONS PIPE_FAIL XTRACE ERR_RETURN"
rsyncc $@ "dedi:/var/www/abra.me/list/"
publish() {
FUNCTION_PRELUDE
rsync2 "$@" "dedi:/var/www/abra.me/list/"
} }
function publishwhere() { twitch() {
rsyncc ${@:2} "dedi:/var/www/abra.me/$1" FUNCTION_PRELUDE
livestreamer "http://www.twitch.tv/${1}" "${${@:2}:-best}"
} }
function twitch() { test_default() {
local arg=${@:2} # echo "${@:-$(whoami) at $(date)}"
local arg=${arg:-best}
livestreamer "http://www.twitch.tv/$1" $arg for i in $@; do
echo "[$i]"
done
} }
function dcp() { test_default2() {
local arg=$@ test_default git commit -m "${@:-$(whoami) at $(date)}"
test_default .g commit -m "${@:-$(whoami) at $(date)}"
if [[ -z $arg ]]; then test_default .g commit -m "${@:-$(whoami) at $(date)}"
local arg="$(whoami) at $(date)"
fi
a || return 1
git commit -m "$arg" || return 1
git push || return 1
} }
function strip-tags() { dcp() {
FUNCTION_PRELUDE
git add --all :/
git commit -m "${@:-$(whoami) at $(date)}"
git push
}
.dcp() {
FUNCTION_PRELUDE
local COMMIT_MESSAGE="${@:-$(whoami) at $(date)}"
.g add -u
.g commit -m "$COMMIT_MESSAGE"
.g push
}
strip-tags() {
FUNCTION_PRELUDE
find . -type f -name '*.mp3' \ find . -type f -name '*.mp3' \
| tr '\n' '\0' \ | tr '\n' '\0' \
| xargs -0 -n1 mid3v2 --delete-frames=TXXX,USLT,TIPL,UFID,APIC,TBPM,TCMP,TDOR,TDRC,TLAN,TMED,TPOS,TPUB,TRCK,TCON | xargs -0 -n1 mid3v2 --delete-frames=TXXX,USLT,TIPL,UFID,APIC,TBPM,TCMP,TDOR,TDRC,TLAN,TMED,TPOS,TPUB,TRCK,TCON
} }
function dedi-beet() { dedi-beet() {
ssh dedi -- sudo -u torrent-user beet $@ FUNCTION_PRELUDE
ssh dedi -- sudo -u torrent-user beet "$@"
} }
function beet-comments() { beet-comments() {
FUNCTION_PRELUDE
: "${1:?who?}"
: "${2:?what?}"
dedi-beet modify "comments='$2'" "albumartist:'$1'" dedi-beet modify "comments='$2'" "albumartist:'$1'"
} }
function rsync2() { rsync2() {
#rsync -rzPh -u --no-W
rsync \ rsync \
--info=PROGRESS2 \ --info=PROGRESS2 \
--progress \ --progress \
@@ -115,80 +147,61 @@ function rsync2() {
--stats \ --stats \
--fuzzy \ --fuzzy \
--verbose \ --verbose \
$@ "$@"
} }
function sync-music() { sync_music() {
FUNCTION_PRELUDE
rsync2 --delete dedi:/home/torrent-user/music-library/ /Users/abra/music/library/ rsync2 --delete dedi:/home/torrent-user/music-library/ /Users/abra/music/library/
} }
function .g-init() { # function .g-init() {
git init --bare $HOME/.dotgit # git init --bare $HOME/.dotgit
.g config --local status.showUntrackedFiles no # .g config --local status.showUntrackedFiles no
.g remote add origin ssh://dedi/root/.dotgit # .g remote add origin ssh://dedi/root/.dotgit
git config --global user.name "Your Name" # git config --global user.name "Your Name"
git config --global user.email you@example.com # git config --global user.email you@example.com
.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
} # }
function is_local() { is_local() {
[[ $(hostname) =~ '^abra0' ]] [[ $(hostname) =~ '^abra0' ]]
} }
function make_user() { # make_user() {
if is_local; then # FUNCTION_PRELUDE
echo "You're local"
return 1
fi
adduser --system --shell /bin/zsh --disabled-password $1 || return 1 # if is_local; then
# echo "You're local"
# return 1
# fi
wget abra.me/.dotfiles.tar.gz -O /home/$1/.dotfiles.tar.gz # adduser --system --shell /bin/zsh --disabled-password $1 || return 1
tar xf /home/$1/.dotfiles.tar.gz -C /home/$1
chown $1:nogroup -R /home/$1/
}
function latest() { # # wget abra.me/.dotfiles.tar.gz -O /home/$1/.dotfiles.tar.gz
echo -n ("${(@f)$(ls *(om[1,$1]))}") # # tar xf /home/$1/.dotfiles.tar.gz -C /home/$1
} # # chown $1:nogroup -R /home/$1/
# }
function testo() { # function latest() {
# set -eux # echo -n ("${(@f)$(ls *(om[1,$1]))}")
# set -o pipefail # }
# set -exo pipefail
setopt ERR_RETURN
d
sadsa
ls
}
function testo2() {
# set -eux
# set -o pipefail
# set -exo pipefail
sadsa
ls
}
function ffmpeg_timelapse() { ffmpeg_timelapse() {
local DATE=$1 FUNCTION_PRELUDE
local PRESET=$2
if [[ -z $PRESET ]]; then local DATE="$1"
local PRESET="ultrafast" local PRESET="${2:-"ultrafast"}"
fi local REST="${@:3}"
ls /mnt/a/snaps/$DATE | wc -l || return (ls "/mnt/a/snaps/$DATE" | wc -l) || return
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" \
-y "/mnt/a/$DATE.mp4" -y "/mnt/a/$DATE.mp4"
} }