Skip to content

Instantly share code, notes, and snippets.

View Swiddis's full-sized avatar

Simeon Widdis Swiddis

View GitHub Profile
@Swiddis
Swiddis / README
Last active September 18, 2025 16:51
Grad script (Gradle helper for OS SQL)
Quick helper script for using Gradle like Cargo in the OpenSearch-SQL project:
- grad check: Fast build checks w/o any tests or slower final assembly
- grad build: The above, but also do compilation of artifacts
- grad run: Start a cluster (w/ some extra heap, too)
- grad bench: Run for benchmarking (no debug server, more heap) -- differs from "cargo bench" in it doesn't actually run any benchmarks on its own.
- grad fmt: Format your stuff
- grad integ: E2E tests
Otherwise, it just falls back to whatever Gradle command.
@Swiddis
Swiddis / failure_on_c012a513.txt
Created September 11, 2025 18:48
Hypothesis testing OpenSearch's boolean operators
Traceback (most recent call last):
File "/Users/sawiddis/Documents/code/hypothesis-demo/main.py", line 132, in <module>
File "/Users/sawiddis/Documents/code/hypothesis-demo/main.py", line 117, in test_boolean_expression_generation
@settings(max_examples=200, deadline=2000)
^^^
File "/Users/sawiddis/Documents/code/hypothesis-demo/.venv/lib/python3.13/site-packages/hypothesis/core.py", line 2124, in wrapped_test
raise the_error_hypothesis_found
File "/Users/sawiddis/Documents/code/hypothesis-demo/main.py", line 130, in test_boolean_expression_generation
assert os_result["hits"]["total"]["value"] == int(result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@Swiddis
Swiddis / Cargo.toml
Last active July 10, 2025 19:33
Slog: sorted log diving CLI
[package]
name = "slog"
version = "0.2.0"
edition = "2024"
[dependencies]
colored = "3.0.0"
glob = "0.3.2"
itertools = "0.14.0"
@Swiddis
Swiddis / enc_simanneal.py
Last active March 27, 2025 01:30
5-bit letter assignments that minimize the chance of english words being confused on a bit flip
from tqdm import tqdm
import collections as col
import itertools as it
import simanneal
import random
BIT_WIDTH = 5
ALPHABET = 'abcdefghijklmnopqrstuvwxyz'
A = ord('a')
@Swiddis
Swiddis / xorwow.rs
Last active February 23, 2025 06:26
Tiny Random Number Generator
/// Tiny pseduorandom generator with injectible randomness Meant for those cases
/// where I just want some numbers and don't care about robustness, and don't
/// want to import the whole `rand` crate Uses XorWow for the main algorithm,
/// and uses a running DJB hash to inject more randomness.
pub struct XorWow {
state: [u32; 5],
djb: u32,
ctr: u32,
}
@Swiddis
Swiddis / README.md
Last active April 6, 2024 20:54
Project Euler Prolog

Project Euler in Prolog

This is a gist where I'm stashing solutions to Project Euler problems in Prolog, and maybe talking about some stuff I've learned.

Prolog is a logical programming language. Each program consists of a Knowledge Base, which defines several predicates and under what conditions they're true. Running a program starts an interactive shell where you can query this knowledge

@Swiddis
Swiddis / README.md
Last active February 6, 2025 17:15
Make OS Release Notes

Create OS Release Notes

  1. Find the start and end commit hashes for the repo you want to make release notes for
  2. Generate the notes

Requires Python 3.10+ for consistent results since it depends on dict being ordered, but should still run without errors for lower versions.

Example Usage

@Swiddis
Swiddis / Dockerfile
Last active February 14, 2024 19:39
OS Build Helper
FROM debian:bullseye AS base
# Set up dependencies: Gradle, Doctest, JDK
RUN apt-get update && apt-get install -y \
# Core deps for Gradle and integTest
curl wget zip openjdk-17-jdk \
# Doctest dependencies
procps git python3 python3-pip python3-venv \
&& rm -rf /var/lib/apt/lists/*
RUN export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
@Swiddis
Swiddis / quine.py
Created February 6, 2024 22:45
Python Quine
s = r"print(f's = r\"{s}\"\n{s}')"
print(f's = r\"{s}\"\n{s}')
import requests
import statistics
import time
from tqdm import tqdm
def make_request(url):
start_time = time.time()
response = requests.get(url)
end_time = time.time()
return response, end_time - start_time