Skip to content

Instantly share code, notes, and snippets.

improving regex-automata

Andrew Gallant BurntSushi

improving regex-automata
View GitHub Profile
BurntSushi /
Created Apr 22, 2020
Hacky Python script to switch focus between monitors in GNOME while respecting window stacking order.
#!/usr/bin/env python3
# This script serves as duct tape to make the multiple monitor experience
# on GNOME 3 just a little bit better. Currently, the only functionality of
# this script is to switch focus from one monitor to the next, while respecting
# the stacking order of windows inside each individual monitor. However, the
# script is designed to make it easy to add more functionality later. Namely,
# when the script is run, it reads the current monitor, desktop and window
# configuration into a convenient in-memory data structure.
View arch-install
# Recommended steps:
# bootstrap before entering chroot
# copy this script into INSTALL_DIR
# rootinit after entering chroot
# x (if installing graphics)
# pkgs
# xpkgs (if installing graphics)

Keybase proof

I hereby claim:

  • I am burntsushi on github.
  • I am burntsushi ( on keybase.
  • I have a public key ASCuYAG9GLe7P0uomyj2f5-C82uGTD9NwBZGivEXj_7pfQo

To claim this, I am signing this object:

A small API to read and analyze CSV files by inferring types for
each column of data.
Currently, only int, float and string types are supported.
from collections import namedtuple
from __future__ import absolute_import, division, print_function
from collections import namedtuple
import csv
View rustdoc-condensed.js
// works as of 2019-03-02
(function() {
// This function forces rustdoc to collapse documentation for all items,
// except for the methods defined in an impl block and the primary type's
// declaration. This is the most natural view IMO, since it provides the
// primary type along with an easy to scan overview of available methods.
// rustdoc does seemingly have user settings that purport to make this the
// default, but I could never cause them to work in a reliably consistent
// way. This is especially useful when writing documents, where you commonly
BurntSushi / 01-possible-generic-map.go
Last active May 14, 2019
Code from my blog post "Writing type parametric functions in Go."
View 01-possible-generic-map.go
// This is *not* valid Go!
func Map(f func(A) B, xs []A) []B {
ys := make([]B, len(xs))
for i, x := range xs {
ys[i] = f(x)
return ys
Map(func(x int) int { return x * x }, []int{1, 2, 3})
You can’t perform that action at this time.