Skip to content

Instantly share code, notes, and snippets.

View godlygeek's full-sized avatar

Matt Wozniski godlygeek

  • Philadelphia, PA
View GitHub Profile
This file has been truncated, but you can view the full file.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Textual Snapshot Test Report</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
<style>
#page-header {
2024-04-29 16:26:20.126Z: Host information
2024-04-29 16:26:20.146Z: ----------------
2024-04-29 16:26:20.151Z: OS: Ubuntu 22.04.3 LTS (stable release)
2024-04-29 16:26:20.156Z: Image details: https://github.com/github/codespaces-host-images/blob/main/README.md
2024-04-29 16:26:20.160Z: ----------------
=================================================================================
2024-04-29 16:26:20.165Z: Configuration starting...
2024-04-29 16:26:20.173Z: Cloning...
@godlygeek
godlygeek / pymodule.py
Created January 18, 2024 19:28
Reproducer for a Cython issue
from contextlib import contextmanager
@contextmanager
def nullcontext():
yield
@godlygeek
godlygeek / memray.1
Created January 12, 2024 19:29
Generated man page for Memray
.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-

Stateless Function

flowchart TB
    A{arguments} --> B[stateless function] --> C{return value};

Stateless function with side effects

@godlygeek
godlygeek / find_constant_setup_kwargs.py
Last active May 24, 2023 19:36
Extract static arguments to setuptools.setup() from setup.py
from __future__ import annotations
import ast
import sys
import typing
def is_constant(expr: ast.expr) -> bool:
if isinstance(expr, ast.Constant):
return True
(gdb) thread apply all bt
Thread 21 (Thread 0x7f8f5b3c56c0 (LWP 6521) "python3"):
#0 futex_wait (private=0, expected=2, futex_word=0x7f8f8537a700 <je_arenas_lock+64>) at ../sysdeps/nptl/futex-internal.h:146
#1 __GI___lll_lock_wait (futex=futex@entry=0x7f8f8537a700 <je_arenas_lock+64>, private=0) at ./nptl/lowlevellock.c:49
#2 0x00007f8f85022262 in lll_mutex_lock_optimized (mutex=0x7f8f8537a700 <je_arenas_lock+64>) at ./nptl/pthread_mutex_lock.c:48
#3 ___pthread_mutex_lock (mutex=mutex@entry=0x7f8f8537a700 <je_arenas_lock+64>) at ./nptl/pthread_mutex_lock.c:93
#4 0x00007f8f853373a0 in malloc_mutex_lock_final (mutex=0x7f8f8537a6c0 <je_arenas_lock>) at include/jemalloc/internal/mutex.h:151
#5 je_malloc_mutex_lock_slow (mutex=mutex@entry=0x7f8f8537a6c0 <je_arenas_lock>) at src/mutex.c:90
#6 0x00007f8f852c6944 in malloc_mutex_lock (mutex=0x7f8f8537a6c0 <je_arenas_lock>, tsdn=0x7f8f5b3c4c78) at include/jemalloc/internal/mutex.h:217

Keybase proof

I hereby claim:

  • I am godlygeek on github.
  • I am godlygeek (https://keybase.io/godlygeek) on keybase.
  • I have a public key ASApzRGG5mg6EX5_ZiahTbTCACHdfZtbWi1Ro9iIkkfYMwo

To claim this, I am signing this object:

@godlygeek
godlygeek / euler5.cpp
Created May 23, 2020 02:51
Python ain't fast
// Dumb C++ solution for https://projecteuler.net/problem=5
// Runs in 14.11s seconds on my chromebook
#include <iostream>
int main()
{
int x = 2520;
while (true) {
bool evenly_divisible = true;
for (int i = 1; i <= 20; i += 1) {
import machine
import neopixel
import time
import urandom
def pick_color():
# Pick 3 numbers that sum to 128
r = urandom.getrandbits(7)
remaining = 128 - r