Skip to content

Instantly share code, notes, and snippets.

View JackStouffer's full-sized avatar
💭
I may be slow to respond. Email me.

Jack Stouffer JackStouffer

💭
I may be slow to respond. Email me.
View GitHub Profile
import std.stdio;
import std.datetime;
import std.conv;
import std.traits;
import std.utf;
import std.range;
import std.algorithm;
Target parse2(Target, Source)(ref Source p)
if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum) &&
@JackStouffer
JackStouffer / circuit_breaker.py
Last active October 14, 2016 15:18
A Circuit Breaker, basically a way to auto fail to relieve pressure on an external service after a number of failures in quick succession
import datetime
BREAKER_OPEN = 0
BREAKER_HALF_OPEN = 1
BREAKER_CLOSED = 2
class OpenException(Exception):
pass

Keybase proof

I hereby claim:

  • I am JackStouffer on github.
  • I am jackstouffer (https://keybase.io/jackstouffer) on keybase.
  • I have a public key whose fingerprint is 5F6A 81FC BB9E BEF0 CFA3 AD73 7E49 FBE6 8B88 208C

To claim this, I am signing this object:

@JackStouffer
JackStouffer / test.d
Created January 4, 2017 18:57
auto decoding test for std.conv.parse!int
import std.stdio;
import std.range;
import std.algorithm;
import std.traits;
import std.container;
import std.meta;
import std.conv;
import std.datetime;
Target parse1(Target, Source)(ref Source s)
@JackStouffer
JackStouffer / test.d
Created January 4, 2017 20:55
std.conv.parse!double auto decoding test
import std.stdio;
import std.range;
import std.algorithm;
import std.traits;
import std.container;
import std.meta;
import std.conv;
import std.datetime;
Target parse1(Target, Source)(ref Source p)
@JackStouffer
JackStouffer / llm-c-code-prompt.md
Last active April 13, 2025 21:12
My LLM Prompt For Writing C

When generating C code, please adhere to the following style guidelines to ensure the code is maintainable, debuggable, and easy to modify:

  • Follow the latest C standard. Try to avoid compiler specific features
  • Use Allman brace style
  • Conceptualize programming as a sequence of data transformations, where specific input data is processed step-by-step to produce desired output data. For example, a program that handles HTTP requests can be understood as taking an HTTP request string and current database state to generate an HTTP response string. This perspective prioritizes concrete reasoning over abstract design principles often associated with object-oriented programming (OOP) or 'clean code' paradigms.
  • Avoid object-oriented programming and prioritize Plain Old Data (POD) structures and procedural solutions.
  • De-prioritize encapsulation as a design goal, focusing instead on simplicity and efficiency.
  • Prefer explicit error code returns while avoiding errno and exceptions
  • Avoid Deep Nesting: Do not u