Skip to content

Instantly share code, notes, and snippets.

View Torstein-Eide's full-sized avatar

Torstein Eide Torstein-Eide

View GitHub Profile
@Torstein-Eide
Torstein-Eide / librenms-snmp-extension-myext-install.sh
Last active May 24, 2026 13:02
Install script skeleton for a snmp exsension
#!/usr/bin/env bash
#---------------------------------------------------------------------------------------------------------------
#
# Script name : librenms-snmp-extension-myext-install.sh
# Description : EXAMPLEInstall script for LibreNMS SNMP extension "myext"
# Repository : <https://github.com/example/myext>
# Version : 1.0.0
# Author : Your Name <your.email@example.com>
# License : MIT
@Torstein-Eide
Torstein-Eide / etc_bash_completion.d_shutdown.bash
Last active May 22, 2026 11:49
bash_completion for shutdown
# /etc/bash_completion.d/shutdown
# Bash completion for systemd shutdown
_shutdown_completion()
{
local cur prev words cword
_init_completion || return
local opts="
--help
@Torstein-Eide
Torstein-Eide / setup-x11sae-m-sensors.bash
Created May 15, 2026 11:23
Configuration of sensors for supermicro X11 motherboards
#!/usr/bin/env bash
set -euo pipefail
SENSORS_CONF="/etc/sensors.d/supermicro-x11sae-m.conf"
MODULE_CONF="/etc/modules-load.d/nct6775.conf"
require_root() {
if [[ "${EUID}" -ne 0 ]]; then
echo "Error: this script must be run as root."
echo "Use: sudo $0"
@Torstein-Eide
Torstein-Eide / btrfs-raid-error-lab.sh
Created April 13, 2026 20:56
Shell script go generate disk corruptions and different states.
#!/usr/bin/env bash
set -euo pipefail
# Small interactive btrfs RAID lab to generate checksum/scrub errors
# for LibreNMS polling tests.
WORKDIR="${WORKDIR:-/tmp/btrfs-raid-lab}"
MNT="${MNT:-/mnt/btrfs-raid-lab}"
RAID_LEVEL="${RAID_LEVEL:-raid1}"
IMG_SIZE="${IMG_SIZE:-2G}"
@Torstein-Eide
Torstein-Eide / SNTP.c
Created December 28, 2025 12:56
Simple Network Time Protocol (SNTP) example (Header Processing, error handling, verbose output, updates linux server)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <errno.h>
@Torstein-Eide
Torstein-Eide / .install-bitwarden-CLI.sh
Last active March 2, 2025 16:39
install-bitwarden-CLI for linux, used with chezmoi
#!/bin/sh
# Torstein Eide
# Install Bitwarden CLI
# Exit immediately if Bitwarden CLI (bw) is already in $PATH
test_if_installed() {
type bw >/dev/null 2>&1
@Torstein-Eide
Torstein-Eide / apache2_pihole.md
Created May 24, 2024 18:54 — forked from GAS85/apache2_pihole.md
Apache2 config for pihole with custom / non-admin link
@Torstein-Eide
Torstein-Eide / arch_linux_installation.md
Created January 23, 2024 09:33 — forked from orhun/arch_linux_installation.md
Notes on my Arch Linux installation: UEFI/Secure Boot + systemd-boot, LUKS-encrypted root (XFS), LUKS-encrypted swap (with hibernate & unlocked via TPM)
@Torstein-Eide
Torstein-Eide / To_trubleshoot.sh
Last active November 26, 2022 21:55
Getting OSPF to work with Pfsense FRR, linux quagga, wireguard
tcpdump -i tun_wg0 -n "ip[9] == 89" -vv
#!/bin/bash
set -ex
declare -a DISTS=("precise" "trusty")
ARCHS="amd64"
function register-mirror {
UBUNTU_URI='http://jp.archive.ubuntu.com/ubuntu/'
ROS_URI='http://packages.ros.org/ros/ubuntu'