Skip to content

Instantly share code, notes, and snippets.

htp /
Last active May 11, 2021
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host:" \
--header "Origin:" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
htp / static-site-post-receive-hook
Created Jul 2, 2020
A post-receive hook for "deploying" static sites using Git.
View static-site-post-receive-hook
main() {
local temporary="$(mktemp -d)"
local repository="/path/to/bare/repository.git"
local deployment="/path/to/site/root"
echo -n "Copying files... "
git --work-tree="${temporary}" --git-dir="${repository}" checkout --force
echo "done."
htp /
Created Mar 11, 2017
A solution to the Jindosh Riddle from Dishonored 2, written in Prolog.
% At the dinner party were Lady Winslow, Doctor Marcolla,
% Countess Contee, Madam Natsiou, and Baroness Finch.
% The women sat in a row. They all wore different colors and
% Baroness Finch wore a jaunty green hat. Madam Natsiou was at
% the far left, next to the guest wearing a blue jacket. The lady in
% red sat left of someone in white. I remember that red outfit
% because the woman spilled her whiskey all over it. The traveler
% from Dunwall was dressed entirely in purple. When one of the
% dinner guests bragged about her Ring, the woman next to her
htp / Makefile
Last active Aug 31, 2016
A skeleton Makefile.
View Makefile
.DEFAULT_GOAL = targets
# List available targets.
.PHONY: targets
@echo Available targets are:
@awk -v default_goal=$(.DEFAULT_GOAL) '/^# / { \
description = substr($$0, 3); \
line = ""; \