mirror of
https://github.com/FAUSheppy/config
synced 2025-12-06 07:01:36 +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
|
||||
|
||||
# tags
|
||||
#hc rename default "1" || true
|
||||
hc rename default "1" || true
|
||||
hc add "2"
|
||||
hc add "3"
|
||||
hc add "4"
|
||||
|
||||
@@ -12,6 +12,7 @@ PRINT_LOG = "pracct.log"
|
||||
VPN_LOG = "vpn_status.log"
|
||||
BATTERY_LOG = "battery.log"
|
||||
IP_LOG = "ip.log"
|
||||
LOGINS_LOG = "logins.log"
|
||||
|
||||
BATTERY_CRITICAL = 2 # in %
|
||||
BAT_WARNING_STR = ">>>>>>>>>>>>>>>> ------------ WARNING BATTER FAILURE IMMINENT ------------ <<<<<<<<<<<<<"
|
||||
|
||||
@@ -11,8 +11,8 @@ def guthaben():
|
||||
with open(hl_utils.hlpath(PRINT_LOG)) as f:
|
||||
raw = f.read();
|
||||
guthaben = "Druckerguthaben: " + raw + " Euro"
|
||||
col = get_color(float(raw),0,COLOR_BORDER)
|
||||
guthaben = color_panel(guthaben,col)
|
||||
col = hl_utils.get_color(float(raw),0,COLOR_BORDER)
|
||||
guthaben = hl_utils.color_panel(guthaben,col)
|
||||
return guthaben;
|
||||
|
||||
def vpn():
|
||||
@@ -46,5 +46,9 @@ def battery():
|
||||
def date():
|
||||
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__":
|
||||
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 hl_utils
|
||||
import signal
|
||||
import socket
|
||||
from hl_constants import *
|
||||
from datetime import datetime
|
||||
|
||||
battery_average=[]
|
||||
bat_prev = -1
|
||||
@@ -17,10 +19,34 @@ def sigusr1_handler(signum, frame):
|
||||
|
||||
|
||||
def cip_logins():
|
||||
l=hl_utils.shexec("wget -q -O- --user cip --password $(cat $HOME/.config/password.cip) 'https://atlantishq.de/cipactive/active_logins'")
|
||||
if len(l) > 5:
|
||||
return hl_utils.color_panel("CIP Logins: "+str(len(l)),RED)
|
||||
color = hl_utils.get_color(
|
||||
MAX_LOGINS=5
|
||||
pw="NOPE"
|
||||
try:
|
||||
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():
|
||||
try:
|
||||
@@ -98,8 +124,8 @@ def battery():
|
||||
|
||||
def pr_acct_status():
|
||||
if hl_utils.is_cip():
|
||||
out = hl_utils.color_remove(hl_utils.shexec(PRINT_LOG).split("\n")[0]).split(' ')[-1]
|
||||
with open(hl_utils.hlpath(PRINT_LOG),'w+') as f:
|
||||
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:
|
||||
f.write(out)
|
||||
|
||||
def vpn_status():
|
||||
@@ -127,13 +153,19 @@ def battery_status():
|
||||
with open(hl_utils.hlpath(BATTERY_LOG),'w') as g:
|
||||
g.write(battery())
|
||||
|
||||
last_ip="LOL"
|
||||
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:
|
||||
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)
|
||||
|
||||
def save():
|
||||
@@ -141,14 +173,16 @@ def save():
|
||||
pr_acct_status()
|
||||
battery_status()
|
||||
ip_status()
|
||||
cip_logins()
|
||||
trace_login()
|
||||
|
||||
def trace_login():
|
||||
if is_cip():
|
||||
if hl_utils.is_cip():
|
||||
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:
|
||||
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)
|
||||
|
||||
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