I often end up looking for certain commands/ code snippets so here is a list.
- Change the server language to English:
export LC_ALL=C
- Look at the username for of who is running a process on a multi-user server:
ps -u -p <PROCESS_ID>
- Re-authenticate with github after your PAT has expired:
gh auth login -h [github.com](http://github.com/)
- Pip install without clogging the cache dir, add a
--no-cache-dir
flag to yourpip install
commands. - Create a virtual environment with
python -m venv <path_to_the_environment>
command. - Run a python script with nohup and pipe the output to a file.
nohup python my_script_is_the_best.py &> my_scripts_output.out 2>&1 &
- Batch convert
wav
files tomp3
files withffmpeg
-for f in *.{wav,WAV}; do ffmpeg -i "$f" -c:a libmp3lame -q:a 2 "${f%.*}.mp3"; done
- Append a prefix to specific files in a directory -
for f in {0,1,2,3,4,5}.mp3; do mv "$f" "GAN_$f"; done