Skip to content

Instantly share code, notes, and snippets.

View fionn's full-sized avatar
🦨
wars are waged by technicians

Fionn Fitzmaurice fionn

🦨
wars are waged by technicians
View GitHub Profile
@fionn
fionn / nuphy_air75_v2.remapped.json
Created October 6, 2024 10:59
Nuphy Air75 V2 function keys and menu for print area
{
"name": "NuPhy Air75 V2",
"vendorProductId": 435499590,
"macros": ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
"layers": [
[
"KC_ESC",
"KC_F1",
"KC_F2",
"KC_F3",
#!/usr/bin/env python
from dataclasses import dataclass
@dataclass
class Map:
code_point: str
character: str
command: str
alt_command: str
@fionn
fionn / .gitignore
Last active June 23, 2024 17:25
Find metadata of images embedded in PDFs
venv/
__pycache__/
.mypy_cache/
@fionn
fionn / aws-sso-list-accounts
Created June 7, 2024 12:43
List AWS SSO accounts
#!/bin/bash
set -euo pipefail
access_token="$(jq -r .accessToken < $(ls -1U ~/.aws/sso/cache/*.json | head -n 1))"
aws sso list-accounts --access-token "$access_token" --output table
@fionn
fionn / pem.regex
Created September 1, 2023 15:44
Hyperscan-compatible regex patterns for private keys
(-----BEGIN ([A-Z0-9]+ )?PRIVATE KEY-----)(\s*[A-Za-z0-9+/\r\n]+={0,2})(\s*-----END ([A-Z0-9]+ )?PRIVATE KEY-----)
@fionn
fionn / stdin.sh
Created June 27, 2023 14:38
Flexible inputs for Bash scripts
#!/bin/bash
set -euo pipefail
function process {
return 0
}
function main {
mapfile -t inputs < <(echo "${1:-$(</dev/stdin)}")
#!/usr/bin/env python3
import boto3 # type: ignore
import requests # type: ignore
REGION = "us-east-1"
IDENTITY_POOL_ID = REGION + ":b73cb2d2-0d00-4e77-8e80-f99d9c13da3b"
def main() -> None:
"""Entry point"""
@fionn
fionn / ssh-agent.service
Created July 22, 2022 16:49
Systemd user service for ssh-agent
[Unit]
Description=SSH agent
[Service]
Type=forking
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK
[Install]
WantedBy=default.target
@fionn
fionn / cleanup_undo_dir.sh
Created July 15, 2022 12:02
Remove Vim undo files when the target doesn't exist anymore
#!/bin/bash
set -euo pipefail
undodir=${XDG_CACHE_HOME:-$HOME/.cache}/vim/undo/
pushd "$undodir" >/dev/null
for undo_file in *; do
real_file=${undo_file//%/\/}
@fionn
fionn / 200-hardening.conf
Created July 12, 2022 16:32
SSHd hardening
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
AllowAgentForwarding no
MaxAuthTries 1
MaxSessions 3
KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org