This page collects the various programs and useful code snippets I’ve released over the years. Some of them are quite old and no longer supported, but I’m including them here as people might still find some of the code useful and/or interesting.
I’m also contributing to some well-known open source projects.
- pyelftools – (Updated: 17.04.2013) pure-Python library for parsing ELF object files and DWARF debugging information.
- pss – (Updated: 23.03.2013) a tool for searching inside source code, similar to ack.
- pycparser – (Updated: 29.12.2012) full parser for C99 in pure Python.
- Bob – (Updated: 09.04.2011) a suite of implementations of the Scheme language in Python. It currently includes:
- A Scheme interpreter
- An implementation of a stack-based virtual machine called the "Bob VM"
- A compiler from Scheme to Bob VM bytecode
- A serializer and deserializer for Bob VM bytecode
- An alternative, functionally-equivalent implementation of the VM in C++ – BareVM
- luz – (Updated: 18.04.2010) a complete open-source CPU suite, with a simulator, assembler and linker.
- Tetris in Python – (Updated: 12.12.2009) To teach myself wxPython and PyQt I’ve implemented a tetris clone in Python using these frameworks. PyQtris source code and windows .exe for the PyQt version. wxPytris src and .exe for the wxPython version.
- SICP – (Updated: 06.06.2008) A major project spread over 10 months – reading the whole SICP book and solving all the exercises in it. The whole process is documented in the SICP category of the blog, and here’s the conclusion. I’ve even received a copy of the book signed by Abelson & Sussman in appreciation.
- SAT-based Sudoku solver – (Updated: 05.09.2007) An implementation of a Sudoku solver in Ruby. The Sudoku is converted into a SAT problem, which is then solved with a simple SAT solver.
- Perlmix – (Updated: 05.09.2007) A perl implementation of the MIX machine and MIXAL language devised by Donald Knuth in TAOCP. Includes two separate packages – a compiler/assembler of MIXAL into MIX machine code, and a simulator of the MIX machine, including the MIX devices.
- libcollect.py – (Updated: 03.07.2008) A Python module that helps you collect all the libraries your script uses into a convenient distribution directory / zip file. Read the embedded documentation for more details.
- ESMS – (Updated: 29.06.2007) simulator and toolset for running fantasy soccer leagues.
- Perlines – (Updated: 31.12.2004) A clone of the "Colorful lines" (distributed as "Glines" with Gnome) game, written in Perl/Tk. Tested on Windows & Linux.
- Pbombs – (Updated: 31.12.2004) Minesweeper clone in Perl/Tk. Tested on Windows.
- Jamca – (Updated: 05.05.2004) a chess playing agent I put together in C++ a few years ago. It’s not complete (no search/AI), but can serve as a great learning tool for chess programming.
- Chuck – (Updated: 10.12.2002) a checkers playing program I wrote in C++ a long time ago, to get some hands-on experience with game AI programming. It was one of my first projects, so the code is (very) far from perfect.
Code snippets and scripts
Some of the files downloadable from this section are not zipped, but uploaded as is, with .txt added to their extension – so you can just open them in your browser. If you download a snippet and want to run / compile it, remove the trailing .txt from its extension.
- socket_client_twisted_pyqt.zip – (Updated: 26.05.2011) Socket I/O with Twisted inside a PyQt GUI. More details in this post in the blog.
- socket_client_thread_sample.zip – (Updated: 18.05.2011) Doing network I/O in a separate thread in Python, for GUI integration, etc. More details can be found here.
- asio_protobuf_sample.zip – (Updated: 20.03.2011) Implementation of a simple server using Boost.Asio with Protocol Buffers (protobuf) serialization. More details in this blog post.
- pyqt_dataplot_demo.zip – (Updated: 23.05.2009) Demo of plotting .csv data in PyQt, using matplotlib and PyQwt.
- py_rd_parser_example.zip – (Updated: 20.03.2009) Several related recursive-descent parsers written in Python. Includes a general regex-based Lexer class.
- Perl serial communication – (Updated: 18.11.2006) a small utility written in C++ along with a Perl module which in unison provide a convenient method to communicate on the serial (COM) port with Perl.
- regex_fsm.zip – (Updated: 28.04.2009) Implementation of a simple regular expression recognizer, using a finite state machine.
- qt_mpl_bars.py – (Updated: 20.01.2009) Demo code of matplotlib with PyQt. Displaying a bar plot with information that can be changed by user commands. Allows some interaction with the plot.
- memmgr.zip – (Updated: 17.10.2008) A small C library to dynamically allocate memory from a fixed pool that is allocated at link time. Useful for embedded systems. Also see this post.
- google_web_search and google_api_search – (Updated: 13.09.2008) search Google from Python. Also see the CGI interface here.
- list_rotation.py – (Updated: 29.08.2008) Several space-efficient list rotation algorithms.
- wx_mpl_bars and wx_mpl_dynamic_graph – (Updated:01.08.2008) Demo code of matplotlib with wxPython. Displaying "live" and interactive graphs.
- lexyacc_examples.zip – (Updated: 27.07.2007) Some examples of scanners and parsers coded with Lex and Yacc. The examples are well documented and show many important features of the Lex & Yacc tools.
- lis_algorithms.rb – (Updated: 18.04.2006) Presents three different implementations of the Longest Increasing Subsequence problem, in Ruby.
- fixnum.cpp – (Updated: 06.03.2003) A very simple library implementing fixed number arithmetic. I needed a Verilog implementation of fixed point operations for a University project, so I first wrote it in C++ to understand how things work.
- C++ Utils – (Updated: 19.08.2005) A collection of C++ utility functions / classes. String tokenization, smart pointers, benchmarking, simple command line parsing, and more.
- namegen.cpp – (Updated: 08.10.2004) a very simple random name generator. Don’t expect too much though, the names it generates are at best in the ridiculous/hilarious spectrum.
- largest_files.pl – (Updated: 06.03.2003) Give this script a starting point and it will recursively dive into the directory tree and return with the 20 largest files. Can be very useful when you must clean up some space quickly.
- foggy.pl – (Updated: 12.03.2003) Useful for manager reports – prints piles of meaningless but extremely smart looking text.
- huff.pl – (Updated: 12.09.2003) A simple implementation of Huffman encoding/decoding.
- levenshtein.pl – (Updated: 27.03.2003) Calculates the Levenshtein distance (also called Edit distance) between two strings. This can be used for approximate string matching.