Skip to content

Instantly share code, notes, and snippets.

View lorenzoantei's full-sized avatar
🪛

Lorenzo Antei lorenzoantei

🪛
View GitHub Profile
@lorenzoantei
lorenzoantei / gist:073bbc4b24ac141d9bf2e55bf943c2f1
Created November 7, 2024 14:25
phpMyAdmin on Fedora - fix permission after update
# Cannot start session without errors in phpMyAdmin
# https://stackoverflow.com/questions/5013118/cannot-start-session-without-errors-in-phpmyadmin
[root@centos ~]# cd /var/lib/php/
[root@centos php]# ll
total 12
drwxrwx---. 2 root apache 4096 Jan 30 16:23 opcache
drwxrwx---. 2 root apache 4096 Feb 5 20:56 session
drwxrwx---. 2 root apache 4096 Jan 30 16:23 wsdlcache
@lorenzoantei
lorenzoantei / gist:5ddd7b21476f187f09d440b30ad6ad0e
Created September 13, 2024 07:49
bash auto converter images
#!/bin/bash
# Funzione per rimuovere le virgolette singole dal percorso
sanitize_path() {
echo "$1" | sed "s/^'//;s/'$//"
}
# Chiedi il percorso di origine
read -p "Inserisci il percorso della directory di origine (default: ./): " DIR
DIR=$(sanitize_path "${DIR:-"."}")
clone con indicazione utente
git clone [email protected]{USERNAME}:{GIT-PATH}.git
fix remote
git remote set-url origin [email protected]{USERNAME}:{GIT-PATH}.git
undo last commit before push
alias revert-commit="git reset --soft HEAD~1"
# Colorize Shell
PS1='\[\033[1;36m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h:\[\033[1;35m\]\w\[\033[1;31m\]\$\[\033[0m\] '
@lorenzoantei
lorenzoantei / gist:05e5eba267bf4dfd3d0a6406f1602ffd
Created February 27, 2023 18:33
raspberry python neopixel 101
sudo pip install adafruit-circuitpython-neopixel
sudo pip install rpi-ws281x
# https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/issues/43
#sudo python3 -m pip install --force-reinstall adafruit-blinka
ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist
# Check the directory listing to see if you already have a public SSH key.
# By default, the filenames of supported public keys for GitHub are one of the following.
# id_rsa.pub
# id_ecdsa.pub
# id_ed25519.pub
ssh-keygen -t ed25519 -C "email" # This creates a new SSH key, using the provided email as a label
# RESCUE WINDOWS RAW DISK (D:)
chkdsk D: /F
@lorenzoantei
lorenzoantei / dotenv_smart_bool.py
Created October 31, 2022 15:20
python dotenv smart boolean
import os
from pathlib import Path
from dotenv import load_dotenv
def get_variable(var_name: str) -> bool: #semplificazione lettura bools .env
TRUE_=('true', '1', 't') # Add more entries if you want, like: `y`, `yes`, ...
FALSE_=('false', '0', 'f')
value = os.getenv(var_name, 'False').lower() # return `False` if variable is not set. To raise an error, change `'False'` to `None`
if value not in TRUE_ + FALSE_:
raise ValueError(f'Invalid value `{value}` for variable `{var_name}`')
return value in TRUE_
@lorenzoantei
lorenzoantei / gist:ad24c777370d1bf9fdf3d451da52cc7e
Created September 29, 2022 12:22
autoMount NTFS/EXT4 on boot
# sudo chown $USER /path/dir*
#
# blkid
# nano /etc/fstab
# UUID=******* /path/dir1 ext4 auto,defaults 0 0
# UUID=******* /path/dir2 ntfs-3g rw 0 0
#
# sudo mount -a
ffmpeg -i input.mp4 -map 0 -map_metadata -1 -c copy output.mp4