forgot to add
This commit is contained in:
186
.zfunc
Normal file
186
.zfunc
Normal file
@@ -0,0 +1,186 @@
|
||||
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
|
||||
}
|
||||
|
||||
add_dir_to_path() {
|
||||
if [[ -d $1 ]]; then
|
||||
export PATH="$1:$PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
update_.g() {
|
||||
if [[ ! -d "$HOME/.dotgit" ]]; then
|
||||
# no git to update
|
||||
return
|
||||
fi
|
||||
|
||||
local RES=$(.g pull 2>&1)
|
||||
|
||||
if [[ $? != 0 ]]; then
|
||||
# something went wrong
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ ! ($RES =~ "Already up.to.date") ]]; then
|
||||
echo "Updated .g"
|
||||
echo $RES
|
||||
echo "======"
|
||||
echo
|
||||
fi
|
||||
}
|
47
.zoptions
Normal file
47
.zoptions
Normal file
@@ -0,0 +1,47 @@
|
||||
# Disable corrections
|
||||
unsetopt CORRECT
|
||||
# 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
|
||||
#setopt NO_CLOBBER
|
||||
setopt CLOBBER
|
||||
|
||||
# No ! voodoo
|
||||
unsetopt bang_hist
|
||||
|
||||
# Case insensitive globbing
|
||||
setopt NO_CASE_GLOB
|
||||
# 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
|
Reference in New Issue
Block a user