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

221 lines
5.8 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'
2015-07-18 14:05:59 +02:00
alias vi='vim'
alias vless="/usr/share/vim/vim73/macros/less.sh"
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"
2014-02-19 14:40:59 +01:00
alias dev="ssh -l david 10.9.0.43"
2014-05-13 07:04:49 +02:00
alias t="todo.sh"
2014-10-20 14:44:48 +02:00
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"
2016-09-16 11:00:17 +02:00
alias home="sshuttle -vvr stargazer.socialnerds.org:2222 10.1.2.0/24"
2016-02-09 19:51:31 +01:00
alias aec="sshuttle -vvr 90.146.8.9 90.146.8.0/26"
2015-07-17 08:17:38 +02:00
alias c="clear"
2015-07-18 15:08:54 +02:00
alias bat="acpi && date"
2015-07-19 13:31:50 +02:00
alias vn="vim ~/ownCloud/Notes/notes.md"
2016-04-01 21:01:49 +02:00
#alias spacedock="sshfs spacedock.socialnerds.org:/ /home/david/spacedock"
2013-09-22 17:04:40 +02:00
# 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
xfreerdp +clipboard /v:$server /u:$username /d:$domain /size:1366x768
2016-09-16 11:19:26 +02:00
else
echo "error: no rdp client found"
exit 1
fi
fi
2014-05-14 10:51:26 +02:00
}
2013-06-20 15:50:16 +02:00
pullmyzsh()
{
2013-01-17 15:04:45 +01:00
cd $ZSH
git pull origin master
cd -
}
2013-06-20 15:50:16 +02:00
pushmyzsh()
{
2013-01-17 15:04:45 +01:00
cd $ZSH
2013-01-19 10:36:35 +01:00
git add **/*[^lastrun]
2013-06-29 12:51:34 +02:00
git commit -am "pushmyzsh $(date "+%d.%m.%Y %H:%M")"
git push origin master
cd -
}
2013-01-18 18:01:33 +01:00
update()
{
2013-01-18 18:13:16 +01:00
2013-01-18 18:01:33 +01:00
#checking for system
2013-01-18 18:13:16 +01:00
systems="ubuntu arch"
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
case $system in
ubuntu)
sudo apt-get update && sudo apt-get dist-upgrade
;;
arch)
sudo pacman -Syu
;;
?)
echo "unknown system. could not run update."
;;
esac
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
}