Containers for Software Development

As a software developer, you can use software containers to run stuff in a consistent manner across various operating systems. They are an operating system paradigm in which the kernel allows the existence of multiple, isolated user space instances. To create isolated process environments within a system, containers make use of bundle of techniques with main ones including:

  • Unix’s namespace: process space and id’s
  • chroot: filesystem visibility
  • cgroups: allocated resources (networking, number of processes, memory…)

Ideally, containers can run (side-by-side) on any machine–all dependencies already included. Containerization attempts to tackle the “well, it worked on my machine” issue, where software runs seemingly fine on your machine but doesn’t run on another system.

Read More

Workers on The Edge πŸ‘·β€β™€οΈπŸ‘·β€β™‚οΈ

Cloudflare Workers are computing instances on the edges of the internet. They’re purposely built to be lightweight, isolated, and distributed – these features are meant to achieve speed, security and economy. They’re used to run user-defined applications, such as augmenting web requests but at an intermediate point between the origin server and the user.

In this post I’ll go over the What, How, and basic code structure to build up to a fleshed out use case in the future.

Read More

EDA on stock option chains

I was curious about the bid-ask spread and behavior of contract prices for stock options.

In this notebook I’ll explore a dataset, figure out what data preprations I’ll need, and make basic visualizations to try to support some hypothesis. Along the way I’ll also touch on basics of stock options.

Read More

Serverless dev with Cloudflare Workers

I recently learned of a neat Cloudflare tool to that lets developers deploy “serverless code”: Cloudflare Workers. It approximates AWS Lambda in being a compute instance that lives in closer to the edge of the users' site, and it’s fast at doing what it does. “Just deploy code” in your choice of language: Javascript, Rust, Python, C/C++… and you needn’t preoccupy yourself about unused capacity, auto-scaling, or load balancing.

Read More

Amazon delivery trucks 🚚

Scenario

Amazon Prime Now has 17-hour long days during which it deploys its fleet of trucks. The Order Forecaster for a region is really good at what they do and can give the exact number of trucks needed during each hour block for the coming day. The forecast schedule is in the form of a 17 element array. We can only deploy (add) trucks at the very beginning of the day, and any leftover trucks at the end of the day are automatically sent to maintenance. How would we algorithmically maintain a minimal service fleet? For example if the required number of trucks is forecasted as:

hour 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#trucks 5 5 5 5 5 5 5 3 4 4 3 1 0 0 0 0 1

The optimal decommissioning schedule is:

hour 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
+/-trucks 5 0 0 0 0 0 0 -1 0 0 -1 -2 0 0 0 0 0

Read More

Quest of The Delta Knights βš”

Lord Vultare has stolen Archimedes’s heat ray πŸ”₯πŸ”₯

… and it’s up to Leonardo to take back the weapon before Lord Vultare uses it to seige the kingdom 🏟. Both Lord Vultare and Leonardo are still in the Phantom Zone, but Lord Vultare has already started making his way back to our world! The Phantom Zone has many intersecting dimensions and time streams, so Leonardo can’t just run up to Lord Vultare because they are seperated by time and space. Luckily, Leonardo has the Antikythera that allows him to instantaneously travel through time πŸ•° and space 🌌. He can catch up to Lord Vultare near-instantly, but he can only travel in a specific combination of dimensions and time moments relative to his current dimension and time. These moves are summarized as moving +/-3 dimensions and +/-1 moments, or, +/-1 dimensions and +/-3 moments.

The Phantom Zone has a finite number of dimensions and time frames though, given as DIMENSIONS dimensions and MOMENTS moments, and nobody can exist beyond those bounds. Given that Leonardo starts in the d dimension and m moment, and Lord Vultare is in x dimension and y moment, what is the minimum sequence of moves does he have to take to catch Lord Vultare?

Read More

JavaScript functions

Functions in JavaScript are special built-in objects. Because their purpose is to interact with web components, they have properties and usages that are unique and different from common programming languages like Java/C++. There are different ways of coding JavaScript functions.

Let’s start with something familiar though. Regular functions are declared with a function statement, and they are later called by name like standard functions in other common languages . They are useful when you want to group lines of code that have a single responsibility.

function multiply() {
    var result = 3 * 4
    console.log("3 multiplied by 4 is ", result)
}
multiply();
3 multiplied by 4 is  12

Read More

PyTorch Intro

This notebook introduces PyTorch as a jump off from Numpy and shows tensors in forward propogation as a basis in building neural networks.

Read More

Ask Pandas

Pandas has a DataFrame method, query(), that lets you filter out subsets of data using a logical expression query. Since the expression is a string, it reads a little more naturally than subsetting dataframes using nested brackets. The expression is evaluated in a columnar fashion.

Read More

Fast'n'lazy stack πŸ₯žπŸ₯žπŸ₯ž

A funky stack that is lazy but fast.

Scenario

We have to implement 3 operations on a stack-like list structure: push [value], pop, and an increment operation, inc [i] [value], that adds [value] to the bottom [i] elements of the stack ([value] can be negative). For example, inc 3 10 changes the bottom 3 data points in a stack as such:

| 5|      | 5| (top)
| 4|      | 4|
| 2|  =>  |12|
| 2|      |12|
| 3|      |13| (bottom)

At first read, this is simple, but there’s a way to make run it faster than you might’ve considered…

Read More

Ways To Decode A Cipher πŸ” 

Scenario

Determine number of possible ways to decode a given Caeser cipher encoded message that maps:
‘A’ -> ‘1’
‘B’ -> ‘2’

‘Z’ -> ‘26’
The input is a string of n numbers and the output is a number counting all the possible ways a message could be decoded…

Read More