Skip to content

Instantly share code, notes, and snippets.

View lhlyu's full-sized avatar
:octocat:
sudo rm -rf /*

谕℃ lhlyu

:octocat:
sudo rm -rf /*
  • Gakuen Toshi
  • Akari, China
  • 14:10 (UTC +08:00)
View GitHub Profile
@lhlyu
lhlyu / webchat_qrcode.go
Created February 26, 2020 03:05
微信生成二维码并上传至自己的服务器
// 生成二维码
// 参考文档: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.createQRCode.html
const (
// 自己服务器上传图片的请求地址
upload_url = "http://localhost:8080/upload"
)
const (
// 获取token
@lhlyu
lhlyu / demo.go
Last active April 29, 2021 11:23
优雅的并发请求
func Wrap(val *string,name string,timeout time.Duration) func() {
return func() {
time.Sleep(timeout)
*val = name
}
}
func main() {
for i := 97; i < 123; i++ {
go func(i int) {
@lhlyu
lhlyu / redis.md
Created July 1, 2021 07:25
redis通配符清理key

redis-cli -n 1 keys "keyword*" | xargs redis-cli -n 1 del

@lhlyu
lhlyu / client.js
Last active February 2, 2023 08:21
微信小程序云开发 grpc simple & stream
// protoc ./*.proto --js_out=import_style=commonjs:./ --grpc-web_out=import_style=typescript,mode=grpcweb:./
var pb = require('./grpc_pb');
var svc = require('./grpc_grpc_pb');
var grpc = require('@grpc/grpc-js');
// 证书
const tls = `-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----`
@lhlyu
lhlyu / kubeLog.sh
Last active December 16, 2021 11:16
本地查看容器日志
#!/bin/bash
ctx=$(kubectl config current-context)
namespace=$(kubectl config view --minify --output 'jsonpath={..namespace}'; echo)
echo $ctx $namespace
while true
@lhlyu
lhlyu / git_log_format.sh
Created October 20, 2021 09:03
git提交日志格式化
git log --pretty=format:'√ %s %C(bold blue)<%an>%Creset %cr' --abbrev-commit --date=relative --no-merges -5
@lhlyu
lhlyu / concurrent_order.go
Last active February 5, 2022 02:58
并发顺序
package main
import (
"fmt"
"log"
"strconv"
"sync"
"time"
)
@lhlyu
lhlyu / heatmap.js
Created February 25, 2022 05:50
echarts热力图根据正负数展示不同的样式
// 横坐标
var x_axis = ['', '', '', '', '', '', '', ''];
// 纵坐标
var y_axis = [
'8.华夏兴华H',
'7.华夏兴华A',
'6.华夏稳盛',
'5.华夏翔阳LOF',
'4.华夏成长',
'3.华夏回报2号',
@lhlyu
lhlyu / main.go
Created March 22, 2022 07:21
Go绘制马赛克图片
package main
import (
"image"
)
func main() {
// 需要被马赛克的图片
var img image.Image
// 宽
@lhlyu
lhlyu / pprof.md
Created March 25, 2022 10:33
go查找内存泄漏
  • 开启监听
package main

import (
    "net/http"
    _ "net/http/pprof"
)