Skip to content

Instantly share code, notes, and snippets.

View mengzhuo's full-sized avatar

Meng Zhuo mengzhuo

View GitHub Profile
@mengzhuo
mengzhuo / README.md
Last active July 16, 2022 01:55 — forked from djfdyuruiry/README.md
WSL 2 - Enabling systemd

Enable systemd in WSL 2

This guide will enable systemd to run as normal under WSL 2. This will enable services like microk8s, docker and many more to just work during a WSL session. Note: this was tested on Windows 10 Build 2004, running Ubuntu 20.04 LTS in WSL 2.

  • To enable systemd under WSL we require a tool called systemd-genie

  • Copy the contents of install-sg.sh to a new file /tmp/install-sg.sh:

    cd /tmp
@mengzhuo
mengzhuo / gist:424ba2d79afa1bcb5bbb57255587db2c
Created July 12, 2022 11:02
EKS node group create failed
Jul 12 07:35:45 ip-10-0-27-129.us-west-2.compute.internal kubelet[20691]: I0712 07:35:45.353944 20691 aws.go:1264] Get AWS region from metadata client
Jul 12 07:35:45 ip-10-0-27-129.us-west-2.compute.internal kubelet[20691]: I0712 07:35:45.354071 20691 aws.go:1309] Zone not specified in configuration file; querying AWS metadata service
Jul 12 07:35:45 ip-10-0-27-129.us-west-2.compute.internal kubelet[20691]: I0712 07:35:45.356846 20691 aws.go:1349] Building AWS cloudprovider
Jul 12 07:35:45 ip-10-0-27-129.us-west-2.compute.internal kubelet[20691]: E0712 07:35:45.670856 20691 server.go:294] "Failed to run kubelet" err="failed to run Kubelet: could not init cloud provider \"aws\": error finding instance i-xxxxxxxxxxxxxx: \"error listing AWS instances: \\\"RequestError: send request failed\\\\ncaused by: Post \\\\\\\"https://ec2.us-west-2.amazonaws.com/\\\\\\\": dial tcp: lookup ec2.us-west-2.amazonaws.com on 10.0.0.2:53: no such host\\\"\""
Jul 12 07:35:45 ip-10-0-27-129.us-west-2.compute.internal syste
Install required packages
sudo pkg install opensbi u-boot-qemu-riscv64 qemu
Note: emulators/qemu-devel also works.
Download FreeBSD/RISC-V virtual machine image
fetch https://download.freebsd.org/ftp/snapshots/VM-IMAGES/14.0-CURRENT/riscv64/Latest/FreeBSD-14.0-CURRENT-riscv-riscv64.raw.xz
xz --decompress FreeBSD-14.0-CURRENT-riscv-riscv64.raw.xz
Optionally, extend the image using truncate(1). The root filesystem will grow to fill the free space upon first boot.
<hudson.util.DescribableList>
<hudson.node__monitors.ArchitectureMonitor>
false
</hudson.node__monitors.ArchitectureMonitor>
<hudson.node__monitors.ClockMonitor>
false
</hudson.node__monitors.ClockMonitor>
<hudson.node__monitors.DiskSpaceMonitor>
false
1GB
@mengzhuo
mengzhuo / build.sh
Last active June 1, 2019 08:16 — forked from julianxhokaxhiu/build.sh
How to build minimal ARM QEMU Static from sources with EXECVE
#!/bin/bash
#
# IMPORTANT!
# At the moment this script is forged only for Debian ( tested on 8.x release ).
# Although my efforts were put on building this also on Arch Linux or Alpine, at the moment only Debian seems to be able to build it.
# Also, not sure why these instructions where nowhere on the internet, therefore I leave them here for whoever need them.
#
###########
# Add Backports repo support
package vadd
func addGeneric(dst, src []uint8) {
for i, s := range src {
dst[i] += s
}
}
func addVector(dst, src []uint8)
@mengzhuo
mengzhuo / decode-nostd-base64.go
Created May 19, 2018 09:33
decode nonstd base64
package main
import (
"encoding/base64"
"fmt"
)
var table = []byte{'v', 'w', 'x', 'r', 's', 't', 'u', 'o', 'p', 'q', '3', '4', '5', '6', '7', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'y', 'z', '0', '1',
'2', 'P', 'Q', 'R', 'S', 'T', 'K', 'L', 'M', 'N', 'O', 'Z', 'a', 'b', 'c', 'd', 'U', 'V', 'W', 'X', 'Y', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', '8', '9',
'+', '/'}
@mengzhuo
mengzhuo / md5sum.go
Created March 22, 2018 11:26
Simple parallel md5sum compatible to GNU md5sum
package main
// go build md5sum.go
// ./md5sum ~/*.log
// # or
// ./md5sum << EOF
import (
"crypto/md5"
"fmt"
@mengzhuo
mengzhuo / bench.log
Created December 20, 2017 08:17
ARM64 benchmark
│BenchmarkAmove-4 20000000 102 ns/op 1881.62 MB/s
│BenchmarkBmove-4 50000000 34.5 ns/op 5563.29 MB/s
@mengzhuo
mengzhuo / scw_bench.sh
Last active December 16, 2017 12:46
scw bench go source
#!/bin/bassh
set -e
apt-get update -y -qq
apt-get install build-essential git golang -y -qq
git clone https://go.googlesource.com/go godev --depth=50
GODEV=$HOME/godev
cd $GODEV/src