Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

陈杨文 wenerme

🎯
Focusing
View GitHub Profile
@wenerme
wenerme / k3s-new-cert.sh
Created Jul 12, 2020
K3S Create Client Cert
View k3s-new-cert.sh
#!/bin/bash
set -e
fail(){
echo "error: $*"
echo "usage: ./k3s-new-cert <name> [subject=/O=admin]"
exit 1
}
@wenerme
wenerme / icmp_ping.py
Created Dec 4, 2019 — forked from ageis/icmp_ping.py
Ansible ICMP ping module
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
@wenerme
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
#!/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
@wenerme
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
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)}">
${v.stargazers_count}
</span>
🕐${new Date(v.updated_at).toISOString().replace(/\..*/,'').replace('T',' ')}
]`
a.innerHTML = a.innerHTML.replace(/(\[(.|\s)*?\])?$/,tpl)
@wenerme
wenerme / CommitLogReader.java
Last active Jan 21, 2016
RocketMQ commit log reader
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;
You can’t perform that action at this time.