NoCache

Preview of Setup Cloudflare Dynamic DNS (DDNS) with CLI on Windows, Mac, Linux

Setup Cloudflare Dynamic DNS (DDNS) with CLI on Windows, Mac, Linux

Cyrus Kao

Cloudflare API v4 enables users to update DNS records programmatically, which makes Dynamic DNS (DDNS) implementation possible. I recently wrote a CLI tool called cf-ddns-cli in Node.js to update DNS A (IPv4) and AAAA (IPv6) records with your current IP address, and it's available in Windows, Mac and Linux.

Preview of Auto Delete Expired Documents in MongoDB with Node.js (TTL Index)

Auto Delete Expired Documents in MongoDB with Node.js (TTL Index)

Cyrus Kao

TTL Indexes in MongoDB are very useful for storing data like logs or user sessions. The document will remove itself after a certain amount of time which is specified by the index. This tutorial will be done in both JavaScript and TypeScript using Node.js with node-mongodb-native, which is the official MongoDB Node.js driver.

Preview of Check If an URL is Internal or External in JavaScript/TypeScript

Check If an URL is Internal or External in JavaScript/TypeScript

Cyrus Kao

Knowing whether a link is internal or external is essential for setting rel in HTML a tag. For an external link, noreferrer noopener nofollow is usually recommended. To test a full URL or relative path in JavaScript/TypeScript, we'll be using the URL constructor. It's available in both browsers and Node.js.

Preview of Run Node.js and NPM with Sudo (Fix "Command not Found" with NVM)

Run Node.js and NPM with Sudo (Fix "Command not Found" with NVM)

Cyrus Kao

While using NVM on Linux, it loads Node.js and NPM from .bashrc in the home directory of your user. However, if you execute the command with sudo like sudo npm start it will result in sudo: npm: command not found since .bashrc of root is not managed by NVM.

Preview of Install & Manage Multiple Versions of Node.js with NVM on Linux

Install & Manage Multiple Versions of Node.js with NVM on Linux

Cyrus Kao

Managing Node.js versions on Linux is no longer a pain in the ass with NVM (Node Version Manager). It can install different versions of Node.js and NPM on a single machine, switch versions anytime you wish. And the best part is NVM is just a Bash script, truly a lightweight helper for both testing and production.

Preview of Build a Telegram Bot to Send Notifications in Node.js with TypeScript

Build a Telegram Bot to Send Notifications in Node.js with TypeScript

Cyrus Kao

Instead of using Telegram bot frameworks like telegraf.js and node-telegram-bot-api, I created a Telegram sender with less than 100 lines of code in Node.js to simply send notifications to myself. And there is nothing wrong with using a full-featured framework, but building your own is definitely easier to maintenance.

Preview of Build a Key-Value LRU Cache Module in Node.js with Typescript

Build a Key-Value LRU Cache Module in Node.js with Typescript

Cyrus Kao

I created a simple key-value LRU (Least Recently Used) cache module for storing user sessions of this blog. And with the power of Javascript ES6 Map object, it's easy to implement a efficient cache system. In this guide we'll be building this module from scratch in Node.js with Typescript.

Preview of Build an IP Based Rate Limiting Module in Node.js with Typescript

Build an IP Based Rate Limiting Module in Node.js with Typescript

Cyrus Kao

I recently wrote a very simple IP address based rate limit module called rt-limit to throttle requests for this blog. Although rate limiting is more commonly done on reverse proxies like Nginx and Apache, being able to manage traffic on your own back-end server is always more flexible.

Preview of Build a Cryptographically-Secure Password Generator in Node.js with TypeScript

Build a Cryptographically-Secure Password Generator in Node.js with TypeScript

Cyrus Kao

I wrote a dead simple JavaScript library called pswd-generator to generate passwords for this blog. In just 23 lines of code, I was able to build a cryptographically-secure password generator thanks to Node.js's native crypto module. And this guide will show you how it's done with TypeScript.

Preview of How to Fix Zalgo Issue (Spamming Console) with Colors.js 1.4.1/1.4.2

How to Fix Zalgo Issue (Spamming Console) with Colors.js 1.4.1/1.4.2

Cyrus Kao

Colors.js, the open source Javascript package used by 4.3 million repositories has recently been corrupted by its owner Marak. Causing the library spamming console with a bunch of garbled characters.