Skip to content

Instantly share code, notes, and snippets.

@lolpack
lolpack / pyrefly_check.py
Last active September 30, 2025 22:19
Claude Hooks for Pyrefly
#!/usr/bin/env python3
"""
Claude Code hook: run 'pyrefly check' to keep the repo type-clean.
Behavior
- PostToolUse (after Edit/Write/MultiEdit): fast check of the changed python file if possible,
else fall back to full project check.
- Stop: full project check at iteration end. If errors exist, block stop (exit 2) so Claude
continues and fixes them. Use stop_hook_active guard to prevent loops.
@lolpack
lolpack / touch_stdlib_py.sh
Created September 30, 2025 17:23
Simulate python interpreter files being touched
#!/usr/bin/env bash
set -euo pipefail
# Usage:
# ./touch_stdlib_py.sh /Library/Frameworks/Python.framework/Versions/3.12
#
# This will touch all .py files under .../lib/python3.12/
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <interpreter-root>" >&2
@lolpack
lolpack / types_demo.py
Created August 8, 2025 13:43
helpers.py
# Requires Python 3.11+ (or install typing_extensions for older versions)
from __future__ import annotations
import os
import re
from collections import Counter, defaultdict, deque, ChainMap
from dataclasses import dataclass, field
from enum import Enum, IntEnum, Flag, auto
from pathlib import Path
from typing import (
ERROR Could not find name `Module` [unknown-name]
--> /Users/aaronpollack/dev/django/django/conf/__init__.py:105:43
|
105 | def configure(self, default_settings: Module[django.conf.global_settings]=global_settings, **options) -> None:
| ^^^^^^
|
ERROR Could not find name `cls` [unknown-name]
--> /Users/aaronpollack/dev/django/django/contrib/admin/checks.py:25:27
|
25 | return issubclass(cls, classinfo)
@lolpack
lolpack / index2.html
Last active April 11, 2025 12:37
Flappy Bird Learning Game
<!-- View here https://gist.githack.com/lolpack/412a1009be427dbecc29a3ab4ce85f92/raw/index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Flappy You+ Configurable</title>
<style>
body {
margin: 0;
"name": "Let's Do It Again",
"artistName": "J Boog",
"name": "Cream On Chrome",
"artistName": "Ratatat",
"name": "Get Free (feat. Amber of Dirty Projectors)",
"artistName": "Major Lazer",
"name": "Watch Out For This (Bumaye) [feat. Busy Signal, The Flexican & FS Green]",
"artistName": "Major Lazer",
"name": "Purple Yellow Red and Blue",
require 'redis'
require 'faker'
client = Redis.new(:host=> '{REDIS_HOST}', :port => '6379')
keysCreated = 0
for i in 0..3600 # 1 hour, 3600 keys created.
fakename = Faker::App.name
@lolpack
lolpack / no-resp-server.py
Last active December 3, 2015 20:54
Null Response Server
#!/usr/bin/python
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
PORT_NUMBER = 8080
#This class will handles any incoming request from
#the browser
class myHandler(BaseHTTPRequestHandler):
#Handler for the GET requests
@lolpack
lolpack / gist:7791859
Created December 4, 2013 17:30
Friends solution
//Friends JS
var friends = {
Tom: ["Mary", "Adam", "Brian"],
Mary: ["Tom", "Jane", "Peter", "Adam", "Elizabeth", "Brian", "Donna"],
Jane: ["Peter", "Mary", "Kimberly", "Emily", "Laura"],
Peter: ["Mary"],
Adam: ["Mary", "Tom"],
Elizabteh: ["Jennifer", "Mary"],
Jennifer: ["Elizabeth"],
@lolpack
lolpack / gist:7458016
Created November 13, 2013 22:55
Stack and Queue
// Queue Implementation
/* enqueue(data) - Adds a new data element to the queue
The parameter, data, should be the element to add.
dequeue(callback) - Removes the next item from the queue
The parameter to dequeue is a callback function that should expect two parameters - err and value. The callback's first param, err, is set to null if the queue operation was successful or "Empty" if the queue is currently empty. The callback's second parameter, value, is the value removed from the queue.
size() - Return the number of elements current in the queue
As with your stack implementation, you are not allowed to use the JavaScript array or any 3rd party libraries. Place your solution in a file called queue.js and upload it as submission of your assignment.*/