Cerca qui le cose strambe

Showing posts with label open-source. Show all posts
Showing posts with label open-source. Show all posts

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")




mp3 not accepted by audacity

 in case you are trying to import an mp3 file with Audacity and it fails with error "incorrect filetype"




you can check it with the file command line tool in cywin/Linux/etc

$ file ./somefile.mp3

./somefile.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, JntStereo

$

after some googling it turned out that a simple fix is using mp3validate 

https://mp3val.sourceforge.net/

(binaries available for windows/linux/etc)

for Debian/Ubuntu you should be able to use a plain

sudo apt install mp3val in case you do want to proceed with fixing the file without creating  a backup you can simply launch this command: mp3val somefile.mp3 -f -nb and then boom - Audacity will be happy in importing it.