Merge branch 'master' of gitlab.cs.fau.de:ik15ydit/config

This commit is contained in:
atlantispc_sheppy
2017-09-29 02:53:07 +02:00
9 changed files with 92 additions and 98 deletions

3
.gitignore vendored
View File

@@ -36,6 +36,7 @@ herbstluftwm/restartpanels.sh
htop/ htop/
inkscape/ inkscape/
libfm/ libfm/
spectaclerc
libvirt/ libvirt/
libreoffice libreoffice
mc/ mc/
@@ -43,6 +44,7 @@ menus/
mimeapps.list mimeapps.list
nautilus/ nautilus/
pulse/ pulse/
unity3d/
pavucontrol.ini pavucontrol.ini
pcmanfm/ pcmanfm/
ristretto/ ristretto/
@@ -65,6 +67,7 @@ eventviewsrc
herbstluftwm/__pycache__/ herbstluftwm/__pycache__/
korgacrc korgacrc
korganizerrc korganizerrc
kolourpaintrc
nohup.out nohup.out
specialmailcollectionsrc specialmailcollectionsrc
unity3d/tubus/ unity3d/tubus/

View File

@@ -61,6 +61,7 @@ hc keybind $Mod-q close
#spawn shit #spawn shit
hc keybind $Mod-Return spawn urxvt hc keybind $Mod-Return spawn urxvt
hc keybind $Mod-y spawn urxvt #easier to press with one hand
hc keybind $Mod-Shift-Return spawn ~/.config/herbstluftwm/hl_start_urxvt_cwd.py hc keybind $Mod-Shift-Return spawn ~/.config/herbstluftwm/hl_start_urxvt_cwd.py
hc keybind $Mod-i spawn urxvt -e nohup zsh -c "chromium &" #need to reliably use the zshconf chromium hc keybind $Mod-i spawn urxvt -e nohup zsh -c "chromium &" #need to reliably use the zshconf chromium
if [[ $HOST =~ atlantis* ]]; then if [[ $HOST =~ atlantis* ]]; then
@@ -74,7 +75,7 @@ hc keybind $Mod-p spawn pavucontrol
hc keybind $Mod-Shift-l spawn libreoffice hc keybind $Mod-Shift-l spawn libreoffice
hc keybind $Mod-t spawn /bin/bash -c "LC_ALL=en_DK.utf8 && export LC_ALL && thunderbird" hc keybind $Mod-t spawn /bin/bash -c "LC_ALL=en_DK.utf8 && export LC_ALL && thunderbird"
hc keybind $Mod-Shift-i spawn urxvt -e ssh ik15ydit@ircbox.cs.fau.de -t 'tmux a -d' hc keybind $Mod-Shift-i spawn urxvt -e ssh ik15ydit@ircbox.cs.fau.de -t 'tmux a -d'
hc keybind $Mod-Shift-t spawn urxvt -e ssh ik15ydit@faui06c.cs.fau.de -t "/proj/ciptmp/ik15ydit/Zeug/Telegram/tg/bin/telegram-cli -k tg-server.pub" hc keybind $Mod-Shift-t spawn urxvt -e ssh telegram-sheppy@atlantishq.de -t "/home/telegram-sheppy/tg/bin/telegram-cli"
hc keybind $Mod-j spawn /bin/bash -c "rm $HOME/.config/herbstluftwm/irc.log && herbstclient spawn urxvt -e 'exit'" hc keybind $Mod-j spawn /bin/bash -c "rm $HOME/.config/herbstluftwm/irc.log && herbstclient spawn urxvt -e 'exit'"
hc keybind $Mod-e spawn rofi -combi-mode window,run -show combi -modi combi hc keybind $Mod-e spawn rofi -combi-mode window,run -show combi -modi combi
hc keybind $Mod-Shift-e spawn rofi -show run hc keybind $Mod-Shift-e spawn rofi -show run

View File

