Skip to content

Instantly share code, notes, and snippets.

@artyom
artyom / links.md
Created May 22, 2021
markdown and commonmark links
View links.md
@artyom
artyom / test.md
Created May 21, 2021
markdown code block example
View test.md

Here you go:

~ ¶ date -u
Fri May 21 09:48:43 UTC 2021
View main.go
// Flags parsing illustration for https://www.reddit.com/r/golang/comments/il5h9g/looking_for_cli_parsing/
package main
import (
"flag"
"log"
"os"
"strings"
)
@artyom
artyom / go.mod
Created Jul 13, 2020
age as a library example
View go.mod
module age-example
go 1.15
require filippo.io/age v1.0.0-beta4
View go.mod
module radix-bug
go 1.14
require (
github.com/mediocregopher/radix/v3 v3.5.1
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a
)
@artyom
artyom / out.txt
Created Mar 26, 2020
cryptsetup benchmark
View out.txt
artyom@rpi:~ $ sudo cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1 359593 iterations per second for 256-bit key
PBKDF2-sha256 539390 iterations per second for 256-bit key
PBKDF2-sha512 261359 iterations per second for 256-bit key
PBKDF2-ripemd160 266136 iterations per second for 256-bit key
PBKDF2-whirlpool 47489 iterations per second for 256-bit key
argon2i 4 iterations, 230664 memory, 4 parallel threads (CPUs) for 256-bit key (requested 2000 ms time)
argon2id 4 iterations, 240514 memory, 4 parallel threads (CPUs) for 256-bit key (requested 2000 ms time)
# Algorithm | Key | Encryption | Decryption
View Dockerfile
FROM golang:alpine AS builder
WORKDIR /app
ENV GOPROXY=https://proxy.golang.org CGO_ENABLED=0
COPY . .
RUN go build -ldflags='-s -w' -o server
FROM scratch
EXPOSE 8080
VOLUME /web
COPY --from=builder /app/server .
@artyom
artyom / bug.md
Last active Aug 6, 2019
gomarkdown quoted fenced code block bug
View bug.md

Bug demo:

quoted block 1 start

fenced pre block 1

quoted block 1 end

@artyom
artyom / update_usage.go
Created Jun 20, 2019
Tool to generate go file with "usage" constang holding "main" package docs
View update_usage.go
//+build generate
package main
import (
"bytes"
"fmt"
"go/doc"
"go/parser"
"go/token"
View zshrc
# Correctly display UTF-8 with combining characters.
if [ "$TERM_PROGRAM" = "Apple_Terminal" ]; then
setopt combiningchars
fi
disable log
export CLICOLOR=1
export GREP_OPTIONS='--color=auto'
export LESS='-iFXc'