Skip to content

Instantly share code, notes, and snippets.

View dmcallejo's full-sized avatar

dmcallejo dmcallejo

View GitHub Profile
@dmcallejo
dmcallejo / fix-bcm4331.sh
Last active January 28, 2024 17:43
Fix for unstable and freezing Wi-Fi connection with Broadcom BCM4331 (i.e. Macbook Pro Early 2011). Also improves Wi-Fi speed.
sudo apt install --reinstall bcmwl-kernel-source
sudo modprobe -rv bcma
sudo modprobe -v wl
@dmcallejo
dmcallejo / gist:f426f9eaa9a968e18c66f1177e9894b2
Created January 5, 2024 19:58
Filename date to EXIF date
#!/bin/bash
FILES=$1*.*g
REGEX='.*(\d{4})-?(\d{2})-?(\d{2})(?>-|_|\s(?>at\s)?)(\d{2})(?>\.|-)?(\d{2})(?>\.|-)?(\d{2}).*'
for f in $FILES
do
echo -n "$f:"
date=$(echo "$f" | perl -ne 'print if m/'"$REGEX"'/' | perl -pe 's/'"$REGEX"'\..*/"$1:$2:$3 $4:$5:$6"/g')
if [ -n "$date" ]; then
echo $date
@dmcallejo
dmcallejo / reboot_genexis
Last active January 2, 2023 23:19
Programatically reboots Genexis routers used by ISPs like Adamo in Spain.
#!/bin/sh
help()
{
echo "Usage: reboot_genexis [ -p | --password (REQUIRED) ]
[ -u | --user default: user]
[ -h | --host default: 192.168.1.1 ]
[ --help ]"
exit 2
}
@dmcallejo
dmcallejo / gist:3aef05029222eb38604a61b1623784c8
Created November 16, 2022 10:41
Fix for "Too short!" error on avidemux
# This will recreate timestamps on the stream allowing avidemux to export the file. Note that the output has to be a Matroska container.
ffmpeg -start_at_zero -copyts -i input_file.ts -map 0:v -c copy -map 0:a:0 output_file.mkv
@dmcallejo
dmcallejo / grab-magnets-from-watchdir.custom-cont-init-script
Created January 4, 2022 16:04
Add magnet files from watch dir to transmission (with authentication, for linuxserver.io docker image)
#!/bin/bash
# Filename: grab-magnets-from-watchdir.custom-cont-init-script
# Save this file in /config/custom-cont-init.d/
# This way it will run everytime the container is created and will add the crontab entry and transmission authentication
# Save env files to get authentication
printenv | sed 's/^\(.*\)$/export \1/g' > /root/container.env
# Add entry to crontab, runs every minute
echo '* * * * * . /root/container.env; /config/grab-magnets-from-watchdir.sh' >> /etc/crontabs/root
@dmcallejo
dmcallejo / generate_ssl_cert.sh
Created June 17, 2020 10:46
Generate SSL self signed cert and key unattended
#!/bin/bash
# This line generates a self signed SSL certificate and key without user intervention.
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/C=AU/ST=Some-State/L=Sydney/O=Internet/OU=./CN=./emailAddress=."