Skip to content

Instantly share code, notes, and snippets.

Avatar

Meng Zhuo mengzhuo

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

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
View gist:424ba2d79afa1bcb5bbb57255587db2c
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
View gist:6ae7d7a727c271c076f2f72afe5772b1
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.
View ff.xml
<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 Jun 1, 2019 — forked from julianxhokaxhiu/build.sh
How to build minimal ARM QEMU Static from sources with EXECVE
View build.sh
#!/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
View vadd.go
package vadd
func addGeneric(dst, src []uint8) {
for i, s := range src {
dst[i] += s
}
}
func addVector(dst, src []uint8)
View decode-nostd-base64.go
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 Mar 22, 2018
Simple parallel md5sum compatible to GNU md5sum
View md5sum.go
package main
// go build md5sum.go
// ./md5sum ~/*.log
// # or
// ./md5sum << EOF
import (
"crypto/md5"
"fmt"
@mengzhuo
mengzhuo / bench.log
Created Dec 20, 2017
ARM64 benchmark
View bench.log
│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 Dec 16, 2017
scw bench go source
View scw_bench.sh
#!/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