david/myzsh
david
/
myzsh
Archived
1
0
Fork 0
This repository has been archived on 2020-12-06. You can view files and clone it, but cannot push or open issues or pull requests.
myzsh/plugins/david.zsh

232 lines
6.4 KiB
Bash
Raw Normal View History

2013-01-18 18:13:16 +01:00
# Options
set -o shwordsplit
# Aliases
alias zz='source ~/.zshrc'
alias vz='vim ~/.zshrc && source ~/.zshrc'
2013-01-17 15:04:45 +01:00
alias vp='vim $ZSH/plugins/david.zsh && source ~/.zshrc'
alias vt='vim $ZSH/themes/david.zsh && source ~/.zshrc'
2017-10-03 21:47:56 +02:00
alias vs='vim $ZSH/myzsh.sh && source ~/.zshrc'
2017-10-03 23:58:35 +02:00
alias vu='cd $ZSH > /dev/null; git pull origin master; cd - > /dev/null; echo $timestamp > $ZSH/lastrun; source ~/.zshrc'
2015-07-18 14:05:59 +02:00
alias vi='vim'
alias v='vim'
alias publish="python2 -m SimpleHTTPServer"
2013-06-20 18:59:49 +02:00
alias push="git push origin master"
alias pull="git pull origin master"
#alias vpn="sudo openvpn --writepid /var/run/openvpn --config /home/david/.vpn/david.conf"
2015-09-01 11:28:03 +02:00
alias aec="sshuttle -vvr 90.146.8.233 192.168.6.0/24 90.146.8.0/26 10.9.0.0/26 10.12.0.0/16 10.2.0.0/26 192.168.3.0/24 10.12.4.0/22"
2017-11-12 03:50:14 +01:00
alias home="sshuttle -vvr stargazer.socialnerds.org:2222 10.1.0.0/16"
2017-06-11 13:35:40 +02:00
alias dmz="sshuttle -vvr 90.146.8.9 90.146.8.0/26"
2015-07-17 08:17:38 +02:00
alias c="clear"
2017-11-06 20:36:51 +01:00
alias start_vmware="~/Git/scripts/start_vmware.sh"
2013-09-22 17:04:40 +02:00
2017-12-07 09:25:16 +01:00
alias pacrepo='sudo reflector -l 20 -f 10 --save /etc/pacman.d/mirrorlist'
alias pacman='sudo pacman'
alias journalctl='sudo journalctl'
alias pacu='sudo pacman -Syu --noconfirm'
alias auru='yaourt -Syua --noconfirm'
alias systemctl='sudo systemctl'
alias se='ls /usr/bin | grep'
export EDITOR=vim
export QT_STYLE_OVERRIDE=gtk
export QT_SELECT=qt5
if [[ $LANG = '' ]]; then
export LANG=en_US.UTF-8
fi
# Functions
2017-06-10 20:45:15 +02:00
vm()
2013-09-22 21:37:35 +02:00
{
2017-06-10 20:45:15 +02:00
if [ -z $1 ]; then
2017-06-10 22:52:51 +02:00
echo -e "option[new|start|nofb]: \c"
2017-06-10 20:45:15 +02:00
read option
else
option=$1
fi
if [ -z $2 ]; then
echo -e "filename: \c"
read filename
else
filename=$2
fi
if [ $option = "new" ]; then
qemu-img create -f qcow2 $2 20G
sudo qemu-system-x86_64 -vga virtio -display sdl,gl=on \
-cpu host -enable-kvm -machine type=pc,accel=kvm -smp 4 \
-m 4096 \
-drive file=$filename,if=virtio \
2017-06-11 00:15:29 +02:00
-net nic,macaddr=$(genmac.sh) \
-net bridge,br=br0 \
2017-06-10 20:45:15 +02:00
-boot order=n
elif [ $option = "start" ]; then
sudo qemu-system-x86_64 -vga virtio -display sdl,gl=on \
-cpu host -enable-kvm -machine type=pc,accel=kvm -smp 4 \
-m 4096 \
-drive file=$filename,if=virtio \
2017-06-11 00:13:35 +02:00
-net nic,macaddr=$(genmac.sh) \
-net bridge,br=br0
2017-06-10 22:52:51 +02:00
elif [ $option = "net" ]; then
sudo qemu-system-x86_64 -vga virtio -display sdl,gl=on \
-cpu host -enable-kvm -machine type=pc,accel=kvm -smp 4 \
-m 4096 \
-drive file=$filename,if=virtio \
2017-06-11 00:15:29 +02:00
-net nic,macaddr=$(genmac.sh) \
-net bridge,br=br0 \
2017-06-10 22:52:51 +02:00
-boot order=n
elif [ $option = "low" ]; then
sudo qemu-system-x86_64 -vga std \
-cpu host -enable-kvm -machine type=pc,accel=kvm -smp 4 \
-m 4096 \
-drive file=$filename,if=virtio \
2017-06-11 00:13:35 +02:00
-net nic,macaddr=$(genmac.sh) \
-net bridge,br=br0
2017-06-10 22:52:51 +02:00
elif [ $option = "nofb" ]; then
sudo qemu-system-x86_64 -nographic -curses \
-cpu host -enable-kvm -machine type=pc,accel=kvm -smp 4 \
-m 4096 \
-drive file=$filename,if=virtio \
2017-06-11 00:13:35 +02:00
-net nic,macaddr=$(genmac.sh) \
-net bridge,br=br0
2017-06-10 20:45:15 +02:00
else
echo "option unknown"
fi
2013-09-22 21:37:35 +02:00
}
rdp()
{
if [ -z $1 ]; then
echo -e "server: \c"
read server
else
server=$1
fi
2015-08-15 06:53:21 +02:00
echo -e "username [davidadm]: \c"
read username
if [ -z $username ]; then
2015-08-15 06:53:21 +02:00
username="davidadm"
fi
echo -e "domain [aec.at]: \c"
read domain
if [ -z $domain ]; then
domain="aec.at"
fi
2016-09-16 11:19:26 +02:00
which rdesktop >/dev/null
if [ $? -eq 0 ]; then
#rdesktop -u $username -p - -d $domain -g 1366x768 $server -k de
rdesktop -K -u $username -p - -d $domain -g workarea $server -k de
else
which xfreerdp >/dev/null
if [ $? -eq 0 ]; then
2017-06-10 20:45:15 +02:00
#xfreerdp +clipboard /v:$server /u:$username /d:$domain /size:1920x1080
2017-11-03 08:34:30 +01:00
xfreerdp /v:$server /u:$username /d:$domain /size:1366x768 -wallpaper:on
2017-06-10 20:45:15 +02:00
2016-09-16 11:19:26 +02:00
else
echo "error: no rdp client found"
2018-01-20 17:36:20 +01:00
return 1
2016-09-16 11:19:26 +02:00
fi
fi
2014-05-14 10:51:26 +02:00
}
2013-01-18 18:01:33 +01:00
update()
{
# OS Upgrade function for various systems.
2013-01-18 18:13:16 +01:00
2013-01-18 18:01:33 +01:00
#checking for system
2017-11-19 12:10:06 +01:00
systems="ubuntu arch solus raspbian antergos"
2013-01-18 18:01:33 +01:00
issue="$(cat /etc/issue)"
2013-06-23 15:50:52 +02:00
for item in $systems; do
echo $issue | grep -i $item >> /dev/null
if [ $? -eq 0 ]; then
system=$item
fi
done
#trying to update parsed system
2013-06-23 15:50:52 +02:00
case $system in
2017-11-19 12:12:26 +01:00
ubuntu|debian|raspbian)
echo "Updating Ubuntu/Debian.."
2013-06-23 15:50:52 +02:00
sudo apt-get update && sudo apt-get dist-upgrade
;;
2017-11-19 12:10:06 +01:00
arch|antergos)
2017-10-03 20:59:57 +02:00
echo "Updating Arch Linux.."
2013-06-23 15:50:52 +02:00
sudo pacman -Syu
;;
2017-10-03 20:34:04 +02:00
solus)
2017-10-03 20:59:57 +02:00
echo "Updating Solus OS.."
2017-10-03 20:35:10 +02:00
sudo eopkg update-repo && sudo eopkg upgrade
2017-10-03 20:34:04 +02:00
;;
2013-06-23 15:50:52 +02:00
?)
2017-10-03 20:59:57 +02:00
echo "error: unknown system."
2018-01-20 17:36:20 +01:00
return 1
2013-06-23 15:50:52 +02:00
;;
esac
if [ $? -ne 0 ]; then
echo "error: something went wrong."
2018-01-20 17:36:20 +01:00
return 1
fi
2013-01-18 18:01:33 +01:00
}
2013-06-28 11:17:49 +02:00
install()
{
#checking for system
systems="ubuntu arch"
issue="$(cat /etc/issue)"
packages=$*
for item in $systems; do
echo $issue | grep -i $item >> /dev/null
if [ $? -eq 0 ]; then
system=$item
fi
done
case $system in
ubuntu)
sudo apt-get install -y $packages
;;
arch)
2013-06-28 11:23:19 +02:00
sudo pacman -Sy --noconfirm $packages
2013-06-28 11:17:49 +02:00
;;
?)
echo "unknown system. could not run install."
;;
esac
}
2014-01-12 13:13:01 +01:00
is_dirty()
{
2013-01-18 23:27:24 +01:00
local SUBMODULE_SYNTAX=''
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
fi
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
return 1
else
return 0
fi
}
2015-07-18 10:45:46 +02:00
fixtrackpoint()
{
xinput set-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation" 1
xinput set-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Button" 2
xinput set-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Timeout" 200
xinput set-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Axes" 6 7 4 5
xinput set-prop "TPPS/2 IBM TrackPoint" "Device Accel Constant Deceleration" 0.75
}
2017-10-04 00:06:31 +02:00