Posts from 2019
-
Desktop Audio Visualizer with i3 and Cava on WSL
After seeing pictures of people running desktop audio visualizers on Reddit, I started to think if it is possible to replicate the effect on my i3-gaps setup running on Windows Subsystem for Linux (WSL).
-
Install Debian on a VPS Provider without Debian Images
Recently, I came across a VPS provider that does not provide Debian images. This is rather annoying since I much prefer a fresh minimal install of Debian over a “minimal” Ubuntu image that still has a lot of stuff that I don’t want.
Naturally, I decided to install Debian anyways, and came up with an approach to do so.
If you are feeling particularly bold, you can try running my pre-made scripts that would convert a fresh Ubuntu install to a fresh Debian install.
To use the scripts, you should download either the UEFI version or the BIOS version, depending on whether your current OS is using BIOS or UEFI.
At the top of the script, change the variables to match your system configuration. The most important one being
BOOT_DRIVE
so thatgrub
would be installed on the correct device.The scripts will prompt you for a root password and SSH keys. Once the script finishes, the system will be rebooted and you should be able to SSH into the now-Debian machine as root via the SSH keys.
If you don’t feel like using the script, I am also providing manual instructions. This also explains how the scripts work.
-
Using Unordered Data Structures on C++ std::pair
In many situations, it seems fairly natural to use
std::unordered_set
andstd::unordered_map
onstd::pair
. Here’s an example of what you might be tempted to do:#include <unordered_set> int main(void) { std::unordered_set<std::pair<int, int>> test; }
However,
std::pair
is not hashable by default, so a simple snippet like the above would not work.There are many proposals online to define a
pairhash
class and explicitly specify it as the hash function as a template parameter tostd::unordered_set
andstd::unordered_map
.This is not a bad idea. In fact, if you are writing a library, you should probably do this. But we can do better…
-
Simple NDP Proxy to Route Your IPv6 VPN Addresses
If you tried setting up an IPv6-capable VPN on a VPS provider that gave you an IP range to play with, perhaps a /64 or larger, you would want to assign some of the IPv6 addresses you have to your clients. In this post, we suppose that you have the range
2001:db8::/64
.This should be a simple process: enable the
sysctl
optionnet.ipv6.conf.all.forwarding
to1
(or whatever the equivalent is on your system), use DHCPv6 or SLAAC to assign the addresses to the clients, and then your client should have working IPv6.The Problem
Unfortunately, this is not so simple. Most VPS providers are not actually routing the entire subnet
2001:db8::/64
to you. Rather, they just connect a number of VPSes onto the same virtual Ethernet network and rely on the Neighbour Discovery Protocol (NDP) to find the router.