Skip to content

Instantly share code, notes, and snippets.


陈杨文 wenerme

View GitHub Profile
wenerme /
Last active Oct 22, 2020
AlpineLinux Firecracker
# download
latest=$(basename $(curl -fsSLI -o /dev/null -w %{url_effective}
curl -LOJ${latest}/firecracker-${latest}-$(uname -m)
mv firecracker-${latest}-$(uname -m) firecracker
chmod +x firecracker
# rootfs
# =========
# qemu-img create -f raw alpine.rootfs.ext4 1G
fallocate -l 1G ubuntu.rootfs.ext4
wenerme /
Last active Oct 22, 2020
AlpineLinux netboot initrd missing ext4 module
# download firecracker
latest=$(basename $(curl -fsSLI -o /dev/null -w %{url_effective}
curl -LOJ${latest}/firecracker-${latest}-$(uname -m)
mv firecracker-${latest}-$(uname -m) firecracker
chmod +x firecracker
# download netbook kernel and initrd
curl --remote-name-all -LC-{modloop,vmlinuz,config,initramfs}-virt
# vmlinux
wenerme /
Created Jul 12, 2020
K3S Create Client Cert
set -e
echo "error: $*"
echo "usage: ./k3s-new-cert <name> [subject=/O=admin]"
exit 1
wenerme /
Created Dec 4, 2019 — forked from ageis/
Ansible ICMP ping module
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2019, Ansible by Red Hat, inc
# (c) 2019 Kevin Gallagher (@ageis) <>
# GNU General Public License v3.0+ (see COPYING or
# from
# fix for busybox and macos
wenerme / pre-commit-eslint
Last active Jan 24, 2019 — forked from linhmtran168/pre-commit-eslint
Pre-commit hook to check for Javascript using ESLint
View pre-commit-eslint
# List files
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
# Try find node
wenerme / hardware-summary
Created Jan 3, 2017
Ubuntu 16.04.1 install failed
View hardware-summary
uname -a: Linux wener-ubuntu 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 GNU/Linux
lspci -knn: 00:00.0 Host bridge [0600]: Intel Corporation 440FX - 82441FX PMC [Natoma] [8086:1237] (rev 02)
lspci -knn: 00:01.0 ISA bridge [0601]: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] [8086:7000]
lspci -knn: 00:01.1 IDE interface [0101]: Intel Corporation 82371AB/EB/MB PIIX4 IDE [8086:7111] (rev 01)
lspci -knn: Kernel driver in use: ata_piix
lspci -knn: 00:02.0 VGA compatible controller [0300]: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter [80ee:beef]
lspci -knn: 00:03.0 Ethernet controller [0200]: Intel Corporation 82540EM Gigabit Ethernet Controller [8086:100e] (rev 02)
lspci -knn: Subsystem: Intel Corporation Device [8086:001e]
lspci -knn: Kernel driver in use: e1000
lspci -knn: Kernel modules: e1000
wenerme / show-stars.js
Last active Jul 28, 2016
Show stars and push time in github repo links.
View show-stars.js
var AccessToken='YOUR-ACCESS-TOKEN-HERE' // <= Notice
var replaceText = a => {
let v = a.repoData
let tpl = `[
<span style="color:red;opacity:${Math.max(v.stargazers_count/500,0.1)}">
🕐${new Date(v.updated_at).toISOString().replace(/\..*/,'').replace('T',' ')}
a.innerHTML = a.innerHTML.replace(/(\[(.|\s)*?\])?$/,tpl)
wenerme /
Last active Jan 21, 2016
RocketMQ commit log reader
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.Server;
import io.grpc.ServerBuilder;
import io.grpc.stub.StreamObserver;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.BenchmarkParams;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.infra.IterationParams;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.DisplayMode;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
import java.awt.Insets;
import java.awt.Polygon;
import java.awt.Rectangle;