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 / pihole-dhcp.md
Last active March 13, 2025 14:02
Pi-Hole DHCP configuration guide

Introduction

Pi-Hole's primary function is to be a DNS server with the ability to block domains, usually used for advertising, tracking or other unwanted sites. It also features a built-in DHCP Server.

Usually, your router will also have a built-in DHCP server, pre-configured from factory, and for most users this is perfectly fine. But in some cases you may want to run another DHCP server instead of relying on your router's one. This guide will help you understand how a DHCP server works and how to configure it without disturbing your network.

If you already know the networking basics, you can cut to the chase and read just the configuration part

Understanding the IP Addressing

@fellipec
fellipec / everythingisafile.md
Created January 25, 2025 12:18
Everything is a file

To Linux evertything is a file.

When you run mkfs.ext4 /dev/sdx or mkfs.ext4 /dev/sdx1 or even mkfs.ext4 /tmp/dummyfile it doesn't care where it is creating your filesystem, it just does.

Let's demonstrate:

  1. First, let's create a 1GB file in my home dir:
dd if=/dev/zero of=testfile bs=1G count=1 oflag=direct status=progress
@fellipec
fellipec / fingerprint.md
Created November 15, 2024 11:55
Enable finger print authentication, but not for the first login

Enable fingerprint authentication, but not for the first login

Install and enable the fingerprint authentication in pam

First, install the required packages and enable fingerprint support in the PAM configuration:

# Install the module
sudo apt install fprintd libpam-fprintd
@fellipec
fellipec / gpsclock.py
Last active August 7, 2023 17:51
A Clock that use gpsd to read the time from GPS Satellites
#!/usr/bin/python3
import gpsd
import datetime
import os
from time import sleep
from pyfiglet import Figlet
#Figlet needs the terminal width to proper center the text
col = os.get_terminal_size().columns
@fellipec
fellipec / timelapse.sh
Created July 28, 2023 18:12
Record a stream, save to JPEG files and then create a timelapse
ffmpeg -i http://192.168.1.150:8080/?action=stream -vsync cfr -r 0.1 -f image2 '/home/luiz/timelapse/img-%03d.jpg'
ffmpeg -i '/home/luiz/timelapse/img-%03d.jpg' -c:v libx264 -crf 0 '/home/luiz/timelapse.mp4'
@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
@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 / 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 / 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 / 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