Skip to content

Instantly share code, notes, and snippets.

View BrandonIrizarry's full-sized avatar

Brandon C. Irizarry BrandonIrizarry

View GitHub Profile
@BrandonIrizarry
BrandonIrizarry / gist:1c0bf4c1ffede9066a8dad2674cb5be8
Last active June 5, 2026 01:28
sqlite3 default CLI config (~/.sqliterc)
.headers on
.mode column
.nullvalue NULL
pragma foreign_keys = on;
pragma case_sensitive_like = true;
@BrandonIrizarry
BrandonIrizarry / countbuffer.go
Last active May 17, 2026 14:13
Non-destructively computing size of buffered channel of struct{} (Go)
package main
import "fmt"
func main() {
r := make(chan struct{}, 2)
r <- struct{}{}
r <- struct{}{}
s := size(r, 0)
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width" />
<title></title>
<link href="css/style.css" rel="stylesheet" />
</head>
@BrandonIrizarry
BrandonIrizarry / chi.go
Created April 23, 2025 00:54 — forked from alexaandru/chi.go
Chi-like syntactic sugar layer on top of stdlib http.ServeMux
// Chi-like syntactic sugar layer on top of stdlib http.ServeMux.
package main
import (
"net/http"
"slices"
)
type (
middleware func(http.Handler) http.Handler
(defun bci/--screenshot-to-image-format (type)
"Save a screenshot of the current frame as a TYPE image, with
the appropriate file-extension.
TYPE should be given as a quoted symbol, as it is passed directly
to `x-export-frames'.
The result is saved to a temp file, with the filename placed also
in the kill-ring."
(let* ((file-extension
@BrandonIrizarry
BrandonIrizarry / build-emacs28.sh
Created November 27, 2022 15:32 — forked from abidanBrito/build_emacs_gtk_x11.sh
Bash script to build GNU Emacs 28 from source.
#!/usr/bin/env bash
## Author: Abidán Brito
## This script builds GNU Emacs 28 with support for native elisp compilation,
## libjansson (C JSON library) and mailutils.
# Exit on error and print out commands before executing them.
set -euxo pipefail
# Let's set the number of jobs to something reasonable; keep 2 cores
@BrandonIrizarry
BrandonIrizarry / main.c
Created August 22, 2021 15:44
Week 3 Honors Assignment from Coursera Course "C For Everyone: Structured Programming"
/*
Brandon C. Irizarry
Create a doubly-linked list of 200 random integers in the range [0,
49]. Then, remove duplicates from this list.
Our strategy is to first sort the list, then remove duplicates by
scanning the sorted list in order, pushing non-repeated elements
onto a new list, and then returning this list.
@BrandonIrizarry
BrandonIrizarry / bubble_sort.c
Last active August 20, 2021 00:41
A minimal example of bubble sort, using a character array as an example. (C language practice.)
/*
Brandon C. Irizarry
8/19/21
Example of Bubble Sort (ascending order).
Upon studying this a bit further, I missed out on
an invariant of the sort.
(The array is always scanned from the beginning each time.)
@BrandonIrizarry
BrandonIrizarry / .Xresources
Created December 31, 2020 16:51
A minimal but useful Xterm configuration file.
! Make communicating with other applications via the clipboard easy
xterm*selectToClipboard: true
! Important - if you leave out 'renderFont', 'faceName' and such won't work. See:
! https://superuser.com/questions/463414/how-to-get-truetype-fonts-to-display-in-xterm-from-a-xresources-file/575108#575108
xterm*renderFont: true
xterm*faceName: monospace
xterm*faceSize: 20
! Some sample configuration settings, to test whether xterm was
@BrandonIrizarry
BrandonIrizarry / spongebob.c
Last active December 20, 2020 00:11
Use C to convert command-line arguments to Spongebob-case.
/*
Small, fun proof-of-concept:
Given a command-line string, convert each argument to
SpongeBob-case. Invoking './spongebob spongebob meme' prints
'sPoNgEbOb mEmE' to stdout.
*/
#include <stdio.h>
#include <ctype.h>