Skip to content

Instantly share code, notes, and snippets.

@codeitlikemiley
Created May 21, 2019 11:48
Show Gist options
  • Select an option

  • Save codeitlikemiley/6ebf75fbe531688acad5d31a68de00b7 to your computer and use it in GitHub Desktop.

Select an option

Save codeitlikemiley/6ebf75fbe531688acad5d31a68de00b7 to your computer and use it in GitHub Desktop.
arch bash profile aliases
#!/usr/bin/bash
# System Maintainence
# alias mw="~/.config/mutt/mutt-wizard.sh"
# alias muttwizard="~/.config/mutt/mutt-wizard.sh"
# alias sdn="sudo shutdown now"
alias refgpg="gpg-connect-agent RELOADAGENT /bye" # Refresh gpg
# Some aliases
alias p="sudo pacman"
# remove all orphans recurssively
alias pacro="/usr/bin/pacman -Qtdq > /dev/null && sudo /usr/bin/pacman -Rns \$(/usr/bin/pacman -Qtdq | sed -e ':a;N;$!ba;s/\n/ /g')"
alias ctl="sudo systemctl"
alias sv="sudo vim"
alias r="ranger"
alias sr="sudo ranger"
alias ka="killall"
alias mkd="mkdir -pv"
alias ref="shortcuts && source ~/.bashrc" # Refresh shortcuts manually and reload bashrc
alias bw="wal -i ~/.config/wall.png" # Rerun pywal
# Adding color
alias c='clear'
alias la='ls -Al' # show hidden file
alias l='ls -hN --color=auto --group-directories-first'
alias lx='ls -l | sort -k1,1' # sort by same file type
alias lz='du -a -h --max-depth=1 | sort -hr | grep "^[0-9*]\.[0-9*2][BKMG]"'
alias ld='du -sh *' # list directory file size
alias lh='ls -d .*' # show only hidden files
alias lr='ls -lR' # recursive ls
alias ls='ls -hN --color=auto --group-directories-first'
# alias lc='ls -lcr' # sort by change time
# alias lt='ls -lur' # sort by access time
# alias ld='ls -ltr' # sort by date
# alias lm='ls -al |more' # pipe through 'more'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='../../..'
alias .....='../../../..'
alias ......='../../../../..'
alias grep="grep --color=auto"
alias diff="diff --color=auto"
alias ccat="highlight --out-format=ansi --force" # Color cat - print file with syntax highlighting.
# Internet
alias yt="youtube-dl --add-metadata -ic" # Download video link
alias yta="yt -x -f bestaudio/best" # Download only audio
# alias ytv="youtube-viewer"
# custom key
alias i3conf="code \$HOME/.config/i3/config"
alias i3blocksconf="code \$HOME/.config/i3blocks/config"
alias comptonconf="code \$HOME/.config/compton.conf"
alias rangerconf="code \$HOME/.config/ranger/rc.conf"
alias vimrc='code ~/.vimrc'
alias aliases="code \$HOME/.bash_aliases"
# clipboard
alias pbcopy="xclip -sel clip"
alias cppwd="pwd | xclip -sel clip"
# git
alias nah='git reset --hard;git clean -df'
alias wip="git add . && git commit -m 'wip'"
alias bashrc='code ~/.bashrc'
alias cli='cd $HOME/ZERO'
alias pub='flutter packages pub'
# alias figma='/home/yuri/Programs/Figma-68.5.0-x86_64.AppImage'
# programs
alias chrome="google-chrome-stable"
alias sidekick="nssidekick"
alias muttwizard="bash ~/.config/mutt/mutt-wizard.sh":
alias j="jrnl"
alias tl="todo.sh lsa"
alias ta="todo.sh add"
alias td="todo.sh rm"
alias tt="todo.sh do"
alias tc="todo.sh replace"
# make an open pr
alias gpr='git push origin HEAD && git open-pr'
# File and Folder Permission
alias mx='sudo chmod a+x'
alias 000='sudo chmod 000'
alias 644='sudo chmod 644'
alias 600='sudo chmod 600'
alias 755='sudo chmod 755'
alias 775='sudo chmod 775'
alias 777='sudo chmod 777'
alias ownthis='sudo chown -R $(whoami)'
alias rootthis='sudo chown -R root'
alias cx='chmod +x'
# requires a file name e.g. perm file
alias perm='stat --printf "%a %n \n "'
alias permall='777'
# alias permhome='chmod 755 -R $HOME && chmod 644 $HOME/.dmrc'
# restore user,group and mod of an entire website
# useful only in server if you fuck up folder permissions
alias restoremod='chgrp users -R .;chmod u=rwX,g=rX,o=rX -R .;chown $(pwd |cut -d / -f 3) -R .'
# POrts
alias tcpstats='sudo netstat -st' # show statistics for tcp ports
alias tcp_='sudo netstat -atp' # list all TCP ports
alias ports='netstat -tulpn | grep LISTEN'
# System Info Short Cut
alias ps='ps auxf'
alias pg='ps aux | grep' #requires an argument
alias ping='ping -c 10'
alias du1='du -h --max-depth=1'
# Explorer
alias e='open'
# disk usage shortcuts
alias diskusage="df -hT"
alias localip="ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'"
# date shortcut
alias da='date "+%Y-%m-%d %A %T %Z"'
# Cli History
alias hs='history | grep'
alias clearhs='history -c'
alias envpath='echo -e ${PATH//:/\\n}'
# laravel specific alias
alias tinker='php artisan tinker'
alias fresh='php artisan migrate:fresh --seed'
alias art='php artisan'
alias artisan='php artisan'
alias unit_f="vendor/bin/phpunit --filter"
alias unit_g="vendor/bin/phpunit --group"
alias wordcount='wc -w'
alias devices='avdmanager list avd'
alias axit='cd "/home/yuri/.wine/drive_c/Program Files (x86)/MetaTrader - AxiTrader" && wine terminal.exe'
alias mt5='cd "/home/yuri/.wine/drive_c/Program Files/MetaTrader 5" && wine terminal64.exe &'
alias se="vim \$(fzf)"
#!/bin/bash
# Profile file. Runs on login.
# Adds `~/.scripts` and all subdirectories to $PATH
export PATH="$PATH:$(du "$HOME/.scripts/" | cut -f2 | tr '\n' ':')"
export EDITOR="vim"
export TERMINAL="st"
export BROWSER="firefox"
export READER="zathura"
export BIB="$HOME/Documents/LaTeX/uni.bib"
export REFER="$HOME/.referbib"
export SUDO_ASKPASS="$HOME/.scripts/tools/dmenupass"
export PIX="$HOME/.pix/"
# less/man colors
export LESS=-R
export LESS_TERMCAP_mb=$'\E[1;31m' # begin bold
export LESS_TERMCAP_md=$'\E[1;36m' # begin blink
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;44;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
[ ! -f ~/.shortcuts ] && shortcuts >/dev/null 2>&1
# if you want to use encrypted bashrc
#if [ -f ~/.bashrc_private.gpg ]; then
#eval "$(gpg --decrypt ~/.bashrc_private.gpg 2>/dev/null)"
#fi
echo "$0" | grep "bash$" >/dev/null && [ -f ~/.bashrc ] && source "$HOME/.bashrc"
# Start graphical server if i3 not already running.
[ "$(tty)" = "/dev/tty1" ] && ! pgrep -x i3 >/dev/null && exec startx
# Switch escape and caps if tty:
sudo -n loadkeys ~/.scripts/ttymaps.kmap 2>/dev/null
#!/bin/bash
export GPG_TTY=$(tty)
export GOPATH=/home/yuri/go/packages
export GPGKEY=346BCC41CF9D553C
export FZF_DEFAULT_OPTS="--layout=reverse --height 40%"
stty -ixon # Disable ctrl-s and ctrl-q.
shopt -s autocd #Allows you to cd into directory merely by typing the directory name.
if [ "$EUID" -ne 0 ]
then export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
else export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]ROOT\[$(tput setaf 2)\]@\[$(tput setaf 4)\]$(hostname | awk '{print toupper($0)}') \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
fi
myip() {
wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1
}
bb() {
local signal
case "$1" in
'') blockify-dbus get 2>/dev/null && return 0;;
ex|exit)
signal='TERM';; # Exit
b|block)
signal='USR1';; # Block
u|unblock)
signal='USR2';; # Unblock
p|previous)
signal='RTMIN';; # Previous song
n|next)
signal='RTMIN+1';; # Next song
t|toggle)
signal='RTMIN+2';; # Toggle play song
tb|toggleblock)
signal='RTMIN+3';; # Toggle block song
ip|iprevious)
signal='RTMIN+10';; # Previous interlude song
in|inext)
signal='RTMIN+11';; # Next interlude song
it|itoggle)
signal='RTMIN+12';; # Toggle play interlude song
itr|itoggleresume)
signal='RTMIN+13';; # Toggle interlude resume
*) echo "Usage: bb ( b[lock] | u[nblock] | p[revious] | n[ext] | t[oggle] | t[oggle]b[lock] |...)" && return 0;;
esac
pkill --signal "$signal" -f 'python.*blockify'
}
[ -f "$HOME/.shortcuts" ] && source "$HOME/.shortcuts" # Load shortcut aliases
# ADD ALL PATH HERE
PATH="$HOME/.config/composer/vendor/bin:$PATH"
# this fix error if your facing this error
# :ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at ../emulator/lib64/qt/lib
# https://stackoverflow.com/questions/42554337/cannot-launch-avd-in-emulatorqt-library-not-found#42955322
# when error PANIC: Missing emulator engine program for 'x86' CPU.
# this is when we installed a new emulator from android studio with many devices
# to use that emulator we can go to this /opt/android-sdk/emulator
function emulator { cd "$(dirname "$(which emulator)")" && ./emulator "$@"; }
# HSTR configuration - add this to ~/.bashrc
export HSTR_CONFIG=hicolor # get more colors
shopt -s histappend # append new history items to .bash_history
export HISTCONTROL=ignorespace:ignoredups # leading space hides commands from history
export HISTFILESIZE=10000 # increase history file size (default is 500)
HISTSIZE= HISTFILESIZE= # increase history size (default is 500)
# ensure synchronization between Bash memory and history file
# export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi
# if this is interactive shell, then bind 'kill last command' to Ctrl-x k
if [[ $- =~ .*i.* ]]; then bind '"\C-xk": "\C-a hstr -k \C-j"'; fi
###-tns-completion-start-###
if [ -f ~/.tnsrc ]; then
source ~/.tnsrc
fi
NPM_CONFIG_PREFIX=~/.npm-global
export PATH=~/.npm-global/bin:$PATH:$GOPATH/bin
###-tns-completion-end-###
# source aliases
# Load shortcut aliases
source ~/.bash_aliases
source ~/.bash.d/cht.sh
# add fzf completion and key bindings
source /usr/share/fzf/completion.bash
source /usr/share/fzf/key-bindings.bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment