Skip to content

Instantly share code, notes, and snippets.

@shakna-israel
shakna-israel / LetsDestroyC.md
Created January 30, 2020 03:50
Let's Destroy C

Let's Destroy C

I have a pet project I work on, every now and then. CNoEvil.

The concept is simple enough.

What if, for a moment, we forgot all the rules we know. That we ignore every good idea, and accept all the terrible ones. That nothing is off limits. Can we turn C into a new language? Can we do what Lisp and Forth let the over-eager programmer do, but in C?


@shakna-israel
shakna-israel / Prose.md
Last active March 28, 2020 03:42
SegFault

Expectation

We're basically just calling an infinite loop here, passing an int, that we never change, forward.

There shouldn't be any memory being allocated, and so this should just continue on forever.

Reality

Segmentation Fault.

@shakna-israel
shakna-israel / test.sh
Created June 28, 2020 18:14
Predictable Limits on Python's JSON Parser
#!/bin/sh
# Python will hit it's recursion limit
# If you supply just 4 less than the recursion limit
# I assume this means there's a few objects on the call stack first
# Probably: __main__, print, json.loads, and input.
n="$(python3 -c 'import math; import sys; sys.stdout.write(str(math.floor(sys.getrecursionlimit() - 4)))')"
echo "N: $n"
# https://www.reddit.com/r/thethirdcave/
import secrets
import hashlib
quotes = []
init_salt = "?".encode()
salt = init_salt
..--- ..-. / ...-- ----. / -.... .- / ..--- ..-. / ...-- ....- / ....- .---- / ....- .---- / ..... .---- / ..... ...-- / -.... -... / ..... .- / ....- .- / ..... ..--- / -.... --... / ....- .---- / ....- ..--- / ....- .---- / ..... .---- / ....- ..... / ....- .---- / ..... ...-- / ....- .---- / ....- ..--- / ....- ----. / ....- .---- / ....- .---- / ....- ....- / ..--- ..-. / ...-- ..--- / --... --... / ....- ..--- / ....- ....- / ....- .---- / ....- .---- / ....- -.. / ....- ...-- / ....- .---- / -.... --... / ....- -.. / ....- ...-- / ....- .---- / -.... --... / ....- -.. / ....- ....- / ....- .---- / --... --... / ....- -.. / ....- ..... / ....- .---- / --... --... / ....- -.. / ....- ..... / ....- ..--- / ..... .---- / -.... --... / ....- -.... / ....- ..--- / ..... .---- / ..... .---- / ....- ..... / ....- ..--- / ..... .---- / -.... ..-. / ....- ---.. / ....- ..--- / --... --... / ..... ----. / ....- ----. / ....- ....- / ....- .---- / -.... ..-. / ....- -.. / ....- ....- / ....- .---- / --... ...-- / .