Skip to content

Instantly share code, notes, and snippets.

@cwillsey06
Created September 16, 2023 06:01
Show Gist options
  • Select an option

  • Save cwillsey06/47f37d68db8e98051ec1830ad452c52c to your computer and use it in GitHub Desktop.

Select an option

Save cwillsey06/47f37d68db8e98051ec1830ad452c52c to your computer and use it in GitHub Desktop.
new omb config
# .bashrc
# 2023.09.15 [23:55]
## oh-my-bash configuration
export OSH="$HOME/.oh-my-bash"
OSH_THEME='barebones'
plugins=(git)
source "$OSH/oh-my-bash.sh"
## exports:path
function appendpath() {
case ":$PATH:" in
*:"$1":*)
;;
*)
PATH="${PATH:+$PATH:}$1"
esac
}
appendpath "$HOME/.foreman/bin"
appendpath "$HOME/.local/bin"
appendpath "$HOME/.cargo/bin"
appendpath "$HOME/go/bin"
unset appendpath
## exports
export HISTCONTROL=ignoredups:erasedups
export EDITOR="nvim"
export VISUAL="nvim"
export PATH
# If not running interactively, exit
[[ $- != *i* ]] && return
## aliases
# archive extractor
# usage: ex <file>
function ex() {
if [ -f "$1" ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*.deb) ar x $1 ;;
*.tar.xz) tar xf $1 ;;
*.tar.zst) unzstd $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# download and extract
# tarballs via the web
function xurl() {
curl "$1" -o - | tar xz
}
# download and patch
# files via the web
function ipatch() {
curl "$1" | patch -p1
}
# convert video w/
# ffmpeg io system
function conv() {
[ -z "$1" ] && return;
[ -z "$2" ] && return;
local input="$1"
shift
ffmpeg -i "$input" "$@"
}
# compile and run c
# code and programs
function cx() {
local exec
[ -n "$1" ] && exec="$1" || exec='./main'
make && "$exec"
}
## yt-dlp
alias yta-aac='yt-dlp --extract-audio --audio-format aac '
alias yta-best='yt-dlp --extract-audio --audio-format best '
alias yta-flac='yt-dlp --extract-audio --audio-format flac '
alias yta-m4a='yt-dlp --extract-audio --audio-format m4a '
alias yta-mp3='yt-dlp --extract-audio --audio-format mp3 '
alias yta-opus='yt-dlp --extract-audio --audio-format opus '
alias yta-vorbis='yt-dlp --extract-audio --audio-format vorbis '
alias yta-wav='yt-dlp --extract-audio --audio-format wav '
alias ytv-best='yt-dlp -f bestvideo+bestaudio '
# vimish
alias e='nvim'
alias q='exit'
# ranger
alias ra='ranger'
# tree
alias t='tree'
# confirm before overwriting something
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment