wcgo - A GNU wc clone in Go
wcgo
is a Go implementation of the classic wc
(word count) command-line tool, providing a fast and efficient way to count words, lines, and characters in text files. The aim is to offer functionality similar to wc while utilizing Go’s language features and concurrency model to get some extra performance.
kix - Dynamic, Interpreted language in Kotlin
Following the Crafting Interpreters book, I created my own programming language implemented in Kotlin. Handwritten lexer and parser based on my own grammar which is used to generate the Abstract-Syntax-Tree (AST). Using the visitor pattern, the tree can be traversed to evaluate the program.
This is still a work in progress, future roadmap is to 1) parse the AST to generate custom Bytecode, and 2) incorporate a type-system via Hindley-Milner type inference.
Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms
Go implementation of blocking and non-blocking concurrent queues as described in the paper by Michael & Scott
Used the implemented algorithms to model my own Buffered Channel
implementation.
The paper describes the following two Concurrent Queue Algorithms:
- Non-Blocking Concurrent Queue: A simple, non-blocking, practical and fast concurrent queue algorithm which utilizes the universal atomic primitives like compare_and_swap (load_linked/store_conditional in ARM like processors) which is commonly provided by all hardware today.
- Blocking Queue: A queue with separate head and tail pointer locks which allows only one enqueue and one dequeue to proceed at a time. It is recommended to use with hardware which only provides simple atomic primitives like test_and_set. However, the paper recommends using a single-lock version in case there are only 1-2 contending processes.
Overlord - Garden Monitoring over the Internet
While leaving for home, as the COVID lockdowns kicked in, I wanted to keep an eye out on my plants. I used a Raspberry Pi 3rd gen, which I had lying around, along with Pi Camera V2, to set a hardware rig to record and stream the video stream to my digital ocean instance. I configured a private subdomain using certificate-based authentication to ensure the feed was invisible to anyone else.
Streaming Setup:
Python script runs as a Systemd unit on the Pi. The script captures video frames from the camera and pushes them to a Zero MQ broker running on the cloud instance. The script periodically pulls the latest version and configurations to support any config changes I push remotely.
The content is consumed from the broker and buffered by another process, which serves it via HTTP stream whenever the private subdomain is accessed.