Skip to content

Instantly share code, notes, and snippets.

function Get-Uptime {
<#
.SYNOPSIS
Gets the uptime of computers.
.DESCRIPTION
Gets the uptime of computers.
.EXAMPLE
@paalbra
paalbra / wireguard.sh
Last active November 26, 2021 16:34
How to Wireguard
# Links
https://www.wireguard.com/install/
https://www.wireguard.com/quickstart/
# Install on Fedora
dnf install -y wireguard-tools
# Install on Raspberry Pi OS
@paalbra
paalbra / raspberrypi-init.sh
Last active October 1, 2024 20:39
Initialization script for Raspberry PI (first boot)
#!/bin/bash
# Steps on a clean Raspberry Pi OS memory card:
# 0. Edit variables at the start of this script
# 1. Add this script to /init.sh
# 2. Add a cronjob /etc/cron.d/init: echo '@reboot root /bin/bash /init.sh 1> /init.log 2>&1 && rm /etc/cron.d/init'
# 3. Add userconf to boot pratition: echo "pi:$(echo 'mypassword' | openssl passwd -6 -stdin)"
# 4. Add configuration for wifi:
# SSID="MySSID"
# PSK="mypassword"
import re
import sys
import bs4
import requests
ref = sys.argv[1]
url = f"https://www.legelisten.no/leger/{ref}"
content = requests.get(url).text
@paalbra
paalbra / test-ca.sh
Last active September 7, 2023 07:41
#!/bin/bash
cat > openssl.cnf <<EOF
[ ca ]
default_ca = ca_default
[ ca_default ]
dir = ./ca
certs = \$dir\certs
crl_dir = \$dir/crl
@paalbra
paalbra / zabbix-vault-test.sh
Created March 18, 2022 19:59
Why you shouldn't use Hashicorp Vault with Zabbix
# Using Hashicorp Vault with Zabbix is not a very good idea
# https://www.zabbix.com/documentation/6.0/en/manual/config/secrets
mkdir /tmp/zabbix-vault-test
cd /tmp/zabbix-vault-test
git clone [email protected]:paalbra/zabbix-simple.git
cd zabbix-simple
echo 'diff --git a/docker-compose.yml b/docker-compose.yml
index 550ef48..c3dd95f 100644
--- a/docker-compose.yml
@paalbra
paalbra / ads-b.md
Last active September 10, 2022 17:12
@paalbra
paalbra / sonoff.md
Last active January 19, 2024 19:11
Sonoff Basic flash
@paalbra
paalbra / du.ps1
Last active December 5, 2022 14:50
DU/DiskUsage PowerShell wrapper around Sysinternals DU
<#
.SYNOPSIS
Command that provides disk usage for a given path.
.DESCRIPTION
Command that provides disk usage for a given path. Needs DU from Sysinternals.
.EXAMPLE