Skip to content

Instantly share code, notes, and snippets.

View bmordue's full-sized avatar

Ben Mordue bmordue

  • Edinburgh, Scotland
View GitHub Profile
@bmordue
bmordue / pip8_check.py
Created September 26, 2025 09:23
Enforce Python PIP8, for use for example as a pre-commit hook
#!/bin/bash
# Pre-commit hook for Python PEP 8 enforcement
# Place this file at .git/hooks/pre-commit and make it executable
set -e # Exit on any error
# Configuration
MAX_LINE_LENGTH=88 # Black's default, change to 79 for strict PEP 8
IGNORE_ERRORS="E203,W503" # Errors to ignore (Black compatibility)
AUTOFIX=${AUTOFIX:-false} # Set to true to auto-fix issues
int mazeSize = 184;
int cellSize = 4;
int[][] maze;
void setup() {
size(mazeSize * cellSize, mazeSize * cellSize);
maze = new int[mazeSize][mazeSize];
generateMaze();
save("maze.bmp");
}
@bmordue
bmordue / gist:749523ae322faff99a7e979ebdd89c37
Last active October 3, 2022 20:06
List names of my starred github repos with the "hacktoberfest" topic
# using gh cli's built-in jq flag, and use --paginate to get all pages!
gh api /users/bmordue/starred --paginate \
--jq '. | map(select((.topics | contains(["hacktoberfest"])))) | map(.full_name)'
@bmordue
bmordue / gist:a1a0fe62bed56fccaae75b4185abe02d
Created October 31, 2019 10:15
Rlang error subclasses - explicit subclass overwritten by default
outerFn <- function() {
rlang::with_handlers(
innerFn(),
error = ~ rlang::abort("Outer error", parent = .)
)
}
innerFn <- function() {
rlang::abort("Inner error", .subclass = "inner")
}