@@ -86,6 +86,12 @@ def vpn():
tmp = ' '+tmp tmp = ' '+tmp
return tmp; return tmp;
def ip():
with open(hl_utils.hlpath("ip.log")) as f:
tmp = f.read()
tmp = ' '+tmp
return tmp;
def battery(): def battery():
if hl_utils.is_laptop(): if hl_utils.is_laptop():
try: try:
@@ -115,29 +121,6 @@ def battery():
else: else:
return "" return ""
def irc():
if hl_utils.is_cip():
ret_string = "IRC ERROR"
try:
fname = hl_utils.hlpath("irc.log")
tmp = []
with open(fname) as f:
for l in f:
tmp+=[l]
if len(tmp) == 0:
return ""
msg = " ".join(tmp[-1].split(" ")[2:])[:50]
user = tmp[-1].split(" ")[1][:15]
if not "%push" in msg:
return ""
pattern = re.compile("\^+[fb]g[(]+#[0-9]+[)]+")
msg = re.sub(pattern,"",msg)
user = re.sub(pattern,"",user)
ret_string = "MSG FROM: "+user+"-> "+msg.rstrip('\n')+" - [ "+str(len(tmp))+" total ]"
return color_panel(ret_string,RED)
except(IOError):
pass
else:
return ''
if __name__ == "__main__": if __name__ == "__main__":
print(vpn(),guthaben(),battery(),sep='') print(ip(),vpn(),guthaben(),battery(),sep='')

View File

@@ -4,12 +4,15 @@ import sys
import time import time
import sys import sys
import subprocess import subprocess
from hl_panel_content import color_panel from hl_panel_content import color_panel, get_color
from hl_utils import error, is_cip, shexec, color_remove, hlpath from hl_utils import error, is_cip, shexec, color_remove, hlpath, is_laptop
import re
RED = 0xff0000 RED = 0xff0000
GREEN = 0x32CD32 GREEN = 0x32CD32
YELLOW = 0xffff00 YELLOW = 0xffff00
BAT_COLOR_OFFSET = 10
#Druckerguthaben #Druckerguthaben
def pr_acct_status(): def pr_acct_status():
@@ -41,13 +44,56 @@ def vpn_status():
with open(vpn_path,'w+') as g: with open(vpn_path,'w+') as g:
g.write(out_vpn) g.write(out_vpn)
def battery():
try:
bat = shexec("acpi -b")
if bat == '':
return color_panel("BATTERY FAILURE",RED)
bat = re.compile(r'Battery [0-9]+: ').sub('',bat)
plain = int(bat.split('%')[0][-3:].rstrip('%').lstrip(','))
#cur_time = [bat.split('%, ')[1].split(' ')[0].split(':')]
if plain > 10:
plain += BAT_COLOR_OFFSET
if bat.startswith("Charging"):
return color_panel("Charging",GREEN,seper=False) + color_panel(bat.lstrip("Charging ,").strip('\n'),get_color(plain,0,100))
elif bat.startswith("Full") or bat.startswith('Unknown'):
return color_panel("On Supply and fully charged",GREEN)
elif plain <= 1:
return color_panel(">>>>>>>>>>>>>>>> --------------- WARNING BATTER FAILURE IMMINENT --------------- <<<<<<<<<<<<<",RED)
elif bat.startswith("Discharging"):
return color_panel("Discharging",RED,seper=False) + color_panel(bat.lstrip("Discharging ,").strip('\n'),get_color(plain,0,100))
else:
return color_panel(bat.strip('\n'),get_color(plain,0,100))
except ValueError as e:
return color_panel(str(e),RED)
def battery_status():
if is_laptop:
with open(hlpath("battery.log"),'w') as g:
g.write(battery())
def ip_status():
with open(hlpath("ip.log"),'w') as g:
p="Public IP: "
try:
tmp=color_panel(p+shexec("wget --timeout=3 -O- --quiet https://atlantishq.de/ipcheck"),GREEN)
except:
tmp=color_panel("Offline",RED)
g.write(tmp)
if __name__ == '__main__': if __name__ == '__main__':
#print('"'+sys.argv[-1]+'"') #print('"'+sys.argv[-1]+'"')
if sys.argv[-1]=='--refresh':
vpn_status()
pr_acct_status()
sys.exit()
while(True): while(True):
vpn_status() vpn_status()
pr_acct_status() pr_acct_status()
battery_status()
ip_status()
if sys.argv[-1]=='--refresh':
break
time.sleep(30) time.sleep(30)

View File

@@ -13,7 +13,7 @@ def color_remove(s):
return re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]').sub('',s) return re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]').sub('',s)
def shexec(s): def shexec(s):
return subprocess.check_output(shlex.split(s),shell=True).decode() return subprocess.check_output(shlex.split(s),shell=False).decode()
def is_cip(): def is_cip():
u = os.uname() u = os.uname()

11
herbstluftwm/test_cal.py Normal file
View File

