Skip to content

Instantly share code, notes, and snippets.

3 layers:

  • default
    • there are no include rules
    • exclude rules are in one of ignore.d.workstation, ignore.d.server, or ignore.d.paranoid
      • exclude rule directory is based on "report level" in logcheck.conf
    • subject line option in logcheck.conf is EVENTSUBJECT
  • security/violations
    • include rules are in violations.d
  • exclude rules are in violations.ignore.d
#!/bin/bash
set -euo pipefail
trap 'git checkout -q main' EXIT
trap 'git checkout -q main' INT
git checkout -q main
for commit in $(git rev-list HEAD); do
git checkout -q "$commit"
if grep -q init webroot/admin/pi-mgmt.php; then
echo "init found! $commit"
exit
@simonLeary42
simonLeary42 / a_dark2light.py
Last active August 24, 2025 22:56
convert colors from dark mode to light mode
import re
import sys
import colorsys
def clamp(x, _min, _max):
return max(_min, min(x, _max))
def hsl_clamp_l(hex: str, _min: float, _max: float):
import sys
import shutil
import argparse
from PIL import Image
parser = argparse.ArgumentParser()
parser.add_argument("path")
parser.add_argument("--width", type=int, default=None)
parser.add_argument("--height", type=int, default=None)
args = parser.parse_args()
def _cluster(sorted_nums_ids: list[tuple[int, str]], max_reduction: int) -> list[tuple[int, str]]:
"cluster integers by reducing them by no more than max_reduction"
# if the entire range can be reduced to equal the lowest number without violating max_reduction
if sorted_nums_ids[-1][0] - sorted_nums_ids[0][0] <= max_reduction:
new_num = sorted_nums_ids[0][0]
return [(new_num, _id) for _, _id in sorted_nums_ids]
# divide and conquer. split the range at the biggest gap
# for each element, the corresponding gap is the distance between it and the previous element
gaps = [-1]
for i, (num, _) in enumerate(sorted_nums_ids[1:], start=1):
todos_fixmes:
image: alpine
script:
- apk add ripgrep curl
- todo_count="$(rg TODO . | wc -l)"
- fixme_count="$(rg FIXME . | wc -l)"
- curl "https://shields.io/badge/TODOs-$todo_count-blue" > todos.svg
- curl "https://shields.io/badge/FIXMEs-$fixme_count-red" > fixmes.svg
artifacts:
paths:
ICAgICAgICAgIBtbMzg7NTs5N23iloHiloLiloPiloTiloTiloTiloTiloPiloLiloEbWzBtCiAg
ICAgIBtbMzg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0beKWgxtbNDg7MjsxMjk7MTI1OzE5NG0bWzM4OzI7MTI4
OzEyMjsxOTNt4paEG1s0ODsyOzEyOTsxMjM7MTkzbRtbMzg7MjsxMjg7MTIwOzE5MW3iloQbWzQ4
OzI7MTI4OzEyMTsxOTJtG1szODsyOzEyNzsxMTg7MTkwbeKWhBtbNDg7MjsxMjk7MTIwOzE5MG0b
WzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MTMyOzEyMTsxOTBt4paHG1szODsyOzEzMDsxMTg7MTg4
beKWhRtbMzg7MjsxMzQ7MTIwOzE4OG3iloMbWzBtCiAgICAgG1szODsyOzEzMDsxMjg7MTk2beKW
@simonLeary42
simonLeary42 / fmt_color.py
Created January 22, 2025 02:51
like GNU `fmt` with ANSI color support
#!/usr/bin/env python3
import re
import sys
import string
MAX_LINE_LEN = 80
ANSI_ESCAPE_SEQUENCE = re.compile(r"\x1b\[[0-9;:]*?m")
ALL_ASCII_CHARS = {chr(i) for i in range(128)}
ALLOWED_CHARS = (ALL_ASCII_CHARS - set(string.whitespace)).union({" ", "\n"})
; Stewie Tweaks INI
; New options are generated when the game is launched
[INI]
; allow INIs in the Tweaks\INIs folder to overwrite the main INI
bMultiINISupport = 1
; show [SECTION] SETTING when viewing subsettings in tweaks' menu