Calling a C Library for QR Generation from Chicken Scheme
I wanted to create a QR code from within Chicken Scheme, but I couldn't find an existing Scheme library or chicken Scheme egg online that would let me do this. Fortunately, Chicken Scheme is pretty easy to integrate with existing C code.
The first thing I did was I wrote a Hello World in Scheme and another Hello World in C, and checked that I could get both of these to run (using the chicken compiler and GCC).
Continue reading →Generating New Email Addresses for new services
I wrote a little script recently to generate new email addresses using the CloudFlare API.
By doing this, I can create loads of email addresses really quickly and set up disposable ones for new services or categories of services. The script either randomly generates an identifier, or will use a value provided as input.
Continue reading →A very simple way to use NVM without sourcing it in your rc (+ works with fish)
I mainly use fish, and NVM does not work with fish out-of-the-box.
Even if I happen to be using zsh/sh/ksh/bash, I don't want to be loading NVM when I start a new shell, when I am only using it on occasion.
Continue reading →Unix Shell Scripting
While building a simple HTTP Server in Racket, I wanted to automatically restart the server when I changed the source file.
To achieve this, I wrote a simple shell script.
Continue reading →Racket HTTP Server 2 - Reading the Path
Previously, I wrote a simple HTTP server in Racket. The next step I will take with this project is to figure out how to extract the HTTP method and path from the request.
The handle method's first argument, in
, is an input port, from which the request can be read. We can read the first line from the request using the read-line
function:
Adding TLS/SSL to a web service with Nginx
As I previously mentioned, it is almost always better to use a battle-hardened old favourite for security software, rather than to roll your own.
With Nginx, you can add SSL/TLS support in front of your web server, using tried and tested software.
Continue reading →Using Template Haskell to bundle data into an executable at compile time
Often, a program will rely on static data - lookup tables, files to serve, initial values for internal data structures, and so on. Template Haskell can be used to load files, and execute code, at compile time.
This is a very gentle introduction to the otherwise often intimidating world of Template Haskell. For the sake of simplicity, I am keeping a narrow focus: loading a file, and then manipulating the data from that file, both at compile time.
Continue reading →Racket HTTP Server
When I start playing with a new language, I like to have a look at how I could build a simple HTTP server in that language.
Racket's racket/tcp
library provides us with functions for managing TCP connections. Using this, we can implement a server.
Mycs - Logistics Optimisation - Declarative Constraint Programming
Using Constraint Programming / MiniZinc for Manufacturing Optimisation
Used Declarative Constraint Programming (with MiniZinc) to optimise the assignment of Purchase Orders to Manufacturers, increasing Supply Chain cost-efficiency while also introducing checks and safeguards. Built a RESTful API wrapper in Go to allow the constraint solver to be accessed over the network.
Continue reading →Implementing a Feistel Cipher in Haskell
I was reading about Feistel Ciphers, and thought it would be fun to implement a toy one. I have shared it below.
Wikipedia Feistel Cipher ArticleGithub Gist: Haskell Feistel Cipher
Continue reading →