Skip to content

Instantly share code, notes, and snippets.

View stigtsp's full-sized avatar
🕊️
peace, pls

Stig stigtsp

🕊️
peace, pls
View GitHub Profile
# connect and save cert
openssl s_client -connect incomplete-chain.badssl.com:443 -servername incomplete-chain.badssl.com -showcerts < /dev/null 2>/dev/null | openssl x509 > downloaded_cert.crt
# fingerprint on cert (openssl)
openssl x509 -sha256 -in downloaded_cert.crt -noout -fingerprint
# same as
openssl base64 -d < downloaded_cert.crt | sha256sum
# check with
openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "/CN=192.168.1.1" -addext "subjectAltName = IP:192.168.1.1" -keyout 192.168.1.1.key -out 192.168.1.1.crt
$ gpg --sign --sig-notation !some.critical.bit@example.org= x.txt
$ gpg --known-notation some.critical.bit@example.org --verify x.txt.gpg
#!/usr/bin/env bash
#
# Quick hack to "install" pure perl modules into $PWD, very fast, by copying the .pm files from the tarball.
# Useful in Dockerfile, requires checksums of the tarball to be provided.
#
# Usage:
# $ cd lib && ../perl-installish-module.sh https://cpan.metacpan.org/authors/id/J/JH/JHTHORSEN/Mojo-mysql-1.17.tar.gz 93cd964760918a43124c3dc65d513372b6d1d00993427894e2f11a1f96662554
#
# Caveats:
# - Does not run tests
services.resolved = {
enable = true;
llmnr = "resolve";
dnssec = "false";
domains = ["~."];
extraConfig = ''
DNS=1.1.1.1
FallbackDNS=1.0.0.1
DNSOverTLS=yes
'';
use v5.34;
use experimental qw(try signatures);
my @errors;
try {
something("/file-that-doesnt-exist");
} catch ($e) {
push @errors, $e;
}
cb8731a17350b2f61ad1c059fc16fd6348530c25e43f631f2691768f767f75c3 Win10_21H1_EnglishInternational_x64.iso
boot.initrd.luks.devices = {
root = {
preLVM = true;
allowDiscards = true;
device = "/dev/disk/by-uuid/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa";
};
};
ssh host 'sudo tcpdump -s0 -U -w - -ni eth0 host 10.0.0.2' | wireshark -k -i -
# For testing services, etc. this forwards port 3000 from localhost to the container
#
# env QEMU_NET_OPTS="hostfwd=tcp::3000-:3000" NIX_PATH=nixpkgs=$HOME/nixpkgs nixos-shell
#
{ pkgs, ... }: {
boot.kernelPackages = pkgs.linuxPackages_latest;
nixos-shell.mounts = {
mountHome = false;
mountNixProfile = false;