Skip to content

Instantly share code, notes, and snippets.

View bingoohuang's full-sized avatar
🎯
Focusing

bingoohuang bingoohuang

🎯
Focusing
View GitHub Profile
@bingoohuang
bingoohuang / demo.yaml
Last active January 6, 2021 13:20
监控大屏接口数据
---
app: # 当日实时数据 应用
count: 188 # 数量
normal: 30 # 正常
abnormal: 0 # 异常
device: # 服务器数量
count: 188
normal: 30
abnormal: 1
probe: # 探针
@bingoohuang
bingoohuang / dynamicticker.go
Last active July 18, 2020 06:15
DynamicTicker
package main
import (
"fmt"
"log"
"math/rand"
"time"
)
const Format = "2006-01-02 15:04:05.000"
@bingoohuang
bingoohuang / cloudSettings
Last active July 6, 2020 07:17
vscode settings
{"lastUpload":"2020-07-06T07:17:07.740Z","extensionVersion":"v3.4.3"}
@bingoohuang
bingoohuang / golangcopylistbench.go
Last active May 10, 2019 06:03
compare two style of copy golang slice performance
package gotrial
import (
"strings"
"testing"
)
func copyListV1(in []string) []string {
var out []string
@bingoohuang
bingoohuang / reflect_translate.go
Created April 24, 2019 05:13 — forked from hvoecking/translate.go
Golang reflection: traversing arbitrary structures
// Traverses an arbitrary struct and translates all stings it encounters
//
// I haven't seen an example for reflection traversing an arbitrary struct, so
// I want to share this with you. If you encounter any bugs or want to see
// another example please comment.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Heye Vöcking
//
@bingoohuang
bingoohuang / RandomImage.java
Created January 11, 2019 07:18
create random image
package imagexx;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class RandomImage {
public static void main(String args[]) {
@bingoohuang
bingoohuang / aes.c
Created December 18, 2018 09:32
clang AES/CBC/PKCS5Padding benchmark test code
/*
This is an implementation of the AES algorithm, specifically ECB, CTR and CBC mode.
Block size can be chosen in aes.h - available choices are AES128, AES192, AES256.
The implementation is verified against the test vectors in:
National Institute of Standards and Technology Special Publication 800-38A 2001 ED
ECB-AES128
----------
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
@bingoohuang
bingoohuang / rmtargets.sh
Created July 26, 2018 01:23
Remove all target directories for all maven projects located in current directory.
find . -type d -name "target" -maxdepth 2 | xargs rm -rf
@bingoohuang
bingoohuang / ps.sh
Created June 27, 2018 15:39
ps output lstart in ISO format like YYYY-MM-DD HH:MM:SS
# from: https://unix.stackexchange.com/questions/401785/ps-output-with-iso-date-format
ps -eo lstart,pid,cmd --sort=start_time|sed '1d' | awk '{c="date -d\""$1 FS $2 FS $3 FS $4 FS $5"\" +\047%Y-%m-%dT%H:%M:%S\047"; c|getline d; close(c); $1=$2=$3=$4=$5=""; printf "%s\n",d$0 }'
#2018-04-23T15:38:18 1 /sbin/init
#2018-04-23T15:38:18 2 [kthreadd]
#2018-04-23T15:38:18 3 [migration/0]
#2018-04-23T15:38:18 4 [ksoftirqd/0]
#2018-04-23T15:38:18 5 [stopper/0]
#2018-04-23T15:38:18 6 [watchdog/0]