This is an archived copy of a previous semester's site.
Please see the current semester's site.
A list of code examples used in class.
docker-stuff.zip, including
Dockerfile-01
, our simplest DockerfileDockerfile-02
, with copies a directory of filessomedir/hello.txt
, the file to be copiedDockerfile-03
, which runs a filesomedir/create.sh
, the file to be runcoinflip/Dockerfile
, defining our own containerized appcoinflip/app.py
, the app to put in that containeretag-track.py
uses caching to track usersdecorators1.py
introducing functions that modify other functionsdecorators2.py
introducing Python’s decorator syntaxdecorators3.py
introducing stateful decorators with classesdecorators4.py
introducing state-modifying decorators like flask usesflask-demo.py
introducing the use of Flaskhve.py
, the high-value exchange example from the thread safety pagedp.py
, on version of the dining philosophers problemsbp.py
, a nearly-correct simulation of the sleeping barber problemSocket code in Python:
socket-inspector.py
, a version of socket-inspector.c
that runs in Python instead of CFour versions of essentially the same threaded code:
count.c
uses pthreads in C, demonstrating a data racecount.py
is count.c
converted to Pythoncount2.py
is count.py
but bypasses the Global Interpreter Lockcountj.py
is count.py
written in an older version of Python that can be run in JythonThe two most common synchronization primitives:
use-lock.py
uses a Lockuse-condition-variable.py
uses a Condition VariableThese files are numbered by the corresponding section of the Python text page You can download all 22 of them as a .zip file.
mp4startercode.c
one of the files from MP4 and a starter for the socket-inspector.c
program we wrote in classsocket-inspector.c
the file we made in class out of mp4startercode
stack-memory.c
demonstrates both valid and invalid use of stack memory and the sizeof
operator.global-memory.c
demonstrates both valid and invalid use of global memory and const
.mem-undefined.c
a variety of mostly-undefined-behavior memory operations.mystrlen.c
showing several possible implementations of strlen
and the use of goto
.mystrlen.c
’s assembly in both x86-64 and ARM, showing how code is actually stored to be executed.memory-inspector.c
for viewing bytes used by various data structures, with different things to inspect than last time.memory-inspector.c
for viewing bytes used by various data structures.