Skip to content

Instantly share code, notes, and snippets.

View fellipec's full-sized avatar
👨‍💻
Coding for fun.

Luiz Fellipe Carneiro fellipec

👨‍💻
Coding for fun.
View GitHub Profile
@fellipec
fellipec / ihatewebp.sh
Created May 26, 2022 21:49
I Hate WEBP
#!/bin/bash
for i in *.webp; do ffmpeg -i "$i" "${i%.webp}.jpg" ; done
for i in *.webm; do ffmpeg -i "$i" "${i%.webm}.mp4" ; done
@fellipec
fellipec / sshfallback.py
Created September 17, 2022 10:17
Connect via SSH to a host with multiple IPs, checking which is online first
import os
# Try to connect to a socket
def isOpen(ip,port):
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(2)
try:
s.connect((ip, int(port)))
s.shutdown(2)
@fellipec
fellipec / filter.txt
Created January 2, 2023 12:24
Filtro anti-paywall
paywall*
*paywall
! Los Angeles Times (latimes.com)
||californiatimes.com^*/Bootstrap.js$script
||californiatimes.com/meter/$script
||californiatimes.com/meteringjs/$script
||californiatimes.com/newsletter-campaign-manager/$script
! The New York Times (nytimes.com)
||meter-svc.nytimes.com^
||nytimes.com^*/metered_assets/
@fellipec
fellipec / sinal_rnd.py
Created June 16, 2023 16:41
Sinal musical aleatório
#!/usr/bin/python3
import os
import random
import subprocess
diretorio = "sinal/"
arquivos = os.listdir(diretorio)
arquivo_aleatorio = random.choice(arquivos)
subprocess.run(["mpg123", os.path.join(diretorio, arquivo_aleatorio)])
@fellipec
fellipec / pudim.txt
Created June 23, 2023 16:03
Pudim de Leite Condensado sem Furinhos
Ingredientes pudim de leite condensado:
2 latas de leite condensado
1 medida da lata de leite
2 ovos + 1 gema
1 xícara de açúcar cristal
Levar o leite condensado, o leite e os ovos ao liquidificador.
Bater por pelo menos 5 minutos.
Deixar descansando por pelo menos outros 5 minutos, enquanto faz a calda.
Esse processo é importante para que o pudim fique sem furinhos.
@fellipec
fellipec / netwatch.sh
Created June 26, 2023 12:20
NetworkManager watchdog
#!/bin/bash
ping -c 1 1.1.1.1
received=$?
echo $received
if [[ $received -ne 0 ]] ; then
service NetworkManager restart
fi
@fellipec
fellipec / 99-usb-sync.rules
Created July 1, 2023 23:42
Disable write cache for USB drives in Linux
#/etc/udev/rules.d/99-usb-sync.rules
# rule to disable write cache for usb storage
# requires hdparm to be installed
ACTION=="add|change", KERNEL=="sd[a-z]", ENV{ID_USB_TYPE}=="disk", RUN+="/usr/bin/hdparm -W 0 /dev/%k"
@fellipec
fellipec / luks.md
Created July 7, 2023 15:54
Create a LUKS Encrypted Disk Image

Create LUKS Encrypted Disk Image

Create an empty virtual disk

dd if=/dev/zero of=/home/user/luksvolume1 bs=1M count=512

Format/encrypt it with LUKS

@fellipec
fellipec / record.sh
Last active July 14, 2023 19:47
Record from RTSP IP Camera
#!/usr/bin/bash
# Change to recording directory
cd /samba/ipcam
# Amount of time of the recording session
# Adjust to match the cron schedule
end=$((SECONDS+3599))
@fellipec
fellipec / temperatures.txt
Created July 19, 2023 02:18
Filament drier temperatures
Dryer Drying
Filament Temperature Time (Hours)
PLA 55°C (131°F) > 6
ABS 65°C (149°F) > 6
PETG 65°C (149°F) > 6
Nylon 75°C (167°F) > 24
Desiccants 65°C (149°F) > 6
PVA 45°C (113°F) > 24
TPU/TPE 55°C (131°F) > 8