configs/Arch/.bashrc

234 lines
5.2 KiB
Bash
Raw Normal View History

2019-01-07 20:25:22 +00:00
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
2019-05-10 20:56:02 +00:00
#if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
# exec tmux -2 attach-session || tmux -2 new-session
#fi
2020-09-21 01:46:36 +00:00
alias ls='exa -l'
2020-09-19 23:55:50 +00:00
#PS1='[\u@\h \W]\$ '
if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then
source /usr/share/zsh/manjaro-zsh-prompt
fi
2019-05-10 20:56:02 +00:00
export TERM=linux
2019-03-14 04:08:18 +00:00
alias sudo='sudo '
2019-03-11 17:04:37 +00:00
alias ~='cd ~/'
alias nano='vim'
2019-01-07 20:25:22 +00:00
alias trans='rsync -Pve ssh'
alias update='yay -Syu --noconfirm'
alias inst='yay --noconfirm -S'
alias burn='yay -Rns'
2020-09-21 01:46:36 +00:00
alias ls='exa -l'
2019-01-07 20:25:22 +00:00
alias pacs='yay -Ss'
alias svim='sudo -E vim'
2019-01-09 05:30:58 +00:00
alias vi='vim'
alias h='history'
alias mux='tmux new -s main'
2019-01-07 20:25:22 +00:00
alias supd='sudo pacman -Syyuu'
alias ncdu='ncdu --color dark'
alias bigclock='watch -t -n 1 "date '+%D%n%I:%M:%S' | figlet -k"|lolcat'
alias gitview='git log --graph --full-history --all --color --pretty=tformat:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s%x20%x1b[33m(%an)%x1b[0m"'
alias weather='curl wttr.in'
alias whatthecom='git commit -am "$(whatcom)"'
2019-01-07 23:57:59 +00:00
alias null='/dev/null'
alias q='exit'
2020-09-21 01:46:36 +00:00
alias lsa='exa -la@'
alias ....='cd ../../..;'
alias ...='cd ../..'
2019-01-07 23:57:59 +00:00
alias ..='cd ..'
2019-01-09 05:30:58 +00:00
alias ll='ls -AlhGrti'
alias ESC='cd ~/LocalGit/ESC618'
2019-03-08 23:33:51 +00:00
alias ta='tmux -2 a -t'
alias tn='tmux -2 new -s'
alias tm='tmux -2 attach-session || tmux -2 new-session'
alias nord='nordvpn connect'
alias nordd='nordvpn disconnect'
2019-03-08 23:33:51 +00:00
alias fucking='sudo'
alias please='sudo'
2019-03-08 23:33:51 +00:00
alias fuck='pkill -9'
alias bashrc='source ~/.bashrc'
2019-03-12 20:09:48 +00:00
alias iotop='sudo iotop'
2019-03-13 23:43:05 +00:00
alias artistradio='tizonia --spotify-related-artists'
alias wifilist='nmcli device wifi list'
alias cb='xclip -selection clipboard'
2019-05-10 20:56:02 +00:00
export PATH=$PATH:~/scripts:~/bin:/usr/local/go/bin
2019-01-07 20:25:22 +00:00
export npm_config_prefix=~/.node_modules
2019-03-08 21:10:29 +00:00
export EDITOR='vim'
export VISUAL='vim'
2019-03-08 23:33:51 +00:00
2019-03-12 17:54:18 +00:00
tempdrive () {
2019-03-13 21:14:12 +00:00
if [ $@ == 0 ]
then
sudo umount /mnt/RAM
sudo rm -rf /mnt/RAM
2019-03-13 21:17:34 +00:00
echo "Temporary drive unmounted and mountpoint deleted"
2019-03-13 21:14:12 +00:00
return
fi
2019-03-12 17:54:18 +00:00
if [ -z $@ ]
2019-03-13 20:58:16 +00:00
then
2019-03-13 21:14:12 +00:00
echo "Please provide a disk size in Mb."
else
if [ -d /mnt/RAM/ ]
then
echo "Directory exists"
else
sudo mkdir /mnt/RAM
echo "Directory created"
fi
sudo mount -t tmpfs tmpfs /mnt/RAM -o size=$@m; echo "$@M Disk created in RAM"
2019-03-13 20:58:16 +00:00
fi
2019-03-12 17:54:18 +00:00
}
2019-03-11 17:04:37 +00:00
cd () {
builtin cd "$@" && ls -a
}
2019-03-08 23:33:51 +00:00
bk () {
if [ -z $1 ]
then
echo "Type a filename, dumbass"
else
cp $1{,.bak}
fi
}
md () {
mkdir -p "$@" && cd "$@";
}
function whatcom() {
curl --silent --fail https://whatthecommit.com/index.txt
}
2019-01-07 20:25:22 +00:00
teatimer() {
sleep $1;
mplayer "$HOME/Music/Tornado.mp3" & notify-send 'YOUR TEA IS READY OH FUCK';
2019-01-07 20:25:22 +00:00
curl -X POST "https://api.lifx.com/v1/lights/group_id:58da90e73566e43f037c7b6d59e56d24/effects/pulse" -H "Authorization: Bearer cfbc4b9dd981f5d99d486d22cb75a44535a8e616b9315580cac4ff5d5147ed86" -d 'period=1' -d 'cycles=4' -d 'color='$2;
fg
exit
}
mksketch(){
mkdir "$1";
if [ "$2" = 'adr' ]
then
cp "$HOME/skeletons/adr.ino" "$1/$1.ino"
elif [ "$2" = "web" ]
then
cp "$HOME/skeletons/webserv.ino" "$1/$1.ino"
2019-04-25 23:07:37 +00:00
elif [ "$2" = "mqtt" ]
then
cp "$HOME/skeletons/mqttSkel.ino" "$1/$1.ino"
2019-01-07 20:25:22 +00:00
else
cp "$HOME/skeletons/basic.ino" "$1/$1.ino"
fi
vim "$1/$1.ino"
}
2019-03-13 20:58:16 +00:00
bigtext(){
if [ -z "$1" ]
then
curl --silent --fail curl 'artii.herokuapp.com/make?text='FUCK+IT'&font='univers''
else
printf "$1\n"
curl --silent --fail curl 'artii.herokuapp.com/make?text='$1'&font='univers''
fi
}
branchdelete(){
git branch -d $1
git push --delete origin $1
echo There you go;
}
2019-03-12 18:26:32 +00:00
2019-03-17 02:49:08 +00:00
cheat(){
curl "cheat.sh/$1"
}
2019-03-12 18:26:32 +00:00
updateconfigs (){
cd ~/GIT/configs
whatthecom
git push origin master
cd ~
}
2019-03-17 02:49:08 +00:00
needReboot(){
NEXTLINE=0
FIND=""
for I in `file /boot/vmlinuz-*-*`; do
2019-03-17 02:49:08 +00:00
if [ ${NEXTLINE} -eq 1 ]; then
FIND="${I}"
echo -e "\n\nCurrent kernel version is $FIND\n\n"
NEXTLINE=0
else
if [ "${I}" = "version" ]; then NEXTLINE=1; fi
fi
done
if [ ! "${FIND}" = "" ]; then
CURRENT_KERNEL=`uname -r`
if [ ! "${CURRENT_KERNEL}" = "${FIND}" ]; then
echo -e "Booted kernel version is $CURRENT_KERNEL.\n\nReboot required"
echo -e "\033[0;31m\n\n Would you like to reboot now?\033[0;0m(y/n)"
read answer
case $answer in
y)
echo "Rebooting now"
sleep 10s
reboot
;;
n)
echo -e "\nOkay, but that's probably\ngoing to piss you off later"
;;
*)
echo "That's not an option"
;;
esac
2019-03-17 02:49:08 +00:00
fi
fi
}
squish(){
if [ -z $@ ]; then
echo -e "\nName a file, asshole\n"
else
pv $@ | gzip -9 > "$@.gz"
fi
}
jsonlint(){
if [ -z "$@" ]
then
echo "Enter some JSON please"
else
chromium "https:jsonlint.com/?json={$1}"
fi
}
jsonform(){
if [ -z "$@" ]
then
echo "Enter a JSON URL please"
else
chromium "https://jsonformatter.curiousconcept.com/#$1"
fi
}
2019-04-25 23:07:37 +00:00
haste(){
if [ -z $1 ]
then
echo "Please enter some fucking data"
else
key=$(curl 'https://hastebin.com/documents' --data-binary "$1" | jq -r '.key')
chromium http://hastebin.com/$key
fi
}
2019-05-10 20:56:02 +00:00
reinstallAll(){
for pkg in $(pacman -Q | cut -d' ' -f1); do
yay -S --noconfirm $pkg | lolcat
done
}