@@ -0,0 +1,11 @@
import urllib3
import socket
http = urllib3.PoolManager()
socket.setdefaulttimeout(5)
url = 'https://squarez.fauiwg.de:7001/radicale/testuser/cal.ics/'
headers = urllib3.util.make_headers(basic_auth='testuser:test')
r = http.request('GET', url, headers=headers)
f = open(test.log,'w')
f.write(r)
f.close()

53
vim/rc
View File

@@ -27,62 +27,9 @@ set lazyredraw
"Shift-i will start inserting at the begin of the line, i will start before curser "Shift-i will start inserting at the begin of the line, i will start before curser
"Shift-t end of line or t just behind curser (tail) "Shift-t end of line or t just behind curser (tail)
"f does exactly the same but closer to shift, easier to use maybe "f does exactly the same but closer to shift, easier to use maybe
nnoremap t a
nnoremap T A
nnoremap f a
nnoremap f A
"search
set incsearch
set hlsearch
nnoremap Ctrl-l :nohlsearch
"movement
"move by visual line "move by visual line
nnoremap w g<Up>
nnoremap s g<Down>
nnoremap a <Left>
nnoremap d <Right>
"move by \n or \r\n
nnoremap W <Up>
nnoremap S <Down>
nnoremap A <Left>
nnoremap D <Right>
"move to line at bottom/top of current screen
nnoremap g H
nnoremap G L
"gg will go to start of file, GG to end of file and M will actually jump to mid of screen "gg will go to start of file, GG to end of file and M will actually jump to mid of screen
"move by word (dervied from Egoshooters where you can lean right or left usually with q and e)
nnoremap q b
"words to left (3q would be 3 words left)
nnoremap Q B
"words left, with all non-alphanumeric shit as sperators (i.e. '-')
"e and E same as above for right side
"textmanipulation
"delete (d is taken by wasd, c is close to d)
nnoremap c d
"delte selected
nnoremap cc dd
"delte line
nnoremap cl dd
"dene (cc works too)
nnoremap ce dw
nnoremap cq cb
"delete next word
"copy/paste (y is the vim default, Ctrl-c is for many GUI programs and windows)
nnoremap yr y$
"yank (copy) renemaining line behind curser
nnoremap Ctrl-c y
"yank (copy) selected, equivalent to y
"marocs
nnoremap r q
nnoremap R qq
nnoremap rr qq
"modifier keys "modifier keys
let mapleader="," let mapleader=","
nnoremap l $ nnoremap l $

View File

@@ -1,3 +1,4 @@
xrdb ~/.Xressources xrdb ~/.Xressources
xset r rate 300 25
eval `ssh-agent` eval `ssh-agent`
exec herbstluftwm exec herbstluftwm

26
zshrc
View File

@@ -110,6 +110,7 @@ if [[ $HOST =~ atlantis* ]]; then
alias i3lock="i3lock --image=/home/ik15ydit/.config/i3lock/bg.png" alias i3lock="i3lock --image=/home/ik15ydit/.config/i3lock/bg.png"
alias hlock="i3lock --image=/home/ik15ydit/.config/i3lock/bg.png -t" alias hlock="i3lock --image=/home/ik15ydit/.config/i3lock/bg.png -t"
alias -g sq="sheppy@squarez.fauiwg.de" alias -g sq="sheppy@squarez.fauiwg.de"
alias -g pine="sheppy@sheppy.chickenkiller.com"
else else
alias transparent_xlock="xlock -mode blank -geometry 1x1" alias transparent_xlock="xlock -mode blank -geometry 1x1"
fi fi
@@ -121,13 +122,12 @@ alias psearch="apt-cache search"
if [[ $HOST =~ atlantis* ]]; then if [[ $HOST =~ atlantis* ]]; then
#alias gedit="gedit 2&>/dev/null &" #alias gedit="gedit 2&>/dev/null &"
alias kpaint="kolourpaint 2&>/dev/null &" alias kpaint="kolourpaint 2&>/dev/null &"
alias telegram='ssh uni -t "/proj/ciptmp/ik15ydit/Zeug/Telegram/tg/bin/telegram-cli -k tg-server.pub"' alias telegram='ssh telegram-sheppy@atlantishq.de -t "~/tg/bin/telegram-cli"'
alias telegram-plain='ssh uni -t "/proj/ciptmp/ik15ydit/Zeug/Telegram/tg/bin/telegram-cli --disable-colors --disable-readline -k tg-server.pub"' alias telegram-plain='ssh uni -t "/proj/ciptmp/ik15ydit/Zeug/Telegram/tg/bin/telegram-cli --disable-colors --disable-readline -k tg-server.pub"'
alias x='exec startx' alias x='exec startx'
alias vpn='sudo /usr/bin/openvpn_cip.sh' alias vpn='sudo /usr/bin/openvpn_cip.sh'
else else
alias telegram='/proj/ciptmp/ik15ydit/Zeug/Telegram/tg/bin/telegram-cli -k tg-server.pub'
alias burp=/home/cip/2013/ik15ydit/ciptmp/reps/WebScan/burpsuite/BurpSuiteFree alias burp=/home/cip/2013/ik15ydit/ciptmp/reps/WebScan/burpsuite/BurpSuiteFree
fi fi
alias rehash="source ~/.config/zshrc" alias rehash="source ~/.config/zshrc"
@@ -175,8 +175,8 @@ alias mountcip="sshfs ik15ydit@faui00n.cs.fau.de:/ -o reconnect,idmap=user $CIP_
alias umountcip="fusermount -u $CIP_MOUNTPOINT" alias umountcip="fusermount -u $CIP_MOUNTPOINT"
## CONNECT Locally ## ## CONNECT Locally ##
alias -g atlantislaptop="ik15ydit@atlantislaptop.local" #alias -g atlantislaptop="ik15ydit@atlantislaptop.local"
alias -g atlantismedion="ik15ydit@atlantismedion.local" #alias -g atlantismedion="ik15ydit@atlantismedion.local"
## DIRECT TO CONFIG ## ## DIRECT TO CONFIG ##
alias hlconf="vim ~/.config/herbstluftwm/autostart" alias hlconf="vim ~/.config/herbstluftwm/autostart"
@@ -203,6 +203,7 @@ fi
if [[ $HOST =~ atlantis* ]]; then if [[ $HOST =~ atlantis* ]]; then
alias dual="xrandr --output DVI-I-2 --right-of DVI-I-1" alias dual="xrandr --output DVI-I-2 --right-of DVI-I-1"
alias shutown="/sbin/poweroff" alias shutown="/sbin/poweroff"
alias s2disk="sudo /usr/sbin/s2disk"
fi fi
if [[ $HOST == "atlantislaptop" ]]; then if [[ $HOST == "atlantislaptop" ]]; then
alias backlightctl="tee /sys/class/backlight/intel_backlight/brightness <<< $1" alias backlightctl="tee /sys/class/backlight/intel_backlight/brightness <<< $1"
@@ -249,7 +250,7 @@ ssh_func(){
/usr/bin/ssh $@; /usr/bin/ssh $@;
printf '\033]708;black\007' printf '\033]708;black\007'
} }
alias -g ssh="ssh_func" alias ssh="ssh_func"
### REVERSE SEARCH ### ### REVERSE SEARCH ###
@@ -259,7 +260,7 @@ else
PECO=/usr/bin/ PECO=/usr/bin/
fi fi
alias cfind='print -z $(cat ~/.config/zshhistory.log | $PECO/peco)' alias cfind='print -z $(g/zshhistory.log | $PECO/peco)'
hhs(){print -z "$(cat ~/.config/zshhistory.log | $PECO/peco)"} hhs(){print -z "$(cat ~/.config/zshhistory.log | $PECO/peco)"}
zle -N hhstest hhs zle -N hhstest hhs
bindkey ^R hhstest bindkey ^R hhstest
@@ -273,11 +274,12 @@ else
exec zsh exec zsh
fi fi
### Experimental ### alias hgrep="cat ~/.config/zshhistory.log | grep"
source ~/.config/other/zsh-history-substring-search.zsh
bindkey '^[[5~' history-substring-search-up
bindkey '^[[6~' history-substring-search-down
alias genserverkey='openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 100000'
alias hq="ssh -4 root@atlantishq.de" alias hq="ssh -4 root@atlantishq.de"
alias sync-atlantishq="rsync -avz -r -P root@atlantishq.de:/home/home_backup/ /home/sheppy/archive" alias sync-atlantishq="rsync -avz -r -P root@atlantishq.de:/home/home_backup/ /home/sheppy/archive"
## APT ##
whateverprovides(){
apt-file search --regexp "bin/$1""$"
}
export whateverprovide