Skip to content

Instantly share code, notes, and snippets.

View dillonhicks's full-sized avatar

Dillon Hicks dillonhicks

View GitHub Profile
@dillonhicks
dillonhicks / docker-stacktrace.sh
Created March 5, 2021 02:54
Get a stacktrace of all running containers
#!/usr/bin/env bash
#
# usage: sudo ./docker-stacktrace.sh
#
# will generate multiple files in the form gdb-<PID>.<EXENAME>.txt in the cwd for each running container
#
stacktrace-for-pid() {
local pid=$1
local name="$(basename $(readlink /proc/${pid}/exe))"
@dillonhicks
dillonhicks / Template for projects requring node
Created December 19, 2020 19:03
NodeProject.makefile.template
SHELL:=/bin/bash
.PHONY: all bootstrap serve clean build
proj.root.dir:=$(PWD)
proj.tools:=tools
proj.tools.dir:=$(proj.root.dir)/$(proj.tools)
proj.nvm.dir:=$(proj.tools.dir)/nvm
proj.nvm.env:=$(proj.nvm.dir)/nvm.sh
proj.node.version:=v14.14.0
@dillonhicks
dillonhicks / slab-allocated-subtree.cpp
Created August 14, 2020 16:42
Perfect N-Ary Trees Using Slab Allocated Subtrees
/*
// https://godbolt.org/z/avdEMh
$ g++ -O3 -std=c++17 templatenodes.cpp -o templatenodes
$ ./templatenodes
(0) -- 16 bytes {root}
(1) ---- 8 bytes
(2) ------ 4 bytes
(3) -------- 2 bytes
(4) ---------- 1 bytes {leaf}
@dillonhicks
dillonhicks / pagemaps.rs
Created July 23, 2020 01:29
Parsing Linux Process PageMaps in Rust
use std::{fmt, mem};
use std::convert::TryFrom;
use std::io::{BufRead, BufReader, Read, Seek};
use std::path::{Path, PathBuf};
use crate::deps::structopt::StructOpt;
use crate::deps::derive_more;
use crate::deps::serde;
use crate::deps::thiserror;
use crate::deps::log::warn;
@dillonhicks
dillonhicks / serialize.yaml
Created March 21, 2017 17:07
Package safe serialization
import abc
from modulefinder import Module
import ruamel.yaml as _yaml
import six
from ruamel.yaml.nodes import Node, ScalarNode
from typing import Generic, TypeVar
from typing import Type

Keybase proof

I hereby claim:

  • I am dillonhicks on github.
  • I am dillonhicks (https://keybase.io/dillonhicks) on keybase.
  • I have a public key ASDSCvLMmIcPt--h0FnXY9ecydf1W3jpac8XoRw78C9pzQo

To claim this, I am signing this object:

@dillonhicks
dillonhicks / keybase.md
Created February 24, 2017 16:21
keybase.md

Keybase proof

I hereby claim:

  • I am dillonhicks on github.
  • I am dillonatblink (https://keybase.io/dillonatblink) on keybase.
  • I have a public key whose fingerprint is FA72 7F6C D12D CAAF 6157 3451 C2B7 1BD9 0CE1 8EBB

To claim this, I am signing this object:

@dillonhicks
dillonhicks / transmute.py
Last active February 7, 2017 22:59
Less Magical Flask-SQLAlchemy
import contextlib
import inspect
import logging
import os
import flask
import six
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
@dillonhicks
dillonhicks / flask2proto.py
Created January 24, 2017 19:44
Flask Config Documentation to Protobuf Message
from io import BytesIO
import re
import functools
import requests
from requests.adapters import HTTPAdapter
import lxml.etree
class HTML:
@dillonhicks
dillonhicks / test_fixture_hot.py
Last active October 19, 2016 20:06
Flask Live Server Fixture Running on Ephemeral Port
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import socket
import multiprocessing
import time
import flask
import pytest