Skip to content

Instantly share code, notes, and snippets.

htp /
Last active May 9, 2023 09:17
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 / Makefile
Last active August 31, 2016 00:30
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 = ""; \
htp /
Created March 11, 2017 17:43
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 / static-site-post-receive-hook
Created July 2, 2020 07:17
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."