Skip to content

Instantly share code, notes, and snippets.

@delaosa
delaosa / test-vpnspace.service
Created February 10, 2025 18:51 — forked from brauliobo/test-vpnspace.service
OpenVPN network namespace service and sample unit returning its public IP address
[Unit]
Description=Test NetworkNamespacePath with DynamicUser
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
# Use DynamicUser to create a temporary user for the service
DynamicUser=true
@delaosa
delaosa / jq-cheetsheet.md
Created October 31, 2022 16:02 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@delaosa
delaosa / low_disk_space.yaml
Last active March 16, 2022 09:29
HA Blueprint - Low disk space
blueprint:
name: Low disk space detection & notification for all disks
description: Regularly test all sensors with 'disk' device-class for crossing
a certain disk level threshold and if so execute an action.
domain: automation
input:
threshold:
name: disk warning level threshold
description: disk sensors above threshold are assumed to be low-disk (as
well as binary disk sensors with value 'on').
@delaosa
delaosa / dijkstra.py
Created March 1, 2021 08:33 — forked from dingran/dijkstra.py
Python implementation of Dijkstra's algorithm, single source all desinations and single source single destination
from collections import defaultdict
def build_graph(edge_list):
graph = defaultdict(list)
seen_edges = defaultdict(int)
for src, dst, weight in edge_list:
seen_edges[(src, dst, weight)] += 1
if seen_edges[(src, dst, weight)] > 1: # checking for duplicated edge entries
continue
@delaosa
delaosa / openconnect_vpn_inside_netns.sh
Created June 17, 2019 21:28 — forked from nehaljwani/openconnect_vpn_inside_netns.sh
OpenConnect VPN Inside Linux Network Namespace
#!/bin/bash
# start openconnect tunnel and shell inside Linux network namespace
#
# this is a fork of schnouki's script, see original blog post
# https://schnouki.net/posts/2014/12/12/openvpn-for-a-single-application-on-linux/
#
# original script can be found here
# https://gist.github.com/Schnouki/fd171bcb2d8c556e8fdf
# ------------ adjust values below ------------
@delaosa
delaosa / arch-linux-install
Created May 28, 2019 21:39 — forked from binaerbaum/arch-linux-install
Minimal instructions for installing arch linux on an UEFI NVMe system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swiss-french keymap