Skip to content

Instantly share code, notes, and snippets.

@tomazzaman
tomazzaman / resolver.sh
Created January 2, 2025 17:39
Automatically add hostnames to Pihole whenever containers get updated
#!/bin/sh
#
# Update Pihole's custom.list based on the "hostname" property of a container.
#
# Environment variables
# - OVERRIDE_IP sets the IP of the container in Pihole's DNS records. Defaults to container IP in Docker network.
# - DOMAIN_FILTER only triggers the updates on a match. If empty, it'll always update the records file.
# - PIHOLE_CUSTOM_LIST_FILE /etc/hosts compatible DNS records file in format "IP hostname".
# - PIHOLE_CONTAINER_NAME because we need to reload Pihole's internal resolver when making changes
#
@XtendedGreg
XtendedGreg / Alpine Linux on Raspberry Pi Basics: Using I2C Sensors.md
Last active September 21, 2025 17:29
Alpine Linux on Raspberry Pi Basics: Using I2C Sensors

Alpine Linux on Raspberry Pi Basics: Using I2C Sensors

As featured in the XtendedGreg YouTube Live Stream: https://youtube.com/live/L9yt2NOktGs Alpine Linux on Raspberry Pi Basics: Using I2C Sensors

Introduction

This Gist is a procedure on how to enable I2C functionality on Alpine Linux running on a Raspberry Pi. I2C is a high speed communications interface that allows interacting with sensors and periferals efficiently. In this example, we will be connecting an SHT31-D temperature and humidity sensor to create a basic logger using Python. Follow these steps and you will be well on your way to integrating it into your next project!

Setup Procedure

  1. Enable I2C bus in usercfg.txt file on the root of the boot drive
  • From the console remount the boot drive for read/write
@mymanga
mymanga / firewall_rules.rsc
Last active November 3, 2025 20:00
Mikrotik advanced firewall filter rules
/ip firewall filter
add action=accept chain=input comment="default configuration" \
connection-state=established,related
add action=accept chain=input comment="allow ping" protocol=icmp
add action=accept chain=input comment="snmp & radius coa" dst-port=161,3799 \
in-interface-list=WAN protocol=udp
add action=accept chain=input comment="remote access" dst-port=8728,8291 \
in-interface-list=WAN protocol=tcp
add action=return chain=detect-ddos dst-limit=32,32,src-and-dst-addresses/10s protocol=tcp tcp-flags=syn,ack comment="Mark and Drop SYN ACK attack"
@ghuntley
ghuntley / README.md
Last active May 30, 2025 18:41
a rough prototype for running coder.com as a nixos system service

background

  1. Now that coder is in nixpkgs at https://search.nixos.org/packages?channel=22.11&show=coder&from=0&size=50&sort=relevance&type=packages&query=coder
  2. The next step is to enable running coder in NixOS via services.coder.enable = true;
  3. Thus design configuration options such as https://search.nixos.org/options?channel=22.11&show=services.znc.user&from=0&size=50&sort=relevance&type=packages&query=znc
  4. Refer to https://github.com/NixOS/nixpkgs/blob/nixos-22.11/nixos/modules/services/networking/znc/default.nix for an example of what is to be achieved.

next steps

  1. What configuration options should we expose vs encouraging usage of extraFlags?
<#
Create Unix VM's.
PREREQUISITES:
- A VM that has been installed with an OS that supports cloud-init
- cloud-init is installed on the vm
How it works:
- Asks for a bunch of parameters
- Creates a disk from parent vhdx for speed
@ruanbekker
ruanbekker / k3s_on_alpine.md
Last active September 17, 2025 05:13
Install k3s on Alpine Linux
$ apk add --no-cache curl
$ echo "cgroup /sys/fs/cgroup cgroup defaults 0 0" >> /etc/fstab

$ cat > /etc/cgconfig.conf <<EOF
mount {
  cpuacct = /cgroup/cpuacct;
  memory = /cgroup/memory;
  devices = /cgroup/devices;
  freezer = /cgroup/freezer;
@mattmc3
mattmc3 / README.md
Last active August 2, 2025 04:39
zsh: zstyle examples

zstyle booleans

Setup foo,bar,baz boolean vars

zstyle ':example:foo' doit yes
zstyle ':example:bar' doit no
# leave baz unset
# SSH Agent Functions
# Mark Embling (http://www.markembling.info/)
#
# How to use:
# - Place this file into %USERPROFILE%\Documents\WindowsPowershell (or location of choice)
# - Import into your profile.ps1:
# e.g. ". (Resolve-Path ~/Documents/WindowsPowershell/ssh-agent-utils.ps1)" [without quotes]
# - Enjoy
#
# Note: ensure you have ssh and ssh-agent available on your path, from Git's Unix tools or Cygwin.