Skip to content

Instantly share code, notes, and snippets.

@zmwangx
zmwangx / .gitignore
Last active July 12, 2024 17:25
This program demonstrates how to correctly use openpty(3) from libutil on Linux to execute a command that must be run in a tty, and capture its (arbitrarily long) output.
pty
pty.o
@Earnestly
Earnestly / makepkg_overview.rst
Last active May 18, 2025 05:43
A brief overview of the process involved in creating a pacman package.

A Brief Tour of the Makepkg Process: What Makes a Pacman Package

Introduction

This is a terse document covering the anatomy of a package built for the pacman package manager.

The following example commands can mostly run verbatim to manually create a

@evincarofautumn
evincarofautumn / monoid.cpp
Last active August 1, 2024 20:10
Monoids in C++
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
// In Haskell, the Monoid typeclass is parameterised by only a type. Such a
// definition requires “newtype hacks” to produce different monoids on the same
// type. This definition is parameterised by both the type and the function, and
// as such can be used to define different monoids on the same type without any
// interference.