This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -eu | |
| parse_bundle() { | |
| # https://serverfault.com/questions/590870/how-to-view-all-ssl-certificates-in-a-bundle | |
| openssl crl2pkcs7 -nocrl -certfile $1 | openssl pkcs7 -print_certs | |
| } | |
| echo "Comparing certs in $1 and $2" >&2 | |
| tmpdir=$(mktemp -d) | |
| parse_bundle $1 > $tmpdir/a | |
| parse_bundle $2 > $tmpdir/b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env nix-shell | |
| #! nix-shell <nixpkgs> -i perl -p perl perlPackages.Mojolicious perlPackages.IOSocketSSL | |
| use ojo; | |
| g("https://www.kernel.org")->dom | |
| ->find("table#releases tr") | |
| ->each(sub { | |
| my $td = $_->find("td"); | |
| printf("%13s %-14s %s\n", | |
| map { $td->[$_]->all_text(0) } 0..2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -e | |
| function ver2rev { | |
| echo $1 | perl -pe 's/.+\.(.+?)"?$/$1/g' | |
| } | |
| nixver=$(nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ nix-shell -p libmbim --run "sudo /etc/static/ModemManager/fcc-unlock.d/1eac foo wwan0mbim0" | |
| [/dev/wwan0mbim0] Successfully requested to enable radio |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| (>&2 echo "######### UNSAFE SSH #########") | |
| set -ex | |
| env TERM=xterm ssh -oCiphers=+aes128-cbc -oKexAlgorithms=+diffie-hellman-group-exchange-sha1 -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print join "\n", map { ($_ % 3 == 0 && "fizz") . ($_ % 5 == 0 && "buzz") || $_ } 1..100' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env nix-shell | |
| #! nix-shell -i perl -p "with perl.pkgs; [ perl MetaCPANClient CpanelJSONXS ]" | |
| use v5.36; | |
| use MetaCPAN::Client; | |
| use Data::Dumper; | |
| use Cpanel::JSON::XS; | |
| my $json = Cpanel::JSON::XS->new->ascii; | |
| $json->canonical(1); | |
| my $mcpan = MetaCPAN::Client->new(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ gpg --sign --sig-notation !some.critical.bit@example.org= x.txt | |
| $ gpg --known-notation some.critical.bit@example.org --verify x.txt.gpg |