Skip to content

Instantly share code, notes, and snippets.

@paralin
paralin / make-multiarch.bash
Created October 23, 2021 21:21
Create a multi-arch docker image from arch tags
#!/bin/bash
set -eo pipefail
pull_image() {
if ! docker inspect $1 ; then
docker pull $1
fi
docker inspect $1
}
@paralin
paralin / main.go
Created June 11, 2021 08:05
go: generate 32 bytes and encode to hex
package main
import (
"crypto/rand"
"encoding/hex"
"os"
)
func main() {
// generate 32 bytes key
@paralin
paralin / nordvpn-wireguard.md
Created June 4, 2021 04:01
NordVPN wireguard run with docker

Multi-arch image:

  docker run -dt --restart=always --cap-add=NET_ADMIN --name vpn \
             -e USER="[email protected]" -e PASS='MyNordVPNPasswordHere' \
             -e TECHNOLOGY=NordLynx -d paralin/bubuntux-nordvpn:latest
  docker run --rm -it --net=container:vpn alpine:edge
@paralin
paralin / main.go
Created June 3, 2021 01:31
extract go-bee ethereum key from dir
package main
import (
"fmt"
"github.com/ethersphere/bee/pkg/crypto"
filekeystore "github.com/ethersphere/bee/pkg/keystore/file"
)
func main() {
@paralin
paralin / bench.bash
Last active March 8, 2021 16:49
Benchmark used for SkiffOS report
#!/bin/bash
set -eo pipefail
set -x
MTPT=$(pwd)/bench-mtpt
if [ ! -d $MTPT ]; then
mkdir $MTPT
fi
if mountpoint -q $MTPT; then
@paralin
paralin / jetson-tx2-boot-fail.log
Last active February 25, 2021 01:14
jetson tx2: boot failure against 32.5 kernel version 4.9.201 (oe4t)
U-Boot 2016.07-g7a7e3f476e (Oct 16 2020 - 12:15:13 -0700)
TEGRA186
Model: NVIDIA P2771-0000-500
DRAM: 7.8 GiB
MC: Tegra SD/MMC: 0, Tegra SD/MMC: 1
*** Warning - bad CRC, using default environment
In: serial
 * Package: dev-libs/glib-2.64.5
 * Repository: gentoo
 * Maintainer: [email protected]
 * USE: arm64 dbus elibc_glibc kernel_linux mime userland_GNU xattr
 * FEATURES: distcc preserve-libs userpriv
* FEATURES='ebuild-locks strict xattr qa-unresolved-soname-deps unknown-features-warn assume-digests distlocks binpkg-docompress distcc preserve-libs news binpkg-dostrip fixlafiles multilib-strict protect-owned merge-sync config-protect-if-modified userfetch userpriv usersync sfperms parallel-fetch unmerge-orphans buildpkg unmerge-logs binpkg-logs'
* CFLAGS='-O3 -march=armv8-a+crc+crypto+simd -mtune=cortex-a53 -fgraphite-identity -flto=auto -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed'
* CXXFLAGS='-O3 -march=armv8-a+crc+crypto+simd -mtune=cortex-a53 -fgraphite-identity -flto=auto -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed'
* FFLAGS='-O3 -march=arm
@paralin
paralin / gist:360553e7558a85576b9e6b9ca45f247d
Created January 4, 2021 01:10
glib-jetson-tx2-lto-fail.log
 * Package: dev-libs/glib-2.64.5
 * Repository: gentoo
 * Maintainer: [email protected]
 * USE: arm64 dbus elibc_glibc kernel_linux mime userland_GNU xattr
 * FEATURES: distcc preserve-libs userpriv
* FEATURES='qa-unresolved-soname-deps sfperms protect-owned fixlafiles distlocks usersync assume-digests userpriv preserve-libs parallel-fetch unknown-features-warn strict multilib-strict buildpkg distcc ebuild-locks merge-sync unmerge-orphans config-protect-if-modified news xattr unmerge-logs binpkg-logs binpkg-dostrip userfetch binpkg-docompress'
* CFLAGS='-Ofast -march=armv8-a+crc+crypto+simd -mtune=cortex-a53 -fomit-frame-pointer -fno-fast-math -ftree-vectorize -fgraphite-identity -flto=auto -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed'
* CXXFLAGS='-Ofast -march=armv8-a+crc+crypto+simd -mtune=cortex-a53 -fomit-frame-pointer -fno-fast-math -ftree-vectorize -fgraph

Performance samples for OpenSSL 1.1.1i 8 Dec 2020:

openssl speed -elapsed -evp aes-256-cbc

The 'numbers' are in 1000s of bytes per second processed.

device             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
macbook          505003.18k   536526.46k   544402.52k   546639.19k   547176.45k   546592.09k
pinebook 347717.96k 736568.15k 1001372.76k 1086186.84k 1131063.98k 1131872.26k

Chromium OS ft. Docker

Chromium OS is cool. Chromium OS with crouton is cooler. Chromium OS with Docker is even cooler. This is specifically a guide for the HP Chromebook 13 G1 (aka HP Spyder Chromebook), but I can't think of any reason it wouldn't work with other devices. The Chromebook Pixel 2 (2015), for example...as you'll notice, the guide this was forked from assumed that machine.

  1. Create a build environment
  2. Customize the kernel
  3. Build Chromium OS
  4. Flash Chromium OS to USB
  5. Install Chromium OS