After investigating the CRuby source code for hash tables, my interest was piqued, and I decided to look into another hash table implementation before leaving Recurse Center. I chose to investigate Lua because the hash table is the central abstraction of the language. I don’t actually know Lua, but luckily I spent most of my investigation in a...
Note: This is all Python 3 code. Other versions of Python may handle subprocesses and bytearrays differently. A Git bomb is a compact repository that explodes to consume extreme size on disk and in memory. Read more about them in the original git bomb post. This post walks through some code to create them. A full script to create them is...
If you are an adventurous sort (and can handle a potential reboot) I invite you to clone this tiny repo: $ git clone https://github.com/Katee/git-bomb.git Were you able to clone it? Unless you have quite a lot of memory (both RAM and storage) git was killed, ran out of memory, or you had to reboot. Why is this? It is a perfectly formed repo made...
Note: All code was run using Ruby MRI 2.4.1 and is not guaranteed to behave the same in other implementations (JRuby, mruby, etc). Also you probably don’t want to do this in a real project. Like (every?) user of Ruby I constantly use the built-in Hash class. I’ve made my own classes usable as keys and know that there are multiple equality...
This is a quick follow-up to Weird Python Integers. While writing that post, I saw some Python behaviour I didn’t understand. Then I read some comments by kmill and squeaky-clean in response to my original post, and now I can explain Python’s behaviour. If you don’t know about the “small integers” table in Python, I recommend reading the original...
Note: all of this code was run on my machine using Python 3.6.1. Not everything will work the same if you test using Python 2. >>> a = 42 >>> b = 42 >>> a is b True >>> a = 316 >>> b = 316 >>> a is b False That is suprising! It turns out that all “small integers” with the same value point to the same memory. We can use the Python built-in...
When you connect to another computer on a network your data usually travels through many devices (also called “hops”, “gateways”, or “routers”). I can use traceroute to list the devices my packets travel through to arrive at steampowered.com from the Recurse Center. $ time traceroute steampowered.com traceroute to steampowered.com...