View boot-alpine-in-firecracker.sh
# download | |
latest=$(basename $(curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/firecracker-microvm/firecracker/releases/latest)) | |
curl -LOJ https://github.com/firecracker-microvm/firecracker/releases/download/${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 |
View alpine-netboot-missing-ext4-verify.sh
# download firecracker | |
latest=$(basename $(curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/firecracker-microvm/firecracker/releases/latest)) | |
curl -LOJ https://github.com/firecracker-microvm/firecracker/releases/download/${latest}/firecracker-${latest}-$(uname -m) | |
mv firecracker-${latest}-$(uname -m) firecracker | |
chmod +x firecracker | |
# download netbook kernel and initrd | |
curl --remote-name-all -LC- https://mirrors.aliyun.com/alpine/v3.12/releases/x86_64/netboot/{modloop,vmlinuz,config,initramfs}-virt | |
# vmlinux |
View k3s-new-cert.sh
#!/bin/bash | |
set -e | |
fail(){ | |
echo "error: $*" | |
echo "usage: ./k3s-new-cert <name> [subject=/O=admin]" | |
exit 1 | |
} | |
View icmp_ping.py
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# (c) 2019, Ansible by Red Hat, inc | |
# (c) 2019 Kevin Gallagher (@ageis) <kevingallagher@gmail.com> | |
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | |
# from https://gist.github.com/ageis/face10be67b26e4519662e19290e06ff | |
# fix for busybox and macos |
View pre-commit-eslint
#!/bin/sh | |
# List files | |
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$") | |
if [[ "$STAGED_FILES" = "" ]]; then | |
exit 0 | |
fi | |
# Try find node |
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 |
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)}"> | |
★${v.stargazers_count} | |
</span> | |
🕐${new Date(v.updated_at).toISOString().replace(/\..*/,'').replace('T',' ')} | |
]` | |
a.innerHTML = a.innerHTML.replace(/(\[(.|\s)*?\])?$/,tpl) |
View CommitLogReader.java
import java.io.File; | |
import java.io.IOException; | |
import java.net.InetSocketAddress; | |
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; |
View BenchGRPCOOME.java
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; |
View TextBubbleBorderDemo.java
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; |