Adventures in Rust: Futures and Tokio

One of my newer hobbies recently has been learning and toying around with Rust. Recently, as part of this learning process, I've started implementing an IP address lookup service as a small side project. During the course of implementing this project I ran into what turned out to be a bit of a hurdle to tackle, specifically performing reverse dns resolution asynchronously. This challenge stemmed primarily from my lack of understanding both Futures in Rust and the Tokio runtime model.

Read more

Share Comments

How to Setup Gitea on an Ubuntu Server

Since Github is being purchased by Microsoft, I thought this would be a good time to finally get around to setting up my own personal, self-hosted git server. To this end, I ended up creating a Gitea server and am very pleased with the results, so I decided to make a guide so that others could quickly get up and running with a fully functioning Gitea server as well. Table of Contents Why Gitea About This Guide Setting up Ubuntu Server Setting up PostgreSQL Installing and Configuring Gitea Setting up a Systemd Service Setting up Nginx Setting up Fail2ban Enabling HTTPS using Let's Encrypt Setting Automatic Certificate Renewal Enabling Git Over SSH Why Gitea The two main self-hosted git services I looked into when undertaking this task were GitLab and Gitea.

Read more

Share Comments

SSH Environment Specific Terminal Background Colors

How many times have you logged into a server environment and had to run a few commands, only to discover that you were in fact logged into the wrong server? Hopefully not very many times, because as I have learned the results can be painful (if not catostrophic). I recently read this blog post that discusses setting an environment specific background color depending on the name of the server being ssh'd into.

Read more

Share Comments

akka-stream: Akka's reactive stream implementation

If you’ve been following recent developments around Akka, then I’m sure you’ve heard about the Reactive Streams Specification and Akka’s adoption of it in the form of the akka-stream module. Akka’s implementation of reactive streams provides a useful set of abstractions to make thinking about and working with stream processing much simpler and more robust. This coupled with Akka’s partnership with Mathias Doenitz of Spray to create an http module (while heavily leveraging akka-stream) makes for a particularly exciting set of developments.

Read more

Share Comments

Rx: The Importance of Honoring Unsubscribe

I recently wrote a blog post on the similarities between rxJava and Play iteratees and how they could be used seamlessly together using implicit conversions. While implementing either of these concepts in terms of the other was very useful in understanding how they both work and relate to each other, it turns out I was missing a very key compenent that was being lost in translation. While I was uncomfortable with the fact that I was not providing a way to unsubscribe from an observable created from an enumerator, I did not realize the gravity of not doing so.

Read more

Share Comments

RxPlay: Diving Into Iteratees and Observables and Making Them Place Nice

Reactive programming has been picking up in a big way as of late with good reason. In particular there has been a big push in the Scala ecosystem to structure applications so that they are fully reactive and do not block unnecessarily. Two fantastic tools that help faciliate this type of programming are Play Iteratees and RxJava observables. Iteratees are built into the Play 2 Framework and was recently made available as a standalone import and RxJava is a implementation of .

Read more

Share Comments

The Anatomy of a Clojure Macro

One of the great things about Clojure is the fact that we can (relatively) easily extend the language at compile time using macros. I’ve recently implemented (and written about) one such macro that creates a simple interface over node.js functions that require callbacks to continue the flow of execution. Using this macro as a basis I hope to walk through the entire process of creating a clojure macro from inception to implementation, and along the way cover everything that is required for you as a reader (and potentially being new to Clojure) to create a non-trivial macro of your own.

Read more

Share Comments

Using Clojurescript, Macros, and core.async to Escape Callback Hell (Asynchronize)

I’ve been tinkering around with clojure for the past month or two, using it to write a script here or there at work or solving the odd problem on project Euler. I recently picked up Clojure Programming and have been reading through it in my free time, and just made it through the chapter on Macros. Excited to have learned a bit about them, and seeing how simple they are to write (compared to scala, which I’ve been working in), I decided to look for a problem to solve.

Read more

Share Comments

Play 2: Using Action Composition for Easy Authentication and Authorization

I’ve been working on a number of projects using the Play 2 framework and one feature in particular that I’ve been able to put to good use is “action composition”. Action composition allows for a very flexible way to ensure preconditions and postconditions are properly met on an endpoint by endpoint basis. One usage that it lends itself very well to is authentication and authorization. The majority of this blog post will be structured to illustrate that particular use case, but action composition is flexible enough to handle many different scenarios.

Read more

Share Comments

Play 2: Serializing Case Classes with Anorm Pk Type to Json

One small annoyance I ran into using the Play 2 framework with Anorm as the persistence provider was the inability to buy into the “Json Inception” functionality of the Play 2 json libraries by default. For the uniniated the above mentioned functionality is provided by macros that generate Reads/Writes/Formats for case classes at compile time. This allows us to read and write json using only case classes (almost) without requiring any additional code.

Read more

Share Comments