mirror of
https://github.com/notwa/rc
synced 2025-03-14 22:12:50 -07:00
a bunch of minor stuff before i start refactoring
This commit is contained in:
parent
d561fe4ffb
commit
4adbbb0e27
6 changed files with 47 additions and 3 deletions
12
home/-shrc
12
home/-shrc
|
@ -24,7 +24,10 @@ has() { which "$1" >&/dev/null && which "$1"; }
|
|||
|
||||
ADDPATH() {
|
||||
new="$(readlink -f "$1")"
|
||||
[ -d "$new" ] || echo -E "ADDPATH: path doesn't exist: $1" >&2
|
||||
if [ ! -d "$new" ]; then
|
||||
echo -E "ADDPATH: path doesn't exist: $1" >&2
|
||||
return 1
|
||||
fi
|
||||
echo ":$PATH:" | grep -q ":$new:" || export PATH="$PATH:$new"
|
||||
}
|
||||
|
||||
|
@ -35,6 +38,7 @@ if [ $FANCY -eq 1 ]; then
|
|||
hash -d c="/c"
|
||||
hash -d d="/d"
|
||||
[ -d /media/chibi ] && hash -d e="/media/chibi" || hash -d e="/e"
|
||||
hash -d s="/s"
|
||||
|
||||
hash -d cyg=~c"/cygwin/home/$USER"
|
||||
hash -d msys=~c"/msys64/home/$USER"
|
||||
|
@ -50,6 +54,9 @@ umask 022
|
|||
|
||||
ADDPATH "$HOME/opt/local/bin"
|
||||
[ -n "$MSYSTEM" ] && ADDPATH "/c/path"
|
||||
[ -n "$MSYSTEM" ] && ADDPATH "/c/path/mpv-shinchiro" 2>/dev/null
|
||||
[ -n "$MSYSTEM" ] && ADDPATH "/c/Program Files/7-Zip-Zstandard" 2>/dev/null
|
||||
[ -n "$MSYSTEM" ] && ADDPATH ~win"/Desktop/_programs/rakudo-2021.06/bin" 2>/dev/null
|
||||
|
||||
# https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1380084
|
||||
export SSH_AUTH_SOCK=0
|
||||
|
@ -175,7 +182,7 @@ pegg() {
|
|||
|
||||
bak() {
|
||||
if [ -s "$1.bak" ]; then
|
||||
bak "$1.bak"
|
||||
bak "$1.bak" || return $?
|
||||
fi
|
||||
cp -p "$1" "$1.bak"
|
||||
}
|
||||
|
@ -193,6 +200,7 @@ baks() { # backup, timestamped
|
|||
|
||||
eashare() {
|
||||
# NOTE: this only works on MSYS2 for now.
|
||||
# NOTE: i lied, this doesn't work anymore. idk
|
||||
local dest="${1##*/}"
|
||||
eaput "$1" || return 1
|
||||
printf "%s" "$_REMOTE_DOMAIN/$_REMOTE_DIR/$dest" > /dev/clipboard
|
||||
|
|
|
@ -50,6 +50,8 @@ if [[ "$_nn" == banshee ]]; then
|
|||
speakers
|
||||
fi
|
||||
|
||||
unset _nn
|
||||
|
||||
mpv_watch() {
|
||||
pushd ~/play >/dev/null
|
||||
local url="$1"; shift
|
||||
|
@ -110,4 +112,4 @@ asmr() {
|
|||
yt "$@" --volume=90 --ytdl-format=251/300/best
|
||||
}
|
||||
|
||||
unset _nn
|
||||
[ -e "$HOME/.nara" ] && . "$HOME/.nara"
|
||||
|
|
|
@ -188,6 +188,11 @@ if &term =~ '^tmux'
|
|||
exec "set <xLeft>=\e[1;*D"
|
||||
endif
|
||||
|
||||
" mintty pls
|
||||
"exec "set <s-Tab>=\e[Z"
|
||||
"map <Esc>[Z <s-tab>
|
||||
"ounmap <Esc>[Z
|
||||
|
||||
" easy indent/unindent
|
||||
nn <tab> >>
|
||||
nn <s-tab> <<
|
||||
|
|
24
home/zshrc
24
home/zshrc
|
@ -231,6 +231,30 @@ if [[ "$host" == "spectre" ]] || [[ "$host" == *"banshee" ]]; then
|
|||
# alias v="f -e $EDITOR"
|
||||
fi
|
||||
|
||||
baknow() { cp -ip "$1" "$1.$(now "$1").bak"; }
|
||||
|
||||
ff() { find "${1:-.}" -type f | fzy }
|
||||
|
||||
cutv() {
|
||||
local nel="${1?missing length parameter}"
|
||||
local f="${2?missing file parameter}"
|
||||
local g="cut."${${f##*/}%.*}".mp4"
|
||||
ffmpeg -hide_banner -i "$f" 2>&1 \
|
||||
| grep Duration \
|
||||
| grep -Eo '[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9]' | awk -F: '{print (($1*60+$2)*60+$3)+$4/100}' | read len
|
||||
[[ "$len" -gt 0 ]] || return 1
|
||||
echo "$g"
|
||||
ffmpeg \
|
||||
-hide_banner -loglevel warning -stats -stats_period 5 \
|
||||
-i "$f" -ss "$(((nel<len)*(len-nel)))" \
|
||||
-sn -dn -metadata = -map_chapters -1 -movflags +faststart \
|
||||
-ar 44100 -acodec libfdk_aac -b:a 256k -cutoff 20000 -af alimiter=level_in=2.5:level_out=0.9 \
|
||||
-maxrate 7680k -bufsize 9600k -vcodec libx264 -preset medium -crf 21 -vf scale=1280:720 \
|
||||
-threads 2 -y "$g" || return 1
|
||||
# -maxrate 7680k -bufsize 9600k -vcodec libx264 -preset medium -crf 21 -vf scale=1280:720
|
||||
# -maxrate 9600k -bufsize 12000k -vcodec libx264 -preset medium -crf 22 -vf scale=1280:720
|
||||
}
|
||||
|
||||
# generated by dircolors with https://github.com/isene/LS_COLORS
|
||||
function {
|
||||
local lsc= line=
|
||||
|
|
|
@ -24,6 +24,9 @@ deb $site/$name/ llvm-toolchain-$name-$version main\n\
|
|||
}
|
||||
|
||||
compile() {
|
||||
# FIXME: compile gcc portrend.c -lsdl
|
||||
# this causes mayhem!
|
||||
|
||||
local gcc="$(whence -p gcc 2>/dev/null)"
|
||||
local clang="$(whence -p clang 2>/dev/null)"
|
||||
local clang_flags=() # currently just for clang-msvc
|
||||
|
|
|
@ -3,6 +3,8 @@ is_empty() {
|
|||
while read -r; do
|
||||
[ ! -d "$REPLY" ] && [ -s "$REPLY" ] && return 1
|
||||
done < <(find ${1:-.})
|
||||
# TODO: done < <(find ${1:-.} -type f -print -quit)
|
||||
# this needs to skip empty files as well.
|
||||
return 0
|
||||
}
|
||||
is_empty "$@"
|
||||
|
|
Loading…
Add table
Reference in a new issue