dot_testing/bash/bashrc

106 lines
2.2 KiB
Bash

#!/bin/bash
# some housekeeping
set -o vi
shopt -s autocd
alias rc=". ~/.config/bash/bashrc"
alias erc="nvim ~/.config/bash/bashrc"
alias reload=". ~/.config/bash/bashrc; . ~/.config/bash/profile"
# ssh keeping tidy
alias ssh="ssh -F $HOME/.config/ssh/config"
# remind alias
alias sched="nvim $DOTREMINDERS"
alias cal="rem -cl"
alias shutdown="sudo shutdown -h now"
alias ls="ls --color=auto"
alias irssi="irssi --home=$HOME/.config/irssi"
PS1="\w\$ "
# repos func
repos() {
sel="$(ls ~/git | fzy | awk '{print "/home/usr/git/"$1}')"
[ "$?" -eq 1 ] && exit
cd "$sel"
}
files() {
sel=$(find /home/$(whoami) |
grep -v '\.cache\|\.pki\|/scratch/\|\.config/chromium\|\.git\|\.local/lib\|\.mozilla/firefox/' |
fzy -l 50)
[ -z "$sel" ] && return 1
[ -d "$sel" ] && cd "$sel" || nvim "$sel"
return 0
}
rss() {
cd ~/.local/share/sfeed/
touch .urls
sfeed_curses *
cd -
}
# stolen from stackoverflow
# code from a stranger is always perfect
git_main_branch () {
git branch | cut -c 3- | grep -E '^master$|^main$'
}
gp() {
# a bodge -- git authentication doesn't work quite right
pash c tildegit
git push -u origin $(git_main_branch)
}
start_bitlbee() {
mkdir -p $HOME/.config/bitlbee/
touch $HOME/.config/bitlbee/config
bitlbee #-D -c $HOME/.config/bitlbee/config -d $HOME/.config/bitlbee/
}
record() {
tmp=$(mktemp)
res=$(xrandr |
grep ' connected' |
awk -F' ' '{print $1 " " $4}' |
awk -F'+' '{print $1}' |
fzy |
awk -F' ' '{print $2}' )
ffmpeg -video_size "$res" -f x11grab -framerate 60 -i $DISPLAY -preset ultrafast -pix_fmt yuv420p "$tmp.mp4"
printf "> written to %s\n" "$tmp.mp4"
while true; do
set -x
result=$(printf "delete\nmove to home directory\nupload to pastebin\nreview footage\nquit\n" | fzy --prompt="what next? ")
case "$result" in
*upload*)
paste "$tmp.mp4" | xclip -i
;;
*review*)
mpv "$tmp.mp4"
;;
*delete*)
rm "$tmp.mp4"
return
;;
*home*)
name=$(echo "capture.mp4" | fzy --prompt="name please? ")
mv "$tmp.mp4" "$HOME/$name.mp4"
return
;;
*quit*)
return
;;
esac
done
}
alias gs='git status'
alias f=files
alias lofi="mpv https://www.youtube.com/watch?v=jfKfPfyJRdk --no-video"