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
\documentclass{jhwhw} | |
\author{Christopher S. Corley} | |
\title{Class homework solutions} | |
\date{October 19, 2011} | |
\begin{document} | |
\problem{Some problem name} | |
blahblah | |
\solution |
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/bash | |
# convert svn dumps located in ./svndumps/ into git repositories. | |
# assumes dump has basic svn top level structure of tags/, branches/, and trunk/, | |
# and authors.txt file of the svn committer id -> git committer id | |
# authors.txt example: | |
# csc = Christopher Corley <[email protected]> | |
# inspired by/credit to: http://sebastian.formzoo.com/2010/11/04/3-steps-convert-svn-dump-to-git/ |
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
def A(s, c): | |
if len(s) <= c: | |
return False | |
if s[c] == '0': | |
return B(s, c+1) | |
elif s[c] == '1': | |
return C(s, c+1) | |
def B(s, c): |
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 python3 | |
import sys | |
def merge(input_tex): | |
new_lines = [] | |
for c_line in input_tex: | |
# check for line comment | |
line = c_line |
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/bash | |
set -e | |
function get_loopback(){ | |
# Detect the module number module-loopback is on | |
# If it isn't loaded, then load it. | |
loopback=`pactl list short modules | grep module-loopback | awk '{print $1}'` | |
if [ "$loopback" == "" ]; then | |
loopback=`pactl load-module module-loopback` | |
fi |
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 lxml import etree | |
class RangedTarget(etree.TreeBuilder): | |
""" | |
Extends the regular etree.TreeBuilder target to assign all elements | |
built two attributes: | |
ranged_tag_start = line number of the start tag | |
ranged_tag_end = line number of the end tag | |
To use this, you must feed the parser line by line, while assigning |
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 timeit import timeit | |
from ctypes import * | |
size = 10 | |
l = list() | |
arr = (c_int * size)() | |
def test(x): | |
for n in range(x): | |
l.append(n) |
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 ctypes import * | |
class Cell(Structure): | |
pass | |
Cell._fields_ = [ | |
("val", c_int), | |
("next", POINTER(Cell))] | |
class LinkedList: |
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
try: | |
from urllib.parse import quote # Py 3 | |
except ImportError: | |
from urllib2 import quote # Py 2 | |
import os | |
import sys | |
BLOG_DIR = os.environ['BLOG_DIR'] | |
# BLOG_DIR = '/Users/cscorley/git/cscorley.github.io/' |
OlderNewer