This file contains 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
# | |
# Generic Makefile for OCaml projects. | |
# | |
# Sarah Mount | |
# September 2009. | |
# | |
# Code should be structured roughly like this: | |
# | |
# project / | |
# Makefile |
This file contains 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
%%% Figure placement and scaling with LaTeX and graphicx. | |
%%% | |
%%% Sarah Mount. | |
%%% | |
%%% Replace all UPPERCASE text with your own. | |
%%% To change scaling, replace the "0.6\columnwidth" with your preferred size. | |
%%% | |
%%% "Hhtbp" is the preference of the author for figure placement: | |
%%% Place _H_ere > Place _h_ere if possible > place at _t_op of page > | |
%%% place at _b_ottom of page > place on a _p_age of figures. |
This file contains 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 dis | |
>>> 1 / 0 | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
ZeroDivisionError: integer division or modulo by zero | |
>>> dis.dis() | |
1 0 LOAD_CONST 0 (1) | |
3 LOAD_CONST 1 (0) | |
--> 6 BINARY_DIVIDE | |
7 PRINT_EXPR |
This file contains 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
;;; Turn tabs to spaces | |
(defun tabs-to-spaces (&optional begin end) | |
"Turn all tabs in a region into four spaces." | |
(interactive "r") | |
(save-excursion | |
(if mark-active | |
(replace-regexp "\t" " " nil (point) (mark)) | |
(replace-regexp "\t" " " nil (point-min) (point-max)) | |
) | |
) |
This file contains 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
@process | |
def Drawme(channel, _process=None): | |
import pygame | |
# Constants | |
WIDTH, HEIGHT = 512, 256 | |
# Open window | |
pygame.init() | |
screen = pygame.display.set_mode((WIDTH, HEIGHT), 0) | |
QUIT = False | |
while not QUIT: |
This file contains 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
(defun four-spaces-to-tab (&optional begin end) | |
"Replace four spaces with a tab in a region." | |
(interactive "r") | |
(save-excursion | |
(if mark-active | |
(replace-regexp " " "\t" nil (point) (mark)) | |
(replace-regexp " " "\t" nil (point-min) (point-max)) | |
) | |
) | |
) |
This file contains 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 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/env python | |
""" | |
Execute a single Howl command. | |
Usage: | |
$ python howl.py --help | |
Usage: howl.py [options] |
This file contains 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
# Fix Eclipse on Ubuntu Karmic | |
export GDK_NATIVE_WINDOWS=1 |
This file contains 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 | |
def listexns(mod): | |
module = __import__(mod) | |
exns = [] | |
for name in module.__dict__: | |
if (isinstance(module.__dict__[name], Exception) or | |
name.endswith('Error')): | |
exns.append(name) | |
for name in exns: |
OlderNewer