Skip to content

Instantly share code, notes, and snippets.

View creachadair's full-sized avatar

M. J. Fromberger creachadair

View GitHub Profile
@creachadair
creachadair / test.c
Created December 12, 2018 17:03
Closing Unix domain sockets does not clean up the socket path
/*
gcc -std=c99 -o test test.c
./test foobar
*/
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
@creachadair
creachadair / docker-volumes.md
Last active March 8, 2019 15:26
Notes on volumes and mountpoints in Docker

Notes on Volumes and Mountpoints

The following are some lessons I've learned from stumbling around with volumes and mountpoints in Docker. At the outset let me be clear that there is no new information here -- everything described below can be found in the user documentation in one form or another. However, I spent a bunch of time screwing things up for lack of context, so I am recording some of my lessons here so I can find them again.

The Old and the New

There are broadly two ways external filesystems can be attached to a container:

  1. As a pass-through to an existing filesystem on the host. This is what Docker calls a "bind mount", and it basically
@creachadair
creachadair / enumerations.go
Last active May 28, 2019 14:47
A mechanism for representing enumerations in Go
// See also: https://play.golang.org/p/2Bbde-p2MBx
package enum
import "fmt"
// A common way to represent enumerations in Go is to define a type
// whose structure is int, char, string, bool, etc. That has the
// virtue of being simple, but has some deficiencies, viz.
//
@creachadair
creachadair / modules.md
Last active November 19, 2019 15:48
Module dependencies for the Kythe project

Module dependencies for github.com/kythe/kythe

I'm trying to update as many of Kythe's Go dependencies as possible to use tagged versions of Go modules instead of fixed commit hashes. The module tools work fine with arbitrary hashes, but often there is no good way to tell which commits are meant to be "working releases". In practice that means we just grab HEAD periodically and see what works. Tags provide us a signal from the package authors that we can use to set our expectations appropriately.

Status

As of 26-Jul-2019, all the Go dependencies listed below either:

  • have been updated to use tagged versions (see the PR links), or
  • have repositories with neither go.mod files nor tags to pin, or
@creachadair
creachadair / poke.md
Last active June 29, 2019 02:26
Informal survey of Seattle poke

An Informal Survey of Seattle Poke

TODO: Price data.

Tried so far:

  • 45th Stop N Shop & Poke Bar, 2323 N 45th St, Seattle, WA 98103.

    Notes: Quick friendly service, very good fish, and a tasty combination of ingredients. And they have unagi. The main downside is that you don't get to pick what goes in your bowl (though there are addons like avocado), but their defaults are all things I like anyway. Note that at busy times, there can be a line out the door. Be aware also that the poke service is closed during the 3–5pm window, though the rest of the store is open and has a nice selection of sake, mochi, pocky, ice cream, and other interesting stuff.

#!/usr/bin/env python
#
# Copyright 2016 The Kythe Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@creachadair
creachadair / gnupg-tags.md
Created May 26, 2019 23:42
Signing git tags with gnupg

To cryptographically sign a tag, you need to have gpg installed and either have a secret key matching your configured user/e-mail, or define user.signingkey in the git config for your repository.

Assuming you have done this, write

git tag -s -m "description" tagname

This may still fail if gpg is unable to figure out how to prompt you for your passphrase. In that case, verify that gpg-agent is running, and that GPG_TTY is set correctly.

@creachadair
creachadair / bayes-spam.pdf
Last active June 29, 2019 02:21
Bayesian Classification of Unsolicited E-Mail (PDF)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@creachadair
creachadair / dependency-hacking.md
Last active July 5, 2019 14:35
Accurate reverse package dependencies for Go

Accurate reverse package dependencies for Go

Idea: Read each repository on GitHub (et al.) with Go code. Maybe limit this to repositories with a go.mod file, maybe not. You can't get this from the godoc.org API because imports are only updated when you visit the importer, and if nobody does that the imports don't change (you can verify this by checking cases you know of manually and reloading to watch the counter go up).

Use go list ./... to list all the import paths of all the packages, and find the import paths of all packages depended upon by each one.

Build a matrix of: depends-on(x ipath) : [ipath]

Include version numbers maybe, if they're available (e.g., from a go.mod file).

@creachadair
creachadair / python-packages.md
Created July 5, 2019 18:27
Mining Python package dependencies