Skip to content

Instantly share code, notes, and snippets.

Beautiful Canoe Summer Fellowships 2020

Sarah Mount snim2

Beautiful Canoe Summer Fellowships 2020
View GitHub Profile
snim2 /
Created Dec 13, 2009
Display the output of a webcam using Python and Pygame
import pygame
from pygame.locals import *
DEVICE = '/dev/video0'
SIZE = (640, 480)
FILENAME = 'capture.png'
def camstream():
snim2 / Makefile
Last active Nov 20, 2019
Makefile for multiple single file C programs
View Makefile
# Minimal Makefile which compiles multiple C files into individual executables.
# - Sarah Mount, November 2011
snim2 /
Created Sep 5, 2013
A git pre-commit hook to test Python code for PEP8 compliance, and run unit tests via the pytest framework
#!/usr/bin/env python
Git pre-commit hook to enforce PEP8 rules and run unit tests.
Copyright (C) Sarah Mount, 2013.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
snim2 / SyncBufferExample.scala
Created Feb 6, 2012
Simple Scala examples using synchronized.
View SyncBufferExample.scala
import scala.collection.mutable._
class WorkerBee2 (val iterations : Int, var bins : ArrayBuffer[Int]) extends Runnable {
def run() : Unit = {
for(i <- 0 until iterations) {
for (j <- 0 until bins.length) {
// This compiles but misses some iterations:
bins.update(j, bins(j) + 1)
# This script automatically runs 'make' whenever any of the LaTeX files in
# this directory are saved. Open the PDF file you want to view in the
# background, and run this script in the shell. Every time you save a
# LaTeX file, the LaTeX will be recompiled and an updated version of the PDF
# will be displayed in your PDF viewer.
snim2 / hilite.el
Created Sep 1, 2010
Highlight phrases starting with TODO, FIXME, etc. in emacs.
View hilite.el
(defun hilite-todos ()
(highlight-lines-matching-regexp "\\<\\(FIXME\\|WRITEME\\|WRITEME!\\|TODO\\|BUG\\):?"
(add-hook '$WHATEVER-mode-hook 'hilite-todos)
snim2 /
Created Feb 22, 2015
Instructions on how to create an animated git of a shell session

How to produce an animated gif

Step 1: Record a terminal session

$ ttyrec myrecording.tty

Press Ctrl+d when finished.

snim2 /
Created Dec 18, 2011
Convert Kasabi JSON to CSV. This parser is designed to parse the results of SPARQL queries and write them out as CSV files for use with a spreadsheet.
#!/usr/bin/env python
Convert Kasabi JSON to CSV.
This parser is designed to parse the results of SPARQL
queries and write them out as CSV files for use with a spreadsheet.
You can see an example SPARQL query here:
#!/usr/bin/env python
def listexns(mod):
module = __import__(mod)
exns = []
for name in module.__dict__:
if (isinstance(module.__dict__[name], Exception) or
for name in exns:
snim2 / .travis.yml
Last active Nov 7, 2016
Travis-CI recipe for testing LaTeX projects compiled by a Makefile
View .travis.yml
- sudo apt-get install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
- sudo apt-get install chktex
- make
- chktex -W # Print version information.
- chktex -q -n 6 *.tex chapters.*.tex 2>/dev/null | tee lint.out
# If lint output is non-empty report an error.
- test ! -s lint.out
You can’t perform that action at this time.