Skip to content

Instantly share code, notes, and snippets.

View ScottDuckworth's full-sized avatar

Scott Duckworth ScottDuckworth

  • Seattle, WA, USA
View GitHub Profile
@ScottDuckworth
ScottDuckworth / deadlock.c
Created March 24, 2014 17:43
Demonstrate how deadlock can occur with bi-directional process communication via pipes
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
#define BUF_SIZE ((size_t)(10<<20)) /* 10 MiB */
int main() {
pid_t pid;
int rc, pipe_to_child[2], pipe_to_parent[2];
@ScottDuckworth
ScottDuckworth / git-ls.py
Created January 24, 2014 13:54
Finding last commit of all files in git directory
#!/usr/bin/env python
import pygit2
import stat
import sys
if len(sys.argv) < 3:
print("Usage: %s repo-path rev [path]" % sys.argv[0])
sys.exit(1)
repopath = sys.argv[1]