mirror of
https://github.com/FAUSheppy/config
synced 2025-12-10 08:38:32 +01:00
Merge branch 'master' of gitlab.cs.fau.de:ik15ydit/config
This commit is contained in:
@@ -61,6 +61,7 @@ hc keybind $Mod-q close
|
||||
|
||||
#spawn shit
|
||||
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-i spawn urxvt -e nohup zsh -c "chromium &" #need to reliably use the zshconf chromium
|
||||
if [[ $HOST =~ atlantis* ]]; then
|
||||
@@ -74,7 +75,7 @@ hc keybind $Mod-p spawn pavucontrol
|
||||
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-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-e spawn rofi -combi-mode window,run -show combi -modi combi
|
||||
hc keybind $Mod-Shift-e spawn rofi -show run
|
||||
|
||||
@@ -86,6 +86,12 @@ def vpn():
|
||||
tmp = ' '+tmp
|
||||
return tmp;
|
||||
|
||||
def ip():
|
||||
with open(hl_utils.hlpath("ip.log")) as f:
|
||||
tmp = f.read()
|
||||
tmp = ' '+tmp
|
||||
return tmp;
|
||||
|
||||
def battery():
|
||||
if hl_utils.is_laptop():
|
||||
try:
|
||||
@@ -114,30 +120,7 @@ def battery():
|
||||
return color_panel(str(e),RED)
|
||||
else:
|
||||
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__":
|
||||
print(vpn(),guthaben(),battery(),sep='')
|
||||
print(ip(),vpn(),guthaben(),battery(),sep='')
|
||||
|
||||
@@ -4,12 +4,15 @@ import sys
|
||||
import time
|
||||
import sys
|
||||
import subprocess
|
||||
from hl_panel_content import color_panel
|
||||
from hl_utils import error, is_cip, shexec, color_remove, hlpath
|
||||
from hl_panel_content import color_panel, get_color
|
||||
from hl_utils import error, is_cip, shexec, color_remove, hlpath, is_laptop
|
||||
import re
|
||||
|
||||
RED = 0xff0000
|
||||
GREEN = 0x32CD32
|
||||
YELLOW = 0xffff00
|
||||
BAT_COLOR_OFFSET = 10
|
||||
|
||||
|
||||
#Druckerguthaben
|
||||
def pr_acct_status():
|
||||
@@ -41,13 +44,56 @@ def vpn_status():
|
||||
with open(vpn_path,'w+') as g:
|
||||
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__':
|
||||
#print('"'+sys.argv[-1]+'"')
|
||||
if sys.argv[-1]=='--refresh':
|
||||
vpn_status()
|
||||
pr_acct_status()
|
||||
sys.exit()
|
||||
while(True):
|
||||
vpn_status()
|
||||
pr_acct_status()
|
||||
battery_status()
|
||||
ip_status()
|
||||
if sys.argv[-1]=='--refresh':
|
||||
break
|
||||
time.sleep(30)
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ def color_remove(s):
|
||||
return re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]').sub('',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():
|
||||
u = os.uname()
|
||||
|
||||
11
herbstluftwm/test_cal.py
Normal file
11
herbstluftwm/test_cal.py
Normal 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()
|
||||
Reference in New Issue
Block a user