Seriously guys... nowadays you have no reason to use windows... but if you are forced... then install gsudo on first login and thank me later
Strambo come Sigmud
blog degli effetti collaterali: cose che accadono quando
un ragno radioattivo ti morde, quando rimani esposto
ai raggi cosmici, o, come nel mio caso, quando
al posto della materia grigia il PadrEterno ti ha donato
un'allegra e variegata macedonia ;-P
btw: si ringrazia di cuore Max Schiavetta per SuperZip (qui a fianco)
Cerca qui le cose strambe
2026-03-26
2025-04-24
grep di stdin tenendo l'header
A volte puo` essere utile un grep di stdin tenendo l'header
Si definisce in bash (nel .bashrc o simile) una funzione cortissima tipo cosi` =>
hgrep () { read line; echo "$line"; grep $* ; }ci sono rari casi in cui puo` essere leggermente pericolosa, ma nel complesso pare accettabile
esempio d'uso:
# lsof | hgrep tripwire COMMAND PID TID TASKCMD USER FD TYPE DEVICE SIZE/OFF NODE NAME tripwire 2285668 root cwd DIR 253,0 36864 524292 /root tripwire 2285668 root rtd DIR 253,0 4096 2 / tripwire 2285668 root txt REG 253,0 3140528 594 /usr/sbin/tripwire tripwire 2285668 root 4u REG 253,3 51822592 36 /tmp/twtempUYqaRJ (deleted) # # ps aux | hgrep /usr/sbin/tripwire USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2285668 96.1 1.4 484084 467676 ? R 14:45 16:33 /usr/sbin/tripwire #
2025-04-09
preventing rdp session from being locked with pyautogui
I have to work on 2 simultaneous rdp connections on two screens
and every 5/10 minutes or so one of them got locked (you know: security policies...)
so I ended up with this workaround: a simple infinite-loop python script that
I can launch in a local cmd shell:
every minute it simulates a click and an Esc key in both rdp window (and this, in my specific case, cannot cause any harm, but beware: YMMV)
import pyautogui, random, sys
from tkinter import Tk
from time import sleep
pyautogui.PAUSE = 0.01
num_times = 0
while True:
num_times += 1
print("loop number %d" % num_times)
sleep(1)
print(".")
sleep(1)
print(".")
z1, z2 = pyautogui.position()
pyautogui.moveTo(-700, 300, duration=0.1)
pyautogui.click()
sleep((0.4 + random.random()) / 4)
pyautogui.hotkey("esc")
pyautogui.moveTo(z1, z2, duration=0.1)
pyautogui.click()
sss = 48.4 + 6.01 * random.random()
print("sleeping for %d s " % int(sss))
sleep(sss)
print("this statement just marks the script end, but it won't be ever executed")
UPDATED on 2026-03-25
there is a simpler solution using
https://pypi.org/project/wakepy/
=>
from wakepy import keep
from time import sleep
@keep.presenting
def long_running_task():
while True:
sleep(60)
print(datetime.now())
long_running_task()