Skip to content

Instantly share code, notes, and snippets.

David Coles dcoles

Block or report user

Report or block dcoles

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dcoles / list.libsonnet
Created Jun 17, 2019
List implementation in Jsonnet
View list.libsonnet
if list == [] then
error 'Can not take head of empty list'
if list == [] then
error 'Can not take tail of empty list'
View minijail-9-makefile.patch
diff --git a/Makefile b/Makefile
index 54ee978..a50ee9a 100644
--- a/Makefile
+++ b/Makefile
@@ -46,8 +46,8 @@ ifeq ($(USE_SYSTEM_GTEST),no)
GTEST_CXXFLAGS := -std=gnu++14
GTEST_LIBS := gtest.a
-GTEST_CXXFLAGS := $(shell gtest-config --cxxflags)
-GTEST_LIBS := $(shell gtest-config --libs)
View minijail_userns_dev_failure.c
Based on demo_userns.c by Michael Kerrisk
Copyright 2013, Michael Kerrisk
Licensed under GNU General Public License v2 or later
#define _GNU_SOURCE
#include <sys/wait.h>
#include <sys/sysmacros.h>
#include <sys/mount.h>
dcoles /
Last active Nov 4, 2018
gRPC server fork (causes "Failed accept4: Invalid argument" on Python 3.6)
# Copyright 2015 gRPC authors.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Coroutine pipeline.
Based off
import types
if __name__ == '__main__':
dcoles /
Last active Sep 16, 2018
Lua-style coroutines
Lua-style coroutines.
Examples taken from
import types
class Coroutine:
dcoles /
Created Sep 15, 2018
Coroutines in Python
"""Producer/Consumer coroutines."""
import asyncio
q = asyncio.Queue(7)
def reader(iterable):
it = iter(iterable)
while True:
dcoles / proxy.go
Created Sep 9, 2018
HTTP Proxy in Go
View proxy.go
package main
import (
View tee.c
* Print size and contents of a PIPE
* Author: David Coles <>
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
# Print the number of bytes unread in a fifo.
# David Coles <>
import argparse
import ctypes
import fcntl
import os
import sys
import termios
You can’t perform that action at this time.