2018-04-11 19:52:53 +00:00
|
|
|
# edit alias
|
2018-03-10 04:04:29 +00:00
|
|
|
vialias() {
|
|
|
|
$EDITOR $ZSH_CUSTOM/100-alias.zsh
|
|
|
|
source $ZSH_CUSTOM/100-alias.zsh
|
|
|
|
}
|
|
|
|
|
2018-04-11 19:52:53 +00:00
|
|
|
# edit function
|
2018-03-10 04:04:29 +00:00
|
|
|
vifunction() {
|
|
|
|
$EDITOR $ZSH_CUSTOM/101-function.zsh
|
|
|
|
source $ZSH_CUSTOM/101-function.zsh
|
|
|
|
}
|
2018-03-23 15:27:34 +00:00
|
|
|
|
2018-04-11 19:52:53 +00:00
|
|
|
# scan network
|
2018-03-23 15:27:34 +00:00
|
|
|
nmap-libvirt() {
|
2018-03-26 13:06:05 +00:00
|
|
|
__nmap_iface 'virbr[0-9]+' $@
|
|
|
|
}
|
|
|
|
|
|
|
|
nmap-tun() {
|
2018-04-11 19:52:53 +00:00
|
|
|
__nmap_iface '(tun|tap)[0-9]+' $@
|
2018-03-23 15:27:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nmap-local() {
|
2018-03-26 13:06:05 +00:00
|
|
|
__nmap_iface '(eth|wlan)[0-9]+' $@
|
|
|
|
}
|
|
|
|
|
|
|
|
__nmap_iface() {
|
|
|
|
local iface="$1"
|
|
|
|
shift
|
|
|
|
local opt=${@:--T5}
|
|
|
|
|
|
|
|
for link in $(ip link show up | grep -Eo "$iface"); do
|
2018-03-23 15:27:34 +00:00
|
|
|
for addr in $(ip addr show $link | grep -oP '(?<=inet )([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}'); do
|
|
|
|
addr_list="$addr_list $addr"
|
|
|
|
done
|
|
|
|
done
|
2018-03-26 13:06:05 +00:00
|
|
|
|
|
|
|
printf "Scanning %s\n" "$addr"
|
|
|
|
nmap $opt $addr_list
|
2018-03-23 15:27:34 +00:00
|
|
|
}
|
2018-04-11 19:52:53 +00:00
|
|
|
|
|
|
|
# calculator
|
|
|
|
\=() {
|
|
|
|
bc -l <<<"$*"
|
|
|
|
}
|
2018-04-29 17:31:31 +00:00
|
|
|
|
|
|
|
# start looking-glass
|
|
|
|
game() {
|
|
|
|
echo "Stopping services"
|
|
|
|
sudo systemctl stop cronie
|
|
|
|
systemctl --user stop redshift
|
|
|
|
pkill compton
|
|
|
|
|
|
|
|
echo "Setup cpuset cgroup for host"
|
|
|
|
sudo cset set -c 0,4 -s system
|
|
|
|
sudo cset proc -m -f root -t system
|
|
|
|
sudo cset proc -k -f root -t system --force
|
|
|
|
|
|
|
|
echo "Starting looking-glass"
|
|
|
|
LD_PRELOAD=/usr/\$LIB/libgamemodeauto.so looking-glass-client -o opengl:preventBuffer=0 -MF
|
|
|
|
|
|
|
|
echo "Restore system"
|
|
|
|
sudo cset set -d system &>/dev/null
|
|
|
|
compton &>/dev/null & disown
|
|
|
|
systemctl --user start redshift
|
|
|
|
sudo systemctl start cronie
|
|
|
|
}
|