RSSAmplifier

Blog

Ruby Zero

Ruby on Rails, programming and other random thing

blog.monotone.devRSS feed ↗10 posts

Latest posts

Tunnel SSH connection using cloudflared

I’ve been searching for a simple way to tunnel an SSH connection to my private server. There are many solutions to this problem, such as using a VPN service, a reverse proxy, etc. However, these often require installing additional packages and root permissions to manipulate network configurations. Cloudflare offers a tunnel service that can be easily installed by downloading the cloudflared…

Getting Django to Work on a Cheap Shared Hosting Plan

I am renting a very cheap shared server with very generous specs (300 GB disk, TBs of bandwidth, etc.) for about $3/month. Though there are some limitations such as running on fairly old technology, basically a CPanel shared host, only supporting web server with Apache with PHP through CGI, no root access. However, they provide SSH access, so I can manage to run a modern framework with it. Let’s…

Module in JavaScript

JavaScript modules can be a puzzling concept for many developers. In this post, I will try to gather and summarize how to use them effectively. I will split this post into two parts: covering modules in the NodeJS environment and those used in the browser environment. Module in NodeJS CommonJS Traditionally, NodeJS relied on the CommonJS module system for managing code. This system allows…

Biểu thức chính quy và automata

Một số ghi chép về ngôn ngữ hình thức(formal language), ngữ pháp(grammar), regular language và automata. Formal language & BNF grammar Ngôn ngữ hình thức có thể hiểu như một mô hình để mô tả ngôn ngữ(ví dụ tiếng Anh, ngôn ngữ lập trình Python, …). Một ngôn ngữ hình thức(thường ký hiệu L) bao gồm các thành phần: Bộ ký tự: tập hợp các ký tự trong mô hình, các ký tự sẽ được nhóm lại tạo thành…

Linux ODBC and Microsoft Access

The other day I needed to do some data analysis from a Microsoft Access file on my FreeBSD box. Here are the steps that I took. Goal : load data from Access into Python to perform data analysis Library/program used : Python with PyODBC UnixODBC MDBTools UnixODBC UnixODBC is ODBC an implementation on Linux/Unix. Installing it is quite easy, we can simply download the source code, run ./configure ,…

AWS Cognito: client and server authentication

I have struggled for quite some time with setting up Cognito and integrating it into a web application as an authentication service. The documentation from AWS is not very clear on how to set it up and how the different pieces fit together. This post explains how I did it. The setup Client side 1. Create user pool A user pool is like your users’ table. It will contain user information such as…

Basic usage of libuv

libuv and its relation with nodejs When working with Javascript, there is the concept of event loop and the non-blocking model that we should aware of. Every Javascript runtime needs to have its own event loop implementation. An event loop is like a job queue where events will be pushed into it and be processed in time. Those events can be an IO event, a user’s input, etc. Each event will be…

Writing a C Compiler

This year I’ll try learning about compiler by writing a toy C compiler. I’ll roughly follow chibicc but will use C++ and target x64 on OSX. Repo is at mycc Hopefully, I won’t drop it.

Ruby 3: Non-blocking Fiber

Ruby 3 was just released today(2020/12/25) with a lot of new features, among them are: Static type Ractor Non-blocking fiber I’ll focus on non-blocking fiber in this post. I have written an introduction about Fiber some months ago. In case you haven’t heard about Fiber before, here it is: Event driven non blocking IO with Ruby’s fiber Notable change to Fiber in Ruby 3 is the new boolean option…

Ruby 3: Non-blocking Fiber

Ruby 3がついにリリース!(2020/12/25) Ruby 3が今日(2020/12/25)ついにリリースされた! 新機能がたくさん追加されてるけど、特に注目すべきなのは以下の3つ: 静的型(Static type) Ractor(並行処理の新機能) ノンブロッキングファイバー(Non-blocking Fiber) 今回はこの中でも ノンブロッキングファイバー について掘り下げてみるよ。 そもそもFiberって? 実は数ヶ月前にFiberの入門記事を書いたことがある。 もしFiberについて知らないなら、まずはこっちを読んでみて! Rubyのファイバーを使ったイベント駆動型ノンブロッキングIO Ruby 3のFiberに追加された blocking オプション Ruby 3では、 Fiber.new に blockingオプション が追加された。…