Skip to content

Instantly share code, notes, and snippets.

#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
/*
@dpryden
dpryden / api.py
Created January 15, 2019 19:46
Demo of a RESTful API server in Python using only the standard library.
#!/usr/bin/env python3
"""Demo of a RESTful API server in Python, using only the standard library.
The API here is extremely simple:
* a POST request stores a JSON object (from the POST body) at the given path
* a GET request returns a JSON object stored at the given path
Example usage:
@dpryden
dpryden / toxin
Created April 3, 2018 16:06
toxin: Script for running python or shell commands inside a .tox environment
#!/bin/bash
# Run a command inside a Tox environment
if ! [[ -d .tox ]]; then
echo 'Cannot find .tox in this directory!'
exit 1
fi
if [[ "$1" == '-e' ]]; then
toxenv="$2"
shift 2
@dpryden
dpryden / ClassLoaderLeakExample.java
Created October 20, 2014 00:01
Example of a ClassLoader leak in Java
import java.io.IOException;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
/**
* Example demonstrating a ClassLoader leak.
*
* <p>To see it in action, copy this file to a temp directory somewhere,