Skip to content

Instantly share code, notes, and snippets.


Chris Coetzee chriscz

  • Activitar
  • South Africa
  • 13:06 (UTC +02:00)
View GitHub Profile
chriscz / yaml_autoloader.rb
Last active Nov 21, 2022
After the Rails security release it's required to specify which classes are permitted for deserialization by YAML. However, when it's a high effort task to discover, it's easier to run production in "unsafe" mode for some time and collect which classes are being loaded.
View yaml_autoloader.rb
# Place under initializers/yaml_autoloader.rb
class PsychLoaderPatch
include Singleton
def initialize
logfile ="log/yaml_disallowed_classes.log").to_s, "a")
logfile.sync = true
@logger =
chriscz /
Last active Oct 6, 2022 — forked from reillysiemens/
Signing VirtualBox Kernel Modules
#!/usr/bin/env bash
set -eou pipefail
# This is probably waaay too long.
NAME="$(getent passwd $(whoami) | awk -F: '{print $5}')"
chriscz / Makefile
Last active Jul 11, 2021
Crystal Makefile which runs tests when files change
View Makefile
# Requires inotify-tools to be installed. On Ubuntu / Debian:
# sudo apt install inotify-tools
TEST_ARGS=--chaos --parallel 4 --verbose
SPEC_ARGS=--order=random --error-on-warnings --verbose
WATCH=src/**/*.cr spec/**/*.cr test/**/*.cr
# The make rule to use when running tests. Either spec or test
chriscz / ability.rb
Last active Jun 11, 2021
Add ActiveRecord::Relation support to CanCan can? check
View ability.rb
require 'cancancan_ability_ext'
class Ability
include CanCan::Ability
include CanCanCanAbilityExt
def initialize(user)
can :clone, Post, { id: user.post_ids }

Keybase proof

I hereby claim:

  • I am chriscz on github.
  • I am chriscz ( on keybase.
  • I have a public key whose fingerprint is 53C4 0540 6C16 09E7 F32A A341 AA42 2257 9499 8735

To claim this, I am signing this object:

chriscz / .gitignore
Last active Jun 12, 2022 — forked from phansch/
Improved YARD cheatsheet
# Make sure you grab the latest version
set -euo pipefail
chriscz /
Last active Dec 27, 2016
Snippet for signal handling in Python (useful for monitoring)
import signal
import os
import readline
from pprint import pprint
def handle_shell(signal, frame):
frames = []
while frame:
chriscz /
Last active Apr 8, 2022
Python snippet for monitoring where files were opened
# This is free and unencumbered software released into the public domain.
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
chriscz / mucow.c
Last active Nov 14, 2021
Dirty COW PoC with multipage support
View mucow.c
* Multipage COW PoC
#include <fcntl.h>
#include <pthread.h>
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/mman.h>
#include <sys/stat.h>