This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
gw="$(route -n show | awk '$1 == "default" { print $2 }')" | |
awk -v gw="$gw" ' | |
$1 == "PrivateKey" { key = $3 } | |
$1 == "Address" { | |
addr = $3 | |
sub(/,.*/, "", addr) | |
} | |
$1 == "DNS" { dns = $3 } | |
$1 == "PublicKey" { peer = $3 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# dock: switches between external and internal displays. | |
prefix="${0##*/}:" | |
log() { echo "$prefix" "$@" >&2; } | |
fatal() { log "$@"; exit 1; } | |
int='eDP-1' | |
mode='1920x1080' | |
[ "$(uname)" = OpenBSD ] || fatal 'not running in OpenBSD' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
artifactId = a | |
directory = build | |
outputDirectory = $(directory)/classes/java/main | |
sourceDirectory = src/main/java | |
sources = $(shell find $(sourceDirectory) -name \*.java) | |
objects = $(sources:$(sourceDirectory)/%.java=$(outputDirectory)/%.class) | |
package = $(directory)/libs/$(artifactId).jar | |
JAR = jar | |
JAR_FLAGS = cvf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set-option -g prefix C-a | |
bind-key C-a send-prefix | |
set-option -g default-terminal "screen-256color" | |
set-option -g escape-time 50 | |
set-option -g focus-events on | |
set-option -g history-limit 10000 | |
set-option -g mouse on | |
set-option -g status-bg default | |
set-option -g status-fg default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* trie.js */ | |
class TrieNode { | |
constructor(value) { | |
this.value = value; | |
this.children = new Map(); | |
this.isEndOfWord = false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Remapping Keys in macOS | |
# https://developer.apple.com/library/archive/technotes/tn2450/_index.html | |
set -e | |
userscript="$HOME/bin/userkeymap" | |
mkdir -p "$HOME"/bin | |
cat <<EOF > "$userscript" | |
#!/bin/bash | |
hidutil property --set '{"UserKeyMapping": [ | |
{"HIDKeyboardModifierMappingSrc": 0x700000064, "HIDKeyboardModifierMappingDst": 0x700000035} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:buster | |
ENV SHELL=/bin/bash | |
RUN apt-get update -y && apt-get install -y \ | |
bash-completion \ | |
build-essential \ | |
cmake \ | |
ctags \ | |
curl \ | |
git \ | |
git-extras \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS `collection` ( | |
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, | |
`uuid` BINARY(16) NOT NULL, | |
`value` MEDIUMBLOB NOT NULL, | |
`version` BIGINT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'optimistic updates', | |
`format` ENUM ('R', 'J', 'M') NOT NULL DEFAULT 'J' COMMENT 'R: raw, J: json, M: msgpack', | |
`compression` ENUM ('N', 'Z') NOT NULL DEFAULT 'N' COMMENT 'N: none, Z: gzip', | |
`deleted_at` DATETIME NULL DEFAULT NULL, | |
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
`updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const entity = { | |
"&": "&", | |
"<": "<", | |
">": ">", | |
'"': """, | |
"'": "'", | |
"`": "`", | |
"=": "=" | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
htag.js | |
A Bare bones interpretation of the Hyperscript syntax. | |
*/ | |
var h = function h(tag, attributes, ...children) { | |
const node = document.createElement(tag); | |
attributes = attributes || {}; | |
Object.keys(attributes).forEach(attr => { | |
if (attr === "style" || attr === "dataset") { | |
const value = attributes[attr]; |