Skip to content

Instantly share code, notes, and snippets.

@n8henrie
Created November 6, 2017 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n8henrie/6cf7785d0ae025e706522e6e64c3fba2 to your computer and use it in GitHub Desktop.
Save n8henrie/6cf7785d0ae025e706522e6e64c3fba2 to your computer and use it in GitHub Desktop.
My basic bash_aliases for a Linux system
aur_download() {
aur_url="https://aur.archlinux.org$(curl -s "https://aur.archlinux.org/packages/$1" | ack -o "(?<=href=\").*?tar.gz(?=\">)")"
echo "$aur_url"
read -p "Download the above url? [yn] " response
case $response in
[Yy])
wget "$aur_url"
echo "You still need to do the usual: tar -xvf; cd; makepkg -s; pacman -U;"
;;
*)
echo "I guess not."
;;
esac
}
alias ttmux='tmux new-session -A -s main'
alias sourceme="source ~/.bash_profile; source ~/.bash_aliases; source ~/.bashrc"
# -> Prevents accidentally clobbering files.
alias mkdir='mkdir -p'
# Get external IP
extip() { curl http://ipecho.net/plain; echo; }
# prefix filename with ddate
ddate() { mv "$1" $(date "+%Y%m%d_")"$1"; }
# Find a file with a pattern in name:
n8ls() { find . -maxdepth 1 -iname '*'"$*"'*' -ls ; }
# Stopwatch, stolen from https://github.com/mick-schroeder/dotfiles/blob/master/.aliases
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
# Use ag and quickfix window
quack() { nvim -q <(ag "$@") +cw; }
mkvenv() (
set -e
python3 -m venv --copies --prompt="venv $(python3 --version | cut -d" " -f 2)" venv
source venv/bin/activate
pip install --upgrade pip wheel
)
alias sv='source venv/bin/activate'
alias dv='deactivate'
mkvenv() (
set -e
python3 -m venv --copies --prompt="venv $(python3 --version | cut -d" " -f 2)" venv
source venv/bin/activate
pip install --upgrade pip wheel
)
csv() (
set -e
sed -e 's/,,/, ,/g' "$1" | column -s, -t | less -#5 -N -S
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment