mirror of
https://github.com/FAUSheppy/config
synced 2025-12-09 08:08:32 +01:00
lalala
This commit is contained in:
@@ -120,7 +120,7 @@ hc keybind $Mod-Control-Up resize up +$resizestep
|
|||||||
hc keybind $Mod-Control-Right resize right +$resizestep
|
hc keybind $Mod-Control-Right resize right +$resizestep
|
||||||
|
|
||||||
# tags
|
# tags
|
||||||
#hc rename default "1" || true
|
hc rename default "1" || true
|
||||||
hc add "2"
|
hc add "2"
|
||||||
hc add "3"
|
hc add "3"
|
||||||
hc add "4"
|
hc add "4"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ PRINT_LOG = "pracct.log"
|
|||||||
VPN_LOG = "vpn_status.log"
|
VPN_LOG = "vpn_status.log"
|
||||||
BATTERY_LOG = "battery.log"
|
BATTERY_LOG = "battery.log"
|
||||||
IP_LOG = "ip.log"
|
IP_LOG = "ip.log"
|
||||||
|
LOGINS_LOG = "logins.log"
|
||||||
|
|
||||||
BATTERY_CRITICAL = 2 # in %
|
BATTERY_CRITICAL = 2 # in %
|
||||||
BAT_WARNING_STR = ">>>>>>>>>>>>>>>> ------------ WARNING BATTER FAILURE IMMINENT ------------ <<<<<<<<<<<<<"
|
BAT_WARNING_STR = ">>>>>>>>>>>>>>>> ------------ WARNING BATTER FAILURE IMMINENT ------------ <<<<<<<<<<<<<"
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ def guthaben():
|
|||||||
with open(hl_utils.hlpath(PRINT_LOG)) as f:
|
with open(hl_utils.hlpath(PRINT_LOG)) as f:
|
||||||
raw = f.read();
|
raw = f.read();
|
||||||
guthaben = "Druckerguthaben: " + raw + " Euro"
|
guthaben = "Druckerguthaben: " + raw + " Euro"
|
||||||
col = get_color(float(raw),0,COLOR_BORDER)
|
col = hl_utils.get_color(float(raw),0,COLOR_BORDER)
|
||||||
guthaben = color_panel(guthaben,col)
|
guthaben = hl_utils.color_panel(guthaben,col)
|
||||||
return guthaben;
|
return guthaben;
|
||||||
|
|
||||||
def vpn():
|
def vpn():
|
||||||
@@ -46,5 +46,9 @@ def battery():
|
|||||||
def date():
|
def date():
|
||||||
return hl_utils.shexec("date +' ^fg(#efefef)%H:%M^fg(#909090), %Y-%m-^fg(#efefef)%d'")
|
return hl_utils.shexec("date +' ^fg(#efefef)%H:%M^fg(#909090), %Y-%m-^fg(#efefef)%d'")
|
||||||
|
|
||||||
|
def logins():
|
||||||
|
with open(LOGINS_LOG,'r') as f:
|
||||||
|
return f.read()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(ip(),vpn(),guthaben(),battery(),date(),sep='',end='')
|
print(logins(),ip(),vpn(),guthaben(),battery(),date(),sep='',end='')
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ import subprocess
|
|||||||
import re
|
import re
|
||||||
import hl_utils
|
import hl_utils
|
||||||
import signal
|
import signal
|
||||||
|
import socket
|
||||||
from hl_constants import *
|
from hl_constants import *
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
battery_average=[]
|
battery_average=[]
|
||||||
bat_prev = -1
|
bat_prev = -1
|
||||||
@@ -17,10 +19,34 @@ def sigusr1_handler(signum, frame):
|
|||||||
|
|
||||||
|
|
||||||
def cip_logins():
|
def cip_logins():
|
||||||
l=hl_utils.shexec("wget -q -O- --user cip --password $(cat $HOME/.config/password.cip) 'https://atlantishq.de/cipactive/active_logins'")
|
MAX_LOGINS=5
|
||||||
if len(l) > 5:
|
pw="NOPE"
|
||||||
return hl_utils.color_panel("CIP Logins: "+str(len(l)),RED)
|
try:
|
||||||
color = hl_utils.get_color(
|
with open(hl_utils.hlpath("password.cip")) as f:
|
||||||
|
pw=f.read().strip("\n")
|
||||||
|
except:
|
||||||
|
return ""
|
||||||
|
cmd="wget -q -O- --user cip --password "+pw+" 'https://atlantishq.de/cipactive/active_logins'"
|
||||||
|
try:
|
||||||
|
l=hl_utils.shexec(cmd).split("\n")
|
||||||
|
except:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
if len(l) > MAX_LOGINS:
|
||||||
|
ret = hl_utils.color_panel("CIP Logins: "+str(len(l)),RED)
|
||||||
|
elif len(l) <= 1:
|
||||||
|
ret = ""
|
||||||
|
else:
|
||||||
|
color = hl_utils.get_color(len(l),MAX_LOGINS,0)
|
||||||
|
ret = str(l)
|
||||||
|
for line in l:
|
||||||
|
if line =='':
|
||||||
|
continue
|
||||||
|
ret = ret + line + ", "
|
||||||
|
ret = ret[:-len(", ")]
|
||||||
|
ret = hl_utils.color_panel("CIP Logins: "+ret,color)
|
||||||
|
with open(hl_utils.hlpath(LOGINS_LOG),'w') as f:
|
||||||
|
f.write(ret)
|
||||||
|
|
||||||
def battery():
|
def battery():
|
||||||
try:
|
try:
|
||||||
@@ -98,8 +124,8 @@ def battery():
|
|||||||
|
|
||||||
def pr_acct_status():
|
def pr_acct_status():
|
||||||
if hl_utils.is_cip():
|
if hl_utils.is_cip():
|
||||||
out = hl_utils.color_remove(hl_utils.shexec(PRINT_LOG).split("\n")[0]).split(' ')[-1]
|
out = hl_utils.color_remove(hl_utils.shexec("pr_acct").split("\n")[0]).split(' ')[-1]
|
||||||
with open(hl_utils.hlpath(PRINT_LOG),'w+') as f:
|
with open(hl_utils.hlpath(PRINT_LOG),'w') as f:
|
||||||
f.write(out)
|
f.write(out)
|
||||||
|
|
||||||
def vpn_status():
|
def vpn_status():
|
||||||
@@ -127,13 +153,19 @@ def battery_status():
|
|||||||
with open(hl_utils.hlpath(BATTERY_LOG),'w') as g:
|
with open(hl_utils.hlpath(BATTERY_LOG),'w') as g:
|
||||||
g.write(battery())
|
g.write(battery())
|
||||||
|
|
||||||
|
last_ip="LOL"
|
||||||
def ip_status():
|
def ip_status():
|
||||||
|
global last_ip
|
||||||
|
try:
|
||||||
|
ip="Public IP: "+ hl_utils.shexec("wget --timeout=3 -O- --quiet https://atlantishq.de/ipcheck")
|
||||||
|
if last_ip == ip:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
last_ip = ip
|
||||||
|
tmp = hl_utils.color_panel(ip,GREEN)
|
||||||
|
except:
|
||||||
|
tmp = hl_utils.color_panel("Offline",RED)
|
||||||
with open(hl_utils.hlpath(IP_LOG),'w') as g:
|
with open(hl_utils.hlpath(IP_LOG),'w') as g:
|
||||||
p="Public IP: "
|
|
||||||
try:
|
|
||||||
tmp = hl_utils.color_panel(p+hl_utils.shexec("wget --timeout=3 -O- --quiet https://atlantishq.de/ipcheck"),GREEN)
|
|
||||||
except:
|
|
||||||
tmp = hl_utils.color_panel("Offline",RED)
|
|
||||||
g.write(tmp)
|
g.write(tmp)
|
||||||
|
|
||||||
def save():
|
def save():
|
||||||
@@ -141,14 +173,16 @@ def save():
|
|||||||
pr_acct_status()
|
pr_acct_status()
|
||||||
battery_status()
|
battery_status()
|
||||||
ip_status()
|
ip_status()
|
||||||
|
cip_logins()
|
||||||
|
trace_login()
|
||||||
|
|
||||||
def trace_login():
|
def trace_login():
|
||||||
if is_cip():
|
if hl_utils.is_cip():
|
||||||
try:
|
try:
|
||||||
tmp = shexec("wget --timeout=3 -O- --quiet 'https://atlantishq.de/ciplog/"+socket.gethostname()+"&active&"+str(datetime.now())+"'")
|
tmp = hl_utils.shexec("wget --timeout=3 -O- --quiet 'https://atlantishq.de/ciplog/"+socket.gethostname()+"&active&"+str(datetime.now())+"'")
|
||||||
except:
|
except:
|
||||||
tmp = "Service Unreachable"
|
tmp = "Service Unreachable"
|
||||||
with open(hlpath("cip_logins.log"),'w') as f:
|
with open(hl_utils.hlpath("cip_logins.log"),'w') as f:
|
||||||
f.write(tmp)
|
f.write(tmp)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
1
herbstluftwm/password.cip
Normal file
1
herbstluftwm/password.cip
Normal file
@@ -0,0 +1 @@
|
|||||||
|
huehuehuemordekaiser
|
||||||
Reference in New Issue
Block a user