Visualizing Fitbit GPS Data

Sat May 01 2021

This post looks at how you can aggregate and visualize Fitbit GPS data since there is no built-in functionality to do this on the Fitbit website. Before you read this post, check out my two other posts on using Fitbit data:

1 Getting the Data

There are two options that we can use to fetch data from Fitbit:

  • Fitbit’s Data Export Tool
  • Fitbit’s API

1.1 Exporting from the Website

Read More »

Running a Minecraft Server With Docker

Sun Feb 28 2021

Close your eyes for one moment and imagine that everything you host runs in docker containers. You no longer need to battle system dependencies, and configurations are more manageable; it is now easier to backup and transfer your applications.

In my quest to dockerize everything, I am now dockerizing my Minecraft server. Minecraft is a relatively simple application to host since it is just a single Java application that you need to run. To put this in Docker, we need to declare a Java Docker image that launches our Minecraft server.

FROM openjdk:8u232

WORKDIR /root/minecraft

CMD java -Xmx2048M -jar spigot-1.10.jar -o true

Read More »

DIY Video Hosting Server

Mon Feb 15 2021

Two years ago, I created a video streaming server from scratch in Node; looking back, I realized that I must have had way too much free time. I wanted something that I could use to embed videos in websites and aggregate all of my public videos. In the end, I created a lightweight node application with an administration interface, API tokens, and the ability to stream videos. Now, I can embed videos in my blog like this:

Read More »

Running Scala Code in Docker

Sat Feb 13 2021

Alrighty, folks, this blog post is pretty straightforward from the title. We are going to be running Scala code in Docker containers. Specifically, we will be using SBT and docker-compose. SBT is a built tool primarily used by Scala developers, and docker-compose is a tool for defining docker environments.

To start, we need to create a simple Docker container that can build our scala code. From an existing Java JDK container, SBT is straightforward to install from a package manager.

FROM openjdk:8u232


# Install sbt
  mkdir /working/ && \
  cd /working/ && \
  curl -L -o sbt-$SBT_VERSION.deb$SBT_VERSION.deb && \
  dpkg -i sbt-$SBT_VERSION.deb && \
  rm sbt-$SBT_VERSION.deb && \
  apt-get update && \
  apt-get install sbt && \
  cd && \
  rm -r /working/ && \
  sbt sbtVersion

RUN mkdir -p /root/build/project
ADD build.sbt /root/build/
ADD ./project/plugins.sbt /root/build/project
RUN cd /root/build && sbt compile

WORKDIR /root/build

CMD sbt compile run

Read More »

Quadtree Animations with Matplotlib

Mon Feb 08 2021

This post will extend my last post on image quadtrees to create an animation that varies the quadtree splitting threshold. Like all recursively dividing algorithms, as you relax the splitting parameter, more partitions get generated. Although this principle makes intuitive sense, seeing animation tells a fuller story.

This post will be using the matplotlib’s animation functionality and the quadtree code I wrote in my previous post. The following code snippet illustrates a simple animation using matplolib:

import numpy as np
from matplotlib import pyplot as plt
from matplotlib.animation import FuncAnimation

fig = plt.figure()
ax = plt.axes(xlim=(0, 4), ylim=(-2, 2))
line, = ax.plot([], [], lw=3)

def init():
    line.set_data([], [])
    return line,
def animate(i):
    x = np.linspace(0, 4, 1000)
    y = np.sin(2 * np.pi * (x - 0.01 * i))
    line.set_data(x, y)
    return line,

anim = FuncAnimation(fig, animate, init_func=init,
                               frames=200, interval=20, blit=True)'Wave.gif')
Simple Animation
Simple Animation

Read More »