Skip to content

Instantly share code, notes, and snippets.

View ZeroIntensity's full-sized avatar

Peter Bierma ZeroIntensity

View GitHub Profile
@ZeroIntensity
ZeroIntensity / uncrustify.cfg
Created July 7, 2024 17:31
Uncrustify configuration for PEP 7
# PEP 7 Compliant Uncrustify Configuration
# General code size
code_width = 79
input_tab_size = 8
output_tab_size = 4
indent_columns = 4
indent_with_tabs = 0
# Ugly Newlines
#include "Python.h"
#include "pyerrors.h"
#include <stdarg.h>
#include <stdbool.h>
typedef int (*awaitcallback)(PyObject *, PyObject *);
typedef int (*awaitcallback_err)(PyObject *, PyObject *);
typedef struct _PyAwaitableObject PyAwaitableObject;
@ZeroIntensity
ZeroIntensity / mussolini.py
Created October 8, 2023 14:59
awful sorting algorithm
import ctypes
import sys
assert sys.implementation.name == "cpython"
def mussolini(array: list[int]):
if not array:
return
highest = array[0]
@ZeroIntensity
ZeroIntensity / awaitableobject.c
Created September 5, 2023 21:23
PyAwaitable Reference Implementation
#include "Python.h"
#include <view/awaitable.h>
#include <stdarg.h>
#include <stdbool.h>
typedef struct {
PyObject *coro;
awaitcallback callback;
awaitcallback_err err_callback;
bool done;