This function creates a registration code with 8 ASCII characters. The aim is to send a user a secret, which can be easily copied by the user into a registration dialog. The secret uses a reduced alphabet of 32 letters and digits. Characters known to be commonly confused by users are removed. The secret is not a password. It is just a personal token to enable the registration in order to prevent annonymous registration attempts.
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
module:=$(shell go list -f '{{.Module}}' .) | |
source:=$(shell go list -f '{{join .GoFiles "\n"}}' $(module)) | |
embedded:=$(shell go list -f '{{join .EmbedFiles "\n"}}' $(module)) | |
build: $(module) | |
$(module): $(source) $(embedded) | |
go build -v $(module) |
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
package main | |
import ( | |
dbg "runtime/debug" | |
fmt "fmt" | |
os "os" | |
tm "time" | |
) | |
func outer() { |
Suppose you have cloned https://github.com/CVEProject/cvelistV5
Find all CVE-IDs for which the assignerShortName
of the cveMetadata
is "Go":
find cves -type f -name 'CVE-*.json' -exec cat {} + |
jq -r '.cveMetadata | select(.assignerShortName == "Go") | .cveId'
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 | |
if [[ -e "$1" && ! -d "$1" ]]; then | |
jq -C . "$@" | |
else | |
jq -C "${@-.}" | |
fi | | |
less -R | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Bounce</title> | |
<style> | |
body { background: silver; } | |
canvas { background: white; } | |
span.sign { display: inline-block; white-space: pre; width: 1ch; text-align: center; } | |
span.number { display: inline-block; white-space: pre; } |
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 | |
set -eu | |
usage() { echo "Usage: $0 [-w WAIT] [PNGFILE]" 1>&2; } | |
while getopts "w:h" o; do | |
case "${o}" in | |
w) wait=$((OPTARG));; | |
h) usage; exit 0;; | |
*) exit 1;; |
The following produces a table with two columns: a date and a file name.
$ find /etc/network -type f -printf '%T@\t%p\n'
1670618223.0000000000 /etc/network/if-down.d/resolved
1689161114.2422386520 /etc/network/interfaces
1673911860.0000000000 /etc/network/if-up.d/ntpsec-ntpdate
1670618223.0000000000 /etc/network/if-up.d/resolved
NewerOlder