Skip to main content

Authentication Multiplexing

Haven't we all lived some form of the diagram below:

Server Architecture
VM you control
request
Nginx
Basic Auth
Caddy
Reverse Proxy
Server
Token Auth
Some other service
Token Auth
Client Browser

Your real server is behind a reverse proxy. But all ingress traffic comes through a different gated proxy not in your control that locks everything behind it with a Basic Auth.

Animating seven-segment displays with a web tool

Seven Segment animator

the real thing

So a friend was building a device which had an array of 6 seven-segment-displays. We were thinking about some cool idle and loading animations we might be able to program into it.

I didn't ask for the specifics but it was clear that the display unit had an arrangement of one shift register (probably a 74HC595) per digit. The 74HC595 is a nice little chip that can be fed one byte serially, and it outputs that byte in parallel. It also latches onto that byte for however long we ask it to, and it can be daisy-chained. So it is a cheap way to drive a huge amount of LED lights with a few micro-controller pins.

Nepali Date on the Playdate

playdate on a 3d printed stand

I finally got the Playdate. This little yellow machine is nice to look at and quite fun to play with, but it doesn't yet have the kind of games I like to play. No problem, I'm writing them myself.

Meanwhile, I have 3d printed a stand for it, and it sits on my desk acting as a unique clock.

Now that I have a stand and a really cool memory LCD display which barely needs power to display static images, I can display anything on it while it sits on my desk.

nightless

sleep tight good night is when the world stops and the universe is a box of cyan walls inside which you will find me with fever intense and endless and with my body hollow and transparent and just a little candlelight for heart which is hard to see, actually, for all these incandescent bulbs unnatural and nauseating but necessary, indispensable actually, these lights that burn my soul with their uncaring intensity they bind me they destroy me.

The TMS website sucks so I made a captcha autofiller

In keeping with the spirit of the times, I've started playing in the Nepali Stock Exchange playground. It is a strange, distorted world for someone like me who's used to the determinism of the computer realm. And so far, it has just proved to be a more fashionable way of losing money. But it's addictive!

If you've ever had to use Nepal Stock Exchange's Trade Management System (often called just TMS), you probably hate it. It is at best an incompetently made software with many glaring issues, hosted over a woefully underpowered infrastructure that cannot even handle the most predictable of traffic spikes. On more than one occasion I've oversold or undersold shares because it's UI was out of sync with it's database.

An Octopus and a Game Engine

I started making this thing as a one-day experiment: a fun little browser-game I could craft before committing to the everlooming neverending self-judo one-man-deathwrestle called exams. But it instead ended up spreading out sparse as intense hour-long coding sessions throughout the Quarantine months.

पर्खीर'न्छु

I keep on waiting
for a relief; she'll come barefoot

Like the wind she'll
blow out the candles I've lit
and like the wind she'll
whisper in my ear

I'm waiting for that
whisper in my ear ...

Flappy Millennial: An HTML5 Canvas Game

Meet Flappy Millennial. He's an average guy in his mid 20's and the future looks bleak for him. With the threats of climate change, mass-extinctions, rising authoritarianism, economic depression, unprecedented wildfires and so much more ever-looming, nihilism has become his background music.

But worry not. For he has an antidote—well, not so much an antidote as a sedative. He has his phone! Come help this Flappy Millennial ignore reality while he scrolls through Instagram or something. You should play this game not because it's good or anything, but simply so you too can pretend that things are okay for a while.

Making मनसा: a Nepali Programming Language

I've been working on and off on a Nepali programming language with my friends for the last few months. It's called मनसा (IAST: mansā) and I think it's ready for an alpha release. If you'd like to try the language out, visit mnsa.cc - the official website. You can play around with the language right in the browser without having to download anything, not even a Devanagari keyboard layout.

This post is a collection of random things I want to say about the language, including how the idea came about, the interesting things I learnt making the project, and the problems faced.

An easier Nepali keyboard layout

As I wrote in my (excruciatingly long and boring) article on the Nepali language and Unicode, typing in Nepali doesn't have to be a pain. You are absolutely free to make your own keyboard layout to type in Nepali Unicode (which, by the way, has much better fonts than Preeti and Sagarmatha). In fact, a few months ago, I made my own keyboard layout because there's no way I'm going to be able to cram the random key mappings of the traditional Nepali typing layout. Sorry dad, your son has renounced ancestral typing for good.

Visualize C++ Data Structures using Graphviz and the DOT language

Data structures help structure and organize data effectively, and provide several abstracted operations on the data. They are elegant and convenient, and computer scientists love to use them. Implementing these data structures in the computer require the programmer to flatten the structure into a one-dimensional model using pointers or references because the memory is actually arranged as a one-dimensional run of data elements.

It is often necessary to inspect the data structure in debugging and program verification phases. But some data structures happen to be particularly graphical, in that they have multiple associations and elaborate hierarchies or layers. Think of a Rope or a Graph. Due to many associations between nodes, it's not possible to properly display the graph on the terminal.

On the Nepali Language and Unicode

The Nepali language gets very little representation on the internet. Take, for example, the Nepali Wikipedia which has about 33 thousand articles. The Esperanto Wikipedia boasts 8 times that number (at around two hundred thousand articles), which is kind of sad, because Esperanto is an artificial language created by one person in the 19th century. It is spoken by a meager 2 million people worldwide. Compare this to the Nepali language, which has more than 25 million speakers.

Sandboxing Unsafe Executables in Linux for an Online Compiler with Minijail

I wrote a toy compiler few months back. I wanted people to see it, so I put the code up on Github. But as it turns out, not everyone is willing or capable of going through the convoluted process of cloning the repository, compiling the program, installing a Nepali language keyboard and learning an obscure half-baked programming language just because some idiot put it on Github.

So, I started to write a web app to make the program easily accessible. The web app lets user write code in their browser, then compiles and executes the program on the server, and allows the user to send input from the browser to the server as it executes.

Animating WALL-E on a LED dot-matrix display with AVR

I was asked to animate a dot-matrix display for the robotics club recently. They wanted something that said "Robotics Club" to hang over their door. We had some old P10(1r) DMDs which I had worked on in the past to make a little scoreboard for a robot football match. And, even though I am not very good at it, I really love animating things. So I decided to give it a shot. I ended up writing an animation software for the DMD in JavaScript which is unfortunately only as functional as a flipbook. But I had fun animating little person carrying a balloon, ugly gear trains and a little pixel Wall-E blinking.

Animating a Skeleton in Pixel Art

I animated this a while back. I remember it took me days. First I had to learn how to actually draw the human skeleton (The Atlas of Human Anatomy for the Artist by Stephen Peck is an amazing resource). Then I had to distill the ideas into the bare minimum required to get the picture across. Finally I drew and animated the whole thing in piskel. The animation process was quite tedious, at least in part because this was my first try.