Skip to content

Instantly share code, notes, and snippets.

View gim913's full-sized avatar
😶‍🌫️
shmoo

GiM gim913

😶‍🌫️
shmoo
View GitHub Profile
@gim913
gim913 / fail2ban.md
Last active July 5, 2024 08:54
Void Linux with socklog and Fail2ban

Recently (2024-07) I had exactly the same issue as the one described in this reddit post: https://www.reddit.com/r/voidlinux/comments/cj76vm/fail2ban_with_socklog/

That is, I had issues with getting fail2ban to ingest logfile /var/log/socklog/secure/current for sshd jail.

The issue is socklog(?) prefixes the entry with UTC timestamp like so:

2024-06-27T19:21:09.48767 auth.info: Jun 27 21:21:09 sshd[3518]: Unable to negotiate with 218.92.0.59 port 25784: no matching key exchange method found. Their offer: ...

Mind that there is a datae BEFORE auth.info and that date is UTC vs local time that is AFTER.

@gim913
gim913 / liquidtray.py
Last active June 13, 2024 20:45
Liquidctl + windows tray + notifications
from threading import Event
from liquidctl import find_liquidctl_devices
from liquidctl.util import color_from_str
from infi.systray import SysTrayIcon
from winrt.windows.ui.notifications import ToastNotificationManager, ToastNotification, ToastTemplateType
def show_warning(temp):
orig_xml = ToastNotificationManager.get_template_content(ToastTemplateType.TOAST_TEXT02)
t = orig_xml.get_elements_by_tag_name("text")

Keybase proof

I hereby claim:

  • I am gim913 on github.
  • I am gim913 (https://keybase.io/gim913) on keybase.
  • I have a public key ASDQmuHpB3IbHMNb8sPm6WOnujmoZDXGE4dXvERUmMfLJQo

To claim this, I am signing this object:

i,s=0,''
while i<len(d):o=d[i]&15;s+=chr(255&eval((''if o<2 else str(d[i+2]))+' ~^&|+-'[o]+str(d[i+1])));i+=(o+13)//5
print(s)
print(reduce(lambda a,e:(e&15,a[1])if a[0]==-1 else(-1,a[1]+chr(255&(~e if a[0] else e)))if a[0]<2 else(a[0],a[1],e)if len(a)<3 else(-1,a[1]+chr(255&eval(str(e)+'^&|+-'[(a[0])-2]+str(a[2])))),d,(-1,''))[1])