Skip to content

Instantly share code, notes, and snippets.

View artyom's full-sized avatar

Artyom Pervukhin artyom

View GitHub Profile
@artyom
artyom / links.md
Created May 22, 2021 08:24
markdown and commonmark links
@artyom
artyom / test.md
Created May 21, 2021 09:49
markdown code block example

Here you go:

~ ¶ date -u
Fri May 21 09:48:43 UTC 2021
// 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 July 13, 2020 09:33
age as a library example
module age-example
go 1.15
require filippo.io/age v1.0.0-beta4
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 March 26, 2020 09:12
cryptsetup benchmark
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
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 August 6, 2019 17:18
gomarkdown quoted fenced code block bug

Bug demo:

quoted block 1 start

fenced pre block 1

quoted block 1 end

@artyom
artyom / update_usage.go
Created June 20, 2019 11:28
Tool to generate go file with "usage" constang holding "main" package docs
//+build generate
package main
import (
"bytes"
"fmt"
"go/doc"
"go/parser"
"go/token"
# 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'