Archive of posts in category “programming”
-
Ways of reducing mass rebuilds in Nix without changing Nix
One serious problem with Nix is the amount of mass rebuilds happening in Nixpkgs every time some package with many dependents gets an update. I thought about three ideas to reduce mass rebuilds: store path replacements, separating compiling and linking, and ditching check phases. Each of them has some degree of impracticality. -
Imperative programming in Nix language
Nix is a functional programming language primarily used for package management and system configuration. However, it may be interesting to emulate imperative programming constructs within Nix. This post explores how to achieve imperative-style programming in Nix, ipmlementing control flow, exception handling, and interactive IO. -
Multi-pass Gaussian blur filter
According to the central limit theorem, the sum of some i.i.d. samples is normally distributed in the limit of large sample size. This fact can be used to implement a multi-pass Gaussian blur filter, where the total number of passes is equal to the number of samples used in the averaging. Through this, we can also see a nice relation to the heat equation, which is not surprising since the heat kernel is a Gaussian function. -
An 🎃 easy 👻 but 🍬 spooky 💀 Ruby challenge
“It’s the weekend and you’ve just completed a seance with friends. After communing with the dead, you realize a mysterious message was left behind.” What is the decoded message? Use your Ruby skills to find out! -
Labeled
break,next, andredoin Ruby
Many languages support breaking out of nested loops, such as Perl, Java, JavaScript, C#, etc. Languages that have gotocan also do this easily. However, in most other languages, it is not easy to break out of nested loops. I want to introduce a way to do this in Ruby. -
I made this, for the number of days in a week is prime
The number of days in a week is prime, so we cannot utilize weekly periods to help us remember periodical events unless the period is a multiple of 7. However, there may be something that we need to get reminded of which happens once per two days or three days. For example, I wash my hair once per two days and wash my clothes once per eight days. To solve the problem, I wrote a Ruby program to help remind me of those routines. -
Using ntfy to warn me when my computer is discharging
I use udev and systemd to send a notification to my phone via ntfy automatically whenever my laptop is discharging. -
Typesetting math in emails
After some comparison among solutions, I use KaTeX to typeset math in my emails. -
Writing a DSL with commands split by space
DSL means domain-specific language. Ruby is a powerful script language in terms of building DSLs (as sublanguages of Ruby). In this article, I implemented my idea of a DSL with commands split by space. For example, you may just write a b cto run the commandsa,b, andcone after another! This trick is heavily applied in my project alda-rb. How do I achieve this? -
Running Jekyll myself
I have got tired of letting GitHub Pages to run Jekyll for me. I cannot use custom plugins! I decide to run Jekyll myself and push the built result to GitHub repo. I wrote a script to do this.
subscribe via Atom