This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Minimal Makefile which compiles multiple C files into individual executables. | |
| # | |
| # | |
| # - Sarah Mount, November 2011 | |
| # | |
| CC=gcc | |
| RM=rm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """ | |
| Basic app which can be updated directly from a Mercurial repository. | |
| Copyright (C) Sarah Mount, 2011. | |
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from abc import ABC, abstractmethod | |
| class PickleCache(ABC): | |
| """Cache Python objects on disk to save on API calls | |
| Clients can treat this class like a key/value store. The fetch() method | |
| must be overridden to fetch a value from the API for a specific key. | |
| Then subclasses can be used as in this example: | |
| cache = SubclassedPickleCache(filepath) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| install: | |
| - sudo apt-get install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended | |
| - sudo apt-get install chktex | |
| script: | |
| - 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """ | |
| Use Google to translate text in one language to another. | |
| Original code from here: | |
| http://thebigbrowser.blogspot.com/2010/08/use-google-translate-from-console.html | |
| by coldpizza |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import compiler.ast | |
| import compiler.visitor as visitor | |
| __author__ = 'Sarah Mount <s.mount@wlv.ac.uk>' | |
| __date__ = 'May 2010' | |
| class ExceptionFinder(visitor.ASTVisitor): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pygame | |
| import pygame.camera | |
| from pygame.locals import * | |
| DEVICE = '/dev/video0' | |
| SIZE = (640, 480) | |
| FILENAME = 'capture.png' | |
| def camstream(): | |
| pygame.init() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # | |
| # 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. | |
| # |
NewerOlder