Skip to content

Instantly share code, notes, and snippets.

View lukemerrett's full-sized avatar

Luke Merrett lukemerrett

View GitHub Profile
@lukemerrett
lukemerrett / redis_memory_diagnosis.py
Created April 7, 2026 12:22
Redis Memory Diagnosis Script — analyze memory usage, key prefix distribution, TTL coverage, and big keys on any Redis instance
#!/usr/bin/env python3
"""
Redis Memory Diagnosis Script
Connects to a Redis instance and produces a comprehensive memory analysis:
- Memory summary (used, peak, RSS, fragmentation, eviction stats)
- Replication topology (master/replica, connected replicas)
- Keyspace overview (key counts, TTL coverage per DB)
- Key prefix distribution (what categories of keys exist and how much space they use)
- TTL analysis per prefix (which prefixes lack TTLs)
@lukemerrett
lukemerrett / check_user_sync_groups.py
Created March 19, 2026 12:50
Diagnostic and fix scripts for Doist/Issues#19650 — workspace projects disappearing from sidebar due to incorrect UserProjectModel.is_archived=True
"""
Diagnostic script: investigate why UserProjectModel.is_archived=True
for projects the user hasn't intentionally archived.
Usage (production console):
exec(open("scripts/check_user_sync_groups.py").read())
check_user(13650801)
"""
from __future__ import annotations
@lukemerrett
lukemerrett / 01_StateMachineDefinition.json
Last active November 25, 2019 12:47
AWS Step Functions Workshop - Code Snippets
{
"StartAt": "Create User",
"States": {
"Create User": {
"Type": "Task",
"Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME",
"Next": "Assign Roles"
},
"Assign Roles": {
"Type": "Task",
@lukemerrett
lukemerrett / Program.cs
Last active November 26, 2018 13:36
When Does Await Actually Wait
using System;
using System.Threading;
using System.Threading.Tasks;
namespace WhenDoesAwaitActuallyWait
{
public class Program
{
public static void Main(string[] args)
{
@lukemerrett
lukemerrett / CalculateACICosts.fsx
Created May 6, 2018 15:00
Calculates the cost of an Azure Container Instances container
// Calculates the cost of an Azure Container Instances container
// Using the default Linux container with 1 vCpu and 1.5GB vRAM
[<Measure>] type gb
[<Measure>] type cores
[<Measure>] type sec
[<Measure>] type gbPerSec = gb/sec
[<Measure>] type corePerSec = cores/sec
@lukemerrett
lukemerrett / Basic_Game.lua
Created October 30, 2017 20:07
Basic Pico-8 Game
in_progress = 0
start_end_game = 1
game_over = 2
left=0 right=1 up=2 down=3
valid_moves = {left,right,up,down}
function _init()
player = {}
player.x = flr(rnd(120))