Skip to content

Instantly share code, notes, and snippets.

View Nezteb's full-sized avatar
💣
hello world'); DROP TABLE Statuses;--

Noah Nezteb

💣
hello world'); DROP TABLE Statuses;--
View GitHub Profile
defmodule Mix.Tasks.RecompileStats do
@moduledoc """
Minimal Mix task reimplementation of "files that cause the most recompiles" and "files that get recompiled most often" from:
- https://github.com/axelson/dep_viz
- https://depviz.jasonaxelson.com/
Usage: `mix recompile_stats`
"""
use Mix.Task
@Nezteb
Nezteb / bw-ssh-import.sh
Last active May 24, 2026 22:00
Import existing SSH keys into Bitwarden via the CLI. Related to: https://github.com/bitwarden/clients/issues/18833
#!/bin/bash
# Usage: ./bw-ssh-import.sh "My SSH Key Name" ~/.ssh/id_ed25519 ~/.ssh/id_ed25519.pub
# Requires `bw` and `jq`.
NAME=$1
PRIVATE_KEY_PATH=$2
PUBLIC_KEY_PATH=$3
if [[ -z "$NAME" || -z "$PRIVATE_KEY_PATH" || -z "$PUBLIC_KEY_PATH" ]]; then
# Quake III algorithm - Fast inverse square root using binary pattern matching + Performance Test!
```elixir
Mix.install([
{:stream_data, "~> 1.2"}
])
```
## Section
graph TB
    PG[property graph]
    WG[weighted graph]
    LG[labeled graph]
    SG[semantic graph]
    DG[directed graph]
    RDF[rdf graph]
    MG[multi-graph]
 SIM[simple graph]
---
config:
  theme: 'default'
---
%% Diagram in progress
%% Refs:
%% - https://jepsen.io/consistency/models
%% - https://antithesis.com/resources/reliability_glossary/#consistency-models
%% 
# Test with different integer sizes
small_int = 42
medium_int = 123_456
large_int = 9_876_543_210
small_str = "42"
medium_str = "123456"
large_str = "9876543210"
Benchee.run(
@Nezteb
Nezteb / .rules
Created June 10, 2025 22:21
My own general rules file (some parts are pretty specific to Elixir, but hopefully mostly helpful
# General AI Notes
## The Golden Rule
When unsure about implementation details, ALWAYS ask the developer.
### Guidelines
- Add specially formatted anchor comments throughout the codebase, where appropriate, for yourself as inline knowledge that can be easily `grep`'d for.
- Use `AIDEV-NOTE:`, `AIDEV-TODO:`, or `AIDEV-QUESTION:` (all-caps prefix) for comments aimed at AI and developers.
@Nezteb
Nezteb / settings.jsonc
Last active July 10, 2025 20:58
Example ~/.config/zed/settings.json file for using OpenRouter models as OpenAI-compatible provider
{
// > "Edit Predictions" provided by Zed's own Zeta model or
// > by external providers like GitHub Copilot or Supermaven.
"show_edit_predictions": false,
// > "Code Completions" provided by Language Servers (LSPs)
// > automatically installed by Zed or via Zed Language Extensions.
"show_completions_on_input": true,
"format_on_save": "off",
"features": {
"edit_prediction_provider": "copilot"
@Nezteb
Nezteb / test_helpers.ex
Created February 12, 2025 19:31
Elixir ExUnit helper for asserting that two maps (or structs) have equal values at the specified paths.
defmodule TestHelpers do
import ExUnit.Assertions, only: [assert: 2, flunk: 1]
@spec assert_nested_paths_equal(map(), map(), [atom()]) :: :ok
def assert_nested_paths_equal(map1, map2, paths) do
Enum.each(paths, fn path ->
with {:ok, value1} <- get_nested_field(map1, path),
{:ok, value2} <- get_nested_field(map2, path) do
assert value1 == value2,
"Path #{inspect(path)} differs: #{inspect(value1)} != #{inspect(value2)}"
@Nezteb
Nezteb / Deterministic_Simulation_Testing.exs
Last active February 5, 2025 20:03
Playing around with DST and ExUnit seed generation.
defmodule Simulator do
@moduledoc """
Handles parsing of different seed formats for simulation purposes.
Supports Git hashes, ISO8601 dates, and normal integer seeds.
Based on:
- https://docs.tigerbeetle.com/about/vopr/
- https://github.com/tigerbeetle/tigerbeetle/blob/main/docs/HACKING.md#simulation-tests
- https://github.com/tigerbeetle/tigerbeetle/blob/main/src/testing/fuzz.zig#L72-L90
- https://github.com/whatyouhide/stream_data/blob/main/lib/ex_unit_properties.ex#L674-L689