Skip to content

Instantly share code, notes, and snippets.

@h3po
h3po / etc_default_usbredirect
Created July 31, 2024 12:28
let udev start usbredirect as systemd service, using a static port per usb port location. requires usbredirect >= 0.14
USBREDIRECT_1_5_1=0.0.0.0:7000
USBREDIRECT_1_5_2_1=0.0.0.0:7001
USBREDIRECT_1_5_2_2_1=0.0.0.0:7002
USBREDIRECT_1_5_2_2_2=0.0.0.0:7003
USBREDIRECT_1_5_4=0.0.0.0:7004
USBREDIRECT_1_5_2_4=0.0.0.0:7005
USBREDIRECT_1_5_2_3=0.0.0.0:7006
@h3po
h3po / docker-mailserver
Created February 1, 2023 16:22
docker-mailserver ldap auth with AD userprincipalname and group delivery
LOG_LEVEL=debug
ONE_DIR=1
ENABLE_AMAVIS=0
ENABLE_OPENDKIM=0
ENABLE_OPENDMARC=0
ENABLE_CLAMAV=0
ENABLE_FAIL2BAN=0
ENABLE_SASLAUTHD=1
SASLAUTHD_MECHANISMS=rimap
SASLAUTHD_MECH_OPTIONS=127.0.0.1
@h3po
h3po / bookworm-secureboot-uki-lvm-luks-raid1.md
Last active December 16, 2022 16:12
Debian bookworm secure-booting unified kernel from lvm on luks on md raid1
@h3po
h3po / conf.py
Last active September 22, 2022 15:00
openvpn verify script that checks ldap group membership and certificate ocsp status
LDAP_SERVER = "ipa.my.domain"
LDAP_USER_BASE = "cn=users,cn=accounts,dc=my,dc=domain"
LDAP_BINDDN = "uid=svc_openvpn_ldap,cn=users,cn=accounts,dc=my,dc=domain"
LDAP_BINDPW = "password"
LDAP_ATTR = "commonName"
CERT_ATTR = "X509_0_CN"
LDAP_GROUP = "cn=VPN,cn=groups,cn=accounts,dc=my,dc=domain"
LDAP_GROUP_SEARCH_RECURSIVE = True
@h3po
h3po / ansible-get-debian-coudimage.yml
Last active April 24, 2022 17:50
ansible tasks for getting the url and checksum of a debian cloud image
---
- name: example playbook for downloading the latest debian cloud vm image
hosts: localhost
vars:
debian_cloudimage_repo_subdir: bullseye/daily
debian_cloudimage_type: genericcloud-amd64
debian_cloudimage_format: qcow2
debian_cloudimage_repo_url: "https://cloud.debian.org/images/cloud/{{ debian_cloudimage_repo_subdir }}/"
debian_cloudimage_release: latest
tasks:
@h3po
h3po / import-switch-certificates.yml
Last active August 11, 2021 13:07
Ansible Playbook using the community.ciscosmb module to import externally generated ssl certificates to cisco small business series (SG300/SG500/SG550) switches. Standard PKCS#8 PEM files are converted to PKCS#1 format cisco wants.
#run with -e certdir=/some/path to point at the dir with your {{ inventory_hostname }}.pem and .key files
- name: import wildcard certificate to the switches
hosts: cisco_switch
gather_facts: false
become: false
vars:
certpath: "{{ certdir }}/{{ inventory_hostname }}.pem"
keypath: "{{ certdir }}/{{ inventory_hostname }}.key"
ansible_connection: network_cli
@h3po
h3po / output.txt
Last active November 4, 2020 23:25
Raycast sphere sampling mockup
scanradius = 50000.0
set point distance = 256.0
num_pts = 610352
scantime = 2441798s = 40696.6m = 678.3h
too many points to run k nearest neighbors
--
scanradius = 25000.0
set point distance = 256.0
@h3po
h3po / snmp.yml
Created October 9, 2020 12:18
prometheus snmp_exporter snmp.yml for utimaco cslan v5 hsm (UTIMACO-CSLAN-MIB)
# WARNING: This file was auto-generated using snmp_exporter generator, manual changes will be lost.
utimaco-cslan:
walk:
- 1.3.6.1.4.1.3159
metrics:
- name: cslVersion
oid: 1.3.6.1.4.1.3159.1.1.1
type: DisplayString
help: CryptoServer LAN version - 1.3.6.1.4.1.3159.1.1.1
- name: cslSerialNumber
@h3po
h3po / backup-dashboards.py
Created July 20, 2018 11:04
Quick script to export all grafana (5.0) dashboards as json
import requests
import json
headers = {
"Authorization": "Bearer <insert an admin token here>"
}
endpoint = "https://<grafanahostname>/api"
dashboards = requests.get(endpoint + "/search", headers=headers, verify=False).json()
@h3po
h3po / unitec_send.c
Created March 3, 2018 09:37
WiringPi code for sending signals to my 433MHz remote controlled wall sockets labeled with "unitec EIM-209 48111". The protocol is quite different from other remotes, the remote unit sends each code in multiple different ways and also cycles between 4 different codes for each button. I have not spent the time to figure out how/if the address and…
#include <wiringPi.h>
#include <stdio.h>
#include <stdlib.h>
#define PIN 8
#define PERIOD 1500
#define SHORT 440 //short pulse == 1 in rtl_433 output
#define LONG 940
#define LONGLOW 1140
#define LONGHIGH 2940