Skip to content

Instantly share code, notes, and snippets.

View bensteinberg's full-sized avatar

Ben Steinberg bensteinberg

  • Library Innovation Lab, Harvard Law School
  • Cambridge, MA
View GitHub Profile
@bensteinberg
bensteinberg / index.html
Last active August 29, 2015 14:15 — forked from mbostock/.block
Arc piano
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.key {
stroke-width: 1.5px;
transition: fill 250ms linear, stroke 250ms linear;
transition-delay: 150ms;
}

Keybase proof

I hereby claim:

  • I am bensteinberg on github.
  • I am bens (https://keybase.io/bens) on keybase.
  • I have a public key ASChZ0JqA2RdD3V_YeqkDjSM7_KDqYBfuH52OUJZ4H15WQo

To claim this, I am signing this object:

@bensteinberg
bensteinberg / notifier-howto.txt
Last active March 1, 2019 16:56
Set up a daily notification in Slack for changes in a remote git repo on Heroku Scheduler
# set up an incoming webhook on Slack (https://api.slack.com/incoming-webhooks), then
heroku create my-notifier
heroku config:set REPO='https://github.com/some/repo.git' -a my-notifier
heroku config:set SINCE='1 day ago' -a my-notifier
heroku config:set WATCHFILES='file1 file2 /full/path/to/file3' -a my-notifier
heroku config:set WEBHOOK='https://hooks.slack.com/services/my/web/hook' -a my-notifier
heroku config:set USERNAME='a user who notifies' -a my-notifier
heroku config:set EMOJI='ghost' -a my-notifier
heroku addons:create scheduler:standard -a my-notifier
# note the ID of the scheduler, then

SaltStack, a system for configuration and orchestration of remote servers, allows for targeting of minions by

  • minion ID: salt 'perma-server-01' test.ping or salt 'perma*' test.ping
  • grains, data specific to a minion, such as CPU architecture or deployment tier: salt -G 'oscodename:buster' test.ping
  • pillars, data assigned to one or more minions centrally, often secrets: salt -I 'foo:bar' test.ping
  • IP address or subnet
BEGIN MESSAGE.
MNmauX4vkEGs6Ui Ag8iIlshucydUvI KfzzSuuLMmaEzZt QeRRvbqeRljy6zZ
Mm32yWR48LKpGOn 1pTf9Kjp0twTCKq 6Xr2MZHgg4UPjtm WNOodK9ZlS5is8R
EmB85OBSiOEYPHy 2Gtas7Lkh2N6yRk Ejw9aplEZCPrTmm aA9Px7FPwPg1M6T
AfWeI1AG1weF7zv JbQSLs5k8xIJAab 9K5Kh2BwlTVlNtt .
END MESSAGE.
@bensteinberg
bensteinberg / pre-commit
Last active January 2, 2023 21:41
pre-commit hook for adding a timestamp to the frontmatter of markdown files
#!/usr/bin/perl
use POSIX qw(strftime);
# this is a pre-commit hook for setting a timestamp in the frontmatter
# of markdown files
my $date = strftime "%Y-%m-%dT%H:%M:%SZ", gmtime;
my @files = `git diff-index --cached --name-only HEAD`;
foreach (@files) {
if (/\.md$/) { # maybe HTML, too?
docker run -v $PWD/wikipages.txt:/app/seedFile.txt -v $PWD/crawls:/crawls/ webrecorder/browsertrix-crawler crawl --seedFile /app/seedFile.txt --combineWARC --depth 0 --workers 4 --behaviors autoplay,autofetch --collection wiki