Debugging in Vim

Vim 8.1 was released about a year ago, in May 2018. The “main new feature” was official support for running a terminal within vim. Along with this came a built-in debugger plugin, termdebug, which provides a visual interface for interacting with gdb. This post walks through an example session using termdebug.

Continue reading

Tagged , , | 4 Comments

🔐 LC4

About a year ago I wrote a Python library that implements ElsieFour (LC4) encryption (Alan Kaminsky 2017). LC4 is designed for human-to-human communication, without requiring a computer.

I’ve recently updated the library to include color-coded verbose output that shows the steps of the algorithm. This can be helpful for learning to manually encrypt and decrypt messages. The verbose output is accessible through both the Python API and the command-line interface (using --verbose).

Continue reading

Tagged , , | Leave a comment

⌨️🏌️🐍 vimgolf Client in Python

I implemented a vimgolf client in Python.

The source code is available on GitHub:
https://github.com/dstein64/vimgolf

The user interface is similar to the official vimgolf client, with a few additions inspired by vimgolf-finder.

The package is available on PyPI, the Python Package Index. It can be installed with pip.

$ pip3 install vimgolf

Tagged , , | Leave a comment

More Bézier Walks in Neural Networks

The videos above were generated using the same script described in an earlier post.

Continue reading

Tagged , , | Leave a comment

Random Bézier Walk in a Random Neural Network

The video above was generated using neuralart.

Continue reading

Tagged , , | Leave a comment

Neural Art

neuralart is a Python library and utility for rendering generative art from a randomly initialized neural network.

It’s based on the following blog posts and pages from studio otoro.

The package is available on PyPI, the Python Package Index. It can be installed with pip.

$ pip install neuralart

For example command line usage, see neuralart#example.

For example library usage, see example.py.

Tagged , | Leave a comment

echo and printenv in x86 Assembly

This post contains implementations of echo and printenv in 32-bit x86 assembly for Linux.

echo is a Unix utility that prints its arguments to standard output.

printenv is a Unix utility that prints the environment to standard output.

The core functionality of these programs can be written in a few lines of C, where program arguments and the environment are passed as function arguments to main.

When a process is executed on Linux (or other Unix-like systems), its stack contains pointers to the program arguments and the environment, as shown below.

        |--------------------------|     Low
0(%esp) |      Argument Count      |  Addresses
        |--------------------------|
4(%esp) |     Argument Pointers    |
        |           ...            |
        |--------------------------|
        |            0             |
        |--------------------------|
        |   Environment Pointers   |
        |           ...            |
        |--------------------------|
        |            0             |
        |--------------------------|
        |     Additional Data      |
        |           ...            |     High
        |--------------------------|  Addresses

Continue reading

Tagged , , , , | Leave a comment

k-means Image Color Quantization

I implemented a web page that can apply color quantization to images using k-means clustering. Here’s the link:
https://dstein64.github.io/k-means-quantization-js/

The JavaScript source code is available on GitHub:
https://github.com/dstein64/k-means-quantization-js

Continue reading

Tagged , , , , | Leave a comment

Factorization Machines with Theano

A Factorization Machine (FM) is a predictive model that can be used for regression and classification (Rendle 2010). FMs efficiently incorporate pairwise interactions by using factorized parameters.

PyFactorizationMachines is a Theano-based Python implementation of factorization machines.

Update 4/20/2017: The library is now available on PyPI, the Python Package Index. It can be installed with pip.

$ pip install pyfms

For documentation, see documentation.md.

For example usage, see example.py.

Tagged , , , | Leave a comment

Conway’s Game of Life

Here’s a quick-and-dirty implementation of Conway’s Game of Life.

Cells can be selected/deselected by clicking and dragging your mouse. The interface and display were designed for use with a desktop/laptop computer, not a touchscreen mobile device. That is, cells can’t be selected by swiping (but tapping works).

The default selected cells spell my first name, daniel. After selecting cells, click Start to begin the game of life.

The source code is available here (use your browser’s view source).

Tagged | Leave a comment