Add new stuff

This commit is contained in:
ViktorBarzin 2018-05-26 00:00:02 +01:00
parent 906f283fc0
commit 5a4395b413

View file

@ -12,7 +12,7 @@ alias pmmm='python manage.py makemigrations'
# git aliases # git aliases
alias gs='git status' alias gs='git status'
alias ga='git add $1' alias ga='git add'
alias gc='git commit' alias gc='git commit'
alias gp='git push origin master' alias gp='git push origin master'
alias gpull='git pull origin master' alias gpull='git pull origin master'
@ -21,7 +21,6 @@ alias gpull='git pull origin master'
alias checkcpu='modprobe msr; rdmsr -a 0x19a' alias checkcpu='modprobe msr; rdmsr -a 0x19a'
alias fixcpu='wrmsr -a 0x19a 0x0' alias fixcpu='wrmsr -a 0x19a 0x0'
alias daimi="grep -rnwi $2 $1"
alias muzika='xdg-open /home/viktor/Documents/Music/njoy.m3u' alias muzika='xdg-open /home/viktor/Documents/Music/njoy.m3u'
alias randomstr="tr -dc a-z1-4 </dev/urandom | tr 1-2 ' \n' | awk 'length==0 || length>50' | tr 3-4 ' ' | sed 's/^ *//' | cat -s | sed 's/ / /g' |fmt" alias randomstr="tr -dc a-z1-4 </dev/urandom | tr 1-2 ' \n' | awk 'length==0 || length>50' | tr 3-4 ' ' | sed 's/^ *//' | cat -s | sed 's/ / /g' |fmt"
alias battery="upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E 'time to empty|state|to\ full|percentage'" alias battery="upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E 'time to empty|state|to\ full|percentage'"
@ -33,11 +32,11 @@ alias myip="curl ifconfig.co"
alias rmswp="find ~/.vim/tmp/ -iname \"*swp\" -delete" alias rmswp="find ~/.vim/tmp/ -iname \"*swp\" -delete"
alias root="sudo su -" alias root="sudo su -"
function download_github_folder() { download_github_folder() {
svn checkout $(echo $1 | sed "s/\/tree\/[a-zA-Z]\+/\/trunk/") svn checkout $(echo $1 | sed "s/\/tree\/[a-zA-Z]\+/\/trunk/")
} }
function bye() { bye() {
if ps -p $(pidof rsync) 2> /dev/null if ps -p $(pidof rsync) 2> /dev/null
then then
echo 'Rsync is running, not going to sleep.' echo 'Rsync is running, not going to sleep.'
@ -46,10 +45,10 @@ function bye() {
fi fi
} }
alias sizeof="du -sh $1" alias sizeof='du -sh'
alias mkdir="mkdir -pv" alias mkdir="mkdir -pv"
# function ls(){ # ls(){
# if [[ $2 == "-l" ]]; then # if [[ $2 == "-l" ]]; then
# if [[ $3 != "" ]]; then # if [[ $3 != "" ]]; then
# exa -bghHliS $3 # exa -bghHliS $3
@ -70,7 +69,7 @@ alias upgrade="sudo apt upgrade"
alias install="sudo apt install" alias install="sudo apt install"
alias remove="sudo apt remove" alias remove="sudo apt remove"
# function secureme(){ # secureme(){
# workon ansible; # workon ansible;
# cd /home/viktor/ansible-play/ # cd /home/viktor/ansible-play/
# ansible-playbook -i ./hosts --extra-vars "ansible_sudo_pass=$ROOTPASS" --tags "vpn_startup" main.yml >> /dev/null # ansible-playbook -i ./hosts --extra-vars "ansible_sudo_pass=$ROOTPASS" --tags "vpn_startup" main.yml >> /dev/null
@ -78,7 +77,7 @@ alias remove="sudo apt remove"
# sudo openvpn --config viktor.ovpn & # sudo openvpn --config viktor.ovpn &
# } # }
function in(){ in(){
if [ $# -ne 1 ] && [ $# -ne 2 ]; if [ $# -ne 1 ] && [ $# -ne 2 ];
then then
echo "Usage:" echo "Usage:"
@ -118,43 +117,43 @@ function in(){
fi fi
} }
function stest(){ # stest(){
: snapshot_name="rootsnap" # snapshot_name="rootsnap"
mount_point="$2" # mount_point="$2"
if [ $# -ne 2 ];then # if [ $# -ne 2 ];then
echo "Usage:" # echo "Usage:"
echo "$0 <snapshot size> <mount point> " # echo "$0 <snapshot size> <mount point> "
echo # echo
return # return
fi # fi
if [ ${mount_point:0:1} != '/' ]; then # if [ ${mount_point:0:1} != '/' ]; then
echo "Mount point must be absolute path" # echo "Mount point must be absolute path"
return # return
fi # fi
if [[ $(sudo lvs | grep $snapshot_name) ]]; then # if [[ $(sudo lvs | grep $snapshot_name) ]]; then
echo "$snapshot_name already exists!" # echo "$snapshot_name already exists!"
# read -e -p "Do you want to discard it and create a new one?(y/N)" -i n should_discard # # read -e -p "Do you want to discard it and create a new one?(y/N)" -i n should_discard
echo "Do you want to discard it and create a new one?(y/N)" # echo "Do you want to discard it and create a new one?(y/N)"
read should_discard # read should_discard
should_discard=${should_discard:-"n"} # should_discard=${should_discard:-"n"}
# if [ ${(L)should_discard} = 'y' ]; then # # if [ ${(L)should_discard} = 'y' ]; then
if [ $(echo $should_discard | awk '{print tolower($0)}') = 'y' ]; then # if [ $(echo $should_discard | awk '{print tolower($0)}') = 'y' ]; then
sudo umount $mount_point # sudo umount $mount_point
sudo lvremove /dev/kubuntu-vg/$snapshot_name -y # sudo lvremove /dev/kubuntu-vg/$snapshot_name -y
else # else
echo "Leaving old snapshot intact" # echo "Leaving old snapshot intact"
return # return
fi # fi
fi # fi
sudo lvcreate -s -n $snapshot_name /dev/kubuntu-vg/root -L $1 # sudo lvcreate -s -n $snapshot_name /dev/kubuntu-vg/root -L $1
sudo mount /dev/kubuntu-vg/$snapshot_name $mount_point # sudo mount /dev/kubuntu-vg/$snapshot_name $mount_point
sudo chroot $mount_point /bin/zsh # sudo chroot $mount_point /bin/zsh
} # }
alias ifl="ifconfig|less" alias ifl="ifconfig|less"
# Docker aliases # Docker aliases
@ -165,13 +164,14 @@ alias dsjtw="docker swarm join-token worker"
alias noip6="sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf/wlp2s0/disable_ipv6'" alias noip6="sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf/wlp2s0/disable_ipv6'"
alias yesip6="sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/wlp2s0/disable_ipv6'" alias yesip6="sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/wlp2s0/disable_ipv6'"
alias omg2="killall plasmashell; plasmashell > /dev/null 2>&1 & disown" alias omg2="killall plasmashell; plasmashell > /dev/null 2>&1 & disown"
alias aliases="vim /home/viktor/.bash_aliases && source /home/viktor/.bash_aliases" alias aliases="vim /home/viktor/.bash_aliases && source /home/viktor/.bash_aliases"
# alias ghcirun="ghci --make $1; ./$1" # alias ghcirun="ghci --make $1; ./$1"
alias lip="ifconfig $(route -n | head -n 3 | tail -n 1 | awk '{print $8}') | grep inet | awk '{print \$2}'" alias lip="ifconfig $(route -n | head -n 3 | tail -n 1 | awk '{print $8}') | grep inet | awk '{print \$2}'"
function netok(){ netok(){
# ping google.com # ping google.com
echo 'Testing DNS settings.' echo 'Testing DNS settings.'
timeout 1 ping google.com -W 1 -c 1 &>> /dev/null timeout 1 ping google.com -W 1 -c 1 &>> /dev/null
@ -254,7 +254,7 @@ alias hosts="sudo vim /etc/hosts"
} }
alias gg="xset dpms force off" alias gg="xset dpms force off"
function hib(){ hib(){
# sudo swapon /dev/kubuntu-vg/swap_1 2&>/dev/null # sudo swapon /dev/kubuntu-vg/swap_1 2&>/dev/null
# sudo systemctl hibernate # sudo systemctl hibernate
# sudo swapoff /dev/kubuntu-vg/swap_1 2&>/dev/null # sudo swapoff /dev/kubuntu-vg/swap_1 2&>/dev/null
@ -275,13 +275,17 @@ alias dk="docker"
alias lk="sudo logkeys --start --output /home/viktor/tt" # integrated keyboard alias lk="sudo logkeys --start --output /home/viktor/tt" # integrated keyboard
alias lk1="sudo logkeys --start --output /home/viktor/tt --device /dev/input/event17" # usb keyboard alias lk1="sudo logkeys --start --output /home/viktor/tt --device /dev/input/event17" # usb keyboard
function psave() { psave() {
sudo service bluetooth stop sudo service bluetooth stop
sudo service vmware-workstation-server stop sudo service vmware-workstation-server stop
sudo service vmware stop sudo service vmware stop
sudo service ModemManager stop sudo service ModemManager stop
} }
function camelcase() { camelcase() {
perl -pe 's#(_|^)(.)#\u$2#g' perl -pe 's#(_|^)(.)#\u$2#g'
} }
rem_known() {
"ssh-keygen -f '/home/viktor/.ssh/known_hosts' -R $1"
}