Skip to content

Instantly share code, notes, and snippets.

@jwbee
jwbee / jq.md
Last active July 15, 2025 12:12
Make Ubuntu packages 90% faster by rebuilding them

Make Ubuntu packages 90% faster by rebuilding them

TL;DR

You can take the same source code package that Ubuntu uses to build jq, compile it again, and realize 90% better performance.

Setting

I use jq for processing GeoJSON files and other open data offered in JSON format. Today I am working with a 500MB GeoJSON file that contains the Alameda County Assessor's parcel map. I want to run a query that prints the city for every parcel worth more than a threshold amount. The program is

@tadcos29
tadcos29 / DOIRegexTutorial.md
Last active September 2, 2025 09:19
A small tutorial on regex using the DOI format as example.

Simple Regex Tutorial - DOI Edition

The DOI, or Digital Object Identifier, is a unique string created according to a standardised scheme, which can be assigned to any object and subsequently used to identify or track it. The adjective 'digital' here qualifies 'identifier', not 'object' - one could theoretically pin a DOI on absolutely anything: digital, physical or ephemeral - but in practice the ambiguity resolves itself, as DOIs depend on digital search for much of their usefulness. Most people are likely to encounter DOIs as references to academic journal articles, but over the years they have been assigned to quite a few interesting entities; for example, the NASA Planetary Systems Table, a regularly-updated collection containing the parameters of known exoplanets and their stars, bears the DOI of 10.26133/NEA12.

Given their ubiquity, it's useful to be able to validate DOIs using regular expressions, which in turn makes them a useful starting point for a basic regex tutorial.

Summary

The DO

@swatson555
swatson555 / heap-lisp.c
Created February 17, 2023 12:42
Heap based scheme machine.
/* Heap based virtual machine described in section 3.4 of Three Implementation Models for Scheme, Dybvig
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
char token[128][32];
@dikiaap
dikiaap / git-io-custom-url.md
Last active November 26, 2025 10:21
git.io custom URL

Update: As of 11 January 2022, git.io no longer accepts new URLs.

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
@akeep
akeep / my-matrix.ss
Last active October 10, 2020 19:56
Optimizing matrix multiple example, side trial: use a flat byte vector to represent the matrix
#|
usage:
> (import (my-matrix))
> (sanity)
#t
> (run-bench)
500 x 500 matrix multiply in Chez took 2472 msec
500 x 500 matrix multiply in Chez took 2474 msec
...
@akeep
akeep / my-matrix.ss
Created December 27, 2017 04:52
Optimizing matrix multiple example, step 2: remove unnecessary set!
#|
usage:
> (import (my-matrix))
> (sanity)
#t
> (run-bench)
500 x 500 matrix multiply in Chez took 2472 msec
500 x 500 matrix multiply in Chez took 2474 msec
...
@X3MBoy
X3MBoy / nano-shorts.md
Created April 28, 2017 20:27 — forked from franz-josef-kaiser/nano-shorts.md
nano keyboard shortcuts

^ = Ctrl key M = Alt key

^G      (F1)            Display this help text
^X      (F2)            Close the current file buffer / Exit from nano
^O      (F3)            Write the current file to disk
^J      (F4)            Justify the current paragraph

^R      (F5)            Insert another file into the current one
@JasonGiedymin
JasonGiedymin / fast_inv_square.coffee
Created June 20, 2011 20:43
CoffeeScript Javascript Fast Inverse Square with Typed Arrays
###
Author: Jason Giedymin <jasong _a_t_ apache -dot- org>
http://www.jasongiedymin.com
https://github.com/JasonGiedymin
Appearing in the Quake III Arena source code[1], this strange algorithm uses
integer operations along with a 'magic number' to calculate floating point
approximation values of inverse square roots[5].