Skip to content

Instantly share code, notes, and snippets.

@rhysemmas
rhysemmas / leak.cpp
Created November 2, 2021 14:16
Small script testing memory leaks
#include <iostream>
#include <cstdlib>
#include <cstring>
// This is an example of a program which leaks memory (defined in chunk size)
// continuously until a memory allocation fails (machine is out of RAM).
// Unfortunately any modern *nix system renders this a bit useless, as memory
// overcommit will almost always be enabled, meaning `malloc` never sees a
// NULL pointer. The OOMKiller will kick in at some point and terminate the
// process, meaning we will never be able to handle a bad allocation.
#!/bin/bash
domain=$(uname -n)
echo "Generating SSL for $domain"
commonname=$domain
country=UK
state=EGG
locality=EGG
organization=Urmum
organizationalunit=Urmum-1
@rhysemmas
rhysemmas / ruby_things.rb
Created January 3, 2020 14:53
Some important Ruby things & idioms discovered on my travels
# frozen_string_literal: true
# https://stackoverflow.com/questions/37799296/what-does-the-comment-frozen-string-literal-true-do
##############################
# Variables
##############################
# variables are just variables, there isn't anything weird going on here
my_var = "eggs"
# but, we can reference variables directly in strings with '#{}', which is cool

Keybase proof

I hereby claim:

  • I am rhysemmas on github.
  • I am rhysemmas (https://keybase.io/rhysemmas) on keybase.
  • I have a public key whose fingerprint is AAB5 651C E322 D933 42D0 995A C910 C2EE 1A09 A960

To claim this, I am signing this object: