Skip to content

Instantly share code, notes, and snippets.

View davcri's full-sized avatar

Davide Cristini davcri

View GitHub Profile
@davcri
davcri / linux-prevent-speakers-suspend.md
Last active September 28, 2021 09:55
systemd: create timer to play audio every 5 minutes to prevent speakers auto-suspend
# download python script
wget https://gist.githubusercontent.com/davcri/35074eda17caf24e0d8269edba58192c/raw/514e8c027c46b2f98e6674beb62ec4b3e1b1a346/generate-sine-tone-wav.py
# generate sine tone
python generate-sine-tone-wav.py
# move audio file
mv sine-wave-20hz.wav ~/.local/sine-wave-20hz.wav
# https://stackoverflow.com/questions/33879523/python-how-can-i-generate-a-wav-file-with-beeps
import math
import wave
import struct
audio = []
sample_rate = 44100.0
//
// Tic Tac Toe.
//
// # Run the game
//
// ```
// cargo run
// ```
//
// Make sure to have a Cargo.toml file with this content:
#!/bin/python3
"""
Converts flac files to opus, preserving audio quality but with smaller file size.
1. search recursively for *.flac files in the given path
2. convert the file in-place (using ffmpeg)
3. backup the original file into a backup directory
Dependencies: