svxf at Wed Aug 8 13:28:18 MSK 2018
This commit is contained in:
@@ -60,173 +60,3 @@ 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() {
|
|
||||||
FUNCTION_PRELUDE
|
|
||||||
|
|
||||||
rsync2 "$@" "dedi:/var/www/abra.me/list/"
|
|
||||||
}
|
|
||||||
|
|
||||||
twitch() {
|
|
||||||
FUNCTION_PRELUDE
|
|
||||||
|
|
||||||
livestreamer "http://www.twitch.tv/${1}" "${${@:2}:-best}"
|
|
||||||
}
|
|
||||||
|
|
||||||
dcp() {
|
|
||||||
FUNCTION_PRELUDE
|
|
||||||
|
|
||||||
git add --all :/
|
|
||||||
|
|
||||||
git commit -m "${*:-$(whoami) at $(date)}"
|
|
||||||
|
|
||||||
git push
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.dcp() {
|
|
||||||
FUNCTION_PRELUDE
|
|
||||||
|
|
||||||
.g add -u
|
|
||||||
|
|
||||||
.g commit -m "${*:-$(whoami) at $(date)}"
|
|
||||||
|
|
||||||
.g push
|
|
||||||
}
|
|
||||||
|
|
||||||
strip-tags() {
|
|
||||||
FUNCTION_PRELUDE
|
|
||||||
|
|
||||||
find . -type f -name '*.mp3' \
|
|
||||||
| tr '\n' '\0' \
|
|
||||||
| xargs -0 -n1 mid3v2 --delete-frames=TXXX,USLT,TIPL,UFID,APIC,TBPM,TCMP,TDOR,TDRC,TLAN,TMED,TPOS,TPUB,TRCK,TCON
|
|
||||||
}
|
|
||||||
|
|
||||||
dedi-beet() {
|
|
||||||
FUNCTION_PRELUDE
|
|
||||||
|
|
||||||
ssh dedi -- sudo -u torrent-user beet "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
beet-comments() {
|
|
||||||
FUNCTION_PRELUDE
|
|
||||||
|
|
||||||
: "${1:?who?}"
|
|
||||||
: "${2:?what?}"
|
|
||||||
|
|
||||||
dedi-beet modify \'"comments=$2"\' \'"albumartist::$1"\'
|
|
||||||
}
|
|
||||||
|
|
||||||
rsync2() {
|
|
||||||
rsync \
|
|
||||||
--info=PROGRESS2 \
|
|
||||||
--progress \
|
|
||||||
--recursive \
|
|
||||||
--compress \
|
|
||||||
--human-readable \
|
|
||||||
--update \
|
|
||||||
--times \
|
|
||||||
--no-whole-file \
|
|
||||||
--itemize-changes \
|
|
||||||
--stats \
|
|
||||||
--verbose \
|
|
||||||
--links \
|
|
||||||
"${(@)@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
sync-music() {
|
|
||||||
FUNCTION_PRELUDE
|
|
||||||
|
|
||||||
# if ! is_local; then
|
|
||||||
# echo "Should be local"
|
|
||||||
# return 1
|
|
||||||
# fi
|
|
||||||
|
|
||||||
mkdir -p "$HOME/music/library"
|
|
||||||
|
|
||||||
rsync2 \
|
|
||||||
--delete \
|
|
||||||
"dedi:/home/torrent-user/music-library/" \
|
|
||||||
"$HOME/music/library/"
|
|
||||||
}
|
|
||||||
|
|
||||||
# function .g-init() {
|
|
||||||
# git init --bare $HOME/.dotgit
|
|
||||||
# .g config --local status.showUntrackedFiles no
|
|
||||||
# .g remote add origin ssh://dedi/root/.dotgit
|
|
||||||
# git config --global user.name "Your Name"
|
|
||||||
# git config --global user.email you@example.com
|
|
||||||
# .g remote add origin ssh://dedi/var/www/git.abra.me/dot.git
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
# make_user() {
|
|
||||||
# FUNCTION_PRELUDE
|
|
||||||
|
|
||||||
# if is_local; then
|
|
||||||
# echo "You're local"
|
|
||||||
# return 1
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# adduser --system --shell /bin/zsh --disabled-password $1 || return 1
|
|
||||||
|
|
||||||
# # wget abra.me/.dotfiles.tar.gz -O /home/$1/.dotfiles.tar.gz
|
|
||||||
# # tar xf /home/$1/.dotfiles.tar.gz -C /home/$1
|
|
||||||
# # chown $1:nogroup -R /home/$1/
|
|
||||||
# }
|
|
||||||
|
|
||||||
# function latest() {
|
|
||||||
# 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() {
|
|
||||||
FUNCTION_PRELUDE
|
|
||||||
|
|
||||||
local DATE="$1"
|
|
||||||
|
|
||||||
ls "/mnt/a/snaps/$DATE" | wc -l
|
|
||||||
|
|
||||||
ffmpeg \
|
|
||||||
-framerate 60 \
|
|
||||||
-pattern_type glob -i "/mnt/a/snaps/$DATE/*.jpg" \
|
|
||||||
"${@:2}" \
|
|
||||||
-y "/mnt/a/tmp/$DATE.mp4"
|
|
||||||
|
|
||||||
mv "/mnt/a/tmp/$DATE.mp4" "/mnt/a/$DATE.mp4"
|
|
||||||
|
|
||||||
rm -rf "/mnt/a/snaps/$DATE"
|
|
||||||
}
|
|
||||||
|
|
||||||
ffmpeg_timelapse_today() {
|
|
||||||
local TODAY=$(date '+%Y-%m-%d')
|
|
||||||
|
|
||||||
ffmpeg_timelapse "$TODAY" -preset ultrafast -crf 20
|
|
||||||
}
|
|
||||||
|
|
||||||
update_.g() {
|
|
||||||
local RES=$(.g pull 2>&1)
|
|
||||||
|
|
||||||
if [[ ! ($RES =~ "Already up.to.date") ]]; then
|
|
||||||
echo "Updated .g"
|
|
||||||
echo $RES
|
|
||||||
echo "======"
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
}
|
|
@@ -3,68 +3,32 @@ if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
|
|||||||
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
|
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unsetopt CORRECT
|
source ~/.zoptions
|
||||||
# Now we can pipe to multiple outputs!
|
|
||||||
setopt MULTIOS
|
|
||||||
# This makes cd=pushd
|
|
||||||
setopt AUTO_PUSHD
|
|
||||||
# This will use named dirs when possible
|
|
||||||
setopt AUTO_NAME_DIRS
|
|
||||||
# If we have a glob this will expand it
|
|
||||||
setopt GLOB_COMPLETE
|
|
||||||
# use magic (this is default, but it can't hurt!)
|
|
||||||
setopt ZLE
|
|
||||||
# setopt NO_HUP
|
|
||||||
# setopt IGNORE_EOF
|
|
||||||
# If I could disable Ctrl-s completely I would!
|
|
||||||
setopt NO_FLOW_CONTROL
|
|
||||||
# unsetopt normstarsilent
|
|
||||||
|
|
||||||
## Keep echo "station" > station from clobbering station
|
source ~/.zalias
|
||||||
#setopt NO_CLOBBER
|
|
||||||
setopt CLOBBER
|
|
||||||
|
|
||||||
# No ! voodoo
|
source ~/.zfunc
|
||||||
unsetopt bang_hist
|
|
||||||
|
|
||||||
# Case insensitive globbing
|
if [[ -s "$HOME/.iterm2_shell_integration.zsh" ]]; then
|
||||||
setopt NO_CASE_GLOB
|
source "$HOME/.iterm2_shell_integration.zsh"
|
||||||
# Be Reasonable!
|
|
||||||
setopt NUMERIC_GLOB_SORT
|
|
||||||
# I don't know why I never set this before.
|
|
||||||
setopt EXTENDED_GLOB
|
|
||||||
# hows about arrays be awesome? (that is, frew${cool}frew has frew surrounding all the variables, not just first and last
|
|
||||||
setopt RC_EXPAND_PARAM
|
|
||||||
# disable running directory names
|
|
||||||
unsetopt AUTO_CD
|
|
||||||
|
|
||||||
# return in functions if a command fails
|
|
||||||
# setopt ERR_RETURN
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Who doesn't want home and end to work?
|
|
||||||
bindkey '\e[1~' beginning-of-line
|
|
||||||
bindkey '\e[4~' end-of-line
|
|
||||||
|
|
||||||
bindkey "\eOH" beginning-of-line
|
|
||||||
bindkey "\eOF" end-of-line
|
|
||||||
|
|
||||||
|
|
||||||
. ~/.zalias
|
|
||||||
|
|
||||||
# ----------------------------------- END ALIASES --------------------------------------------------
|
|
||||||
export PATH="$HOME/bin/":$PATH
|
|
||||||
export PATH="$HOME/work/arcadia/":$PATH
|
|
||||||
|
|
||||||
|
|
||||||
if is_local; then
|
|
||||||
export PATH="$HOME/brew/sbin":"$HOME/brew/bin":$PATH
|
|
||||||
export DYLD_LIBRARY_PATH="/Developer/NVIDIA/CUDA-8.0/lib:/usr/local/cuda/lib"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
add_dir_to_path "$HOME/bin"
|
||||||
|
add_dir_to_path "$HOME/work/arcadia"
|
||||||
|
|
||||||
|
add_dir_to_path "$HOME/brew/sbin"
|
||||||
|
add_dir_to_path "$HOME/brew/bin"
|
||||||
|
|
||||||
|
|
||||||
|
# export PATH="$HOME/bin/":$PATH
|
||||||
|
# export PATH="$HOME/work/arcadia/":$PATH
|
||||||
|
|
||||||
|
|
||||||
|
# if is_local; then
|
||||||
|
# export PATH="$HOME/brew/sbin":"$HOME/brew/bin":$PATH
|
||||||
|
# export DYLD_LIBRARY_PATH="/Developer/NVIDIA/CUDA-8.0/lib:/usr/local/cuda/lib"
|
||||||
|
# fi
|
||||||
|
|
||||||
# update, background+disown
|
# update, background+disown
|
||||||
update_.g &!
|
update_.g &!
|
||||||
|
|
||||||
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user