Skip to content

Instantly share code, notes, and snippets.

View mingming-cn's full-sized avatar
🌏

mingming-cn

🌏
View GitHub Profile
@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-----`
@Godsing
Godsing / .tmux.conf
Created May 19, 2021 08:27
Tmux 配置文件(保姆级注释,含部分插件)
# 1. 安装tpm: mkdir -p ~/.tmux/plugins && cd ~/.tmux/plugins && git clone https://github.com/tmux-plugins/tpm
# 2. 按 prefix + I(大写) 来安装插件
# 3. 安装 vim-obsession, 用 vundle 安装或: cd ~/.vim/bundle && git clone git://github.com/tpope/vim-obsession.git --depth 1 && vim -u NONE -c "helptags vim-obsession/doc" -c q
##### 以上需手工执行 #####
## 修改 tmux-prefix 键: ctrl+b --> ctrl+a
set -g prefix C-a
unbind C-b
bind a send-prefix
#set-option -g prefix2 `
@ggzeng
ggzeng / golang_prometheus_metric_counter.go
Last active December 10, 2024 11:37
prometheus golang 客户端中的各类metric写法
//step1:初始一个counter, with help string
pushCounter = prometheus.NewCounter(prometheus.CounterOpts{
Name: "repository_pushes",
Help: "Number of pushes to external repository.",
})
//setp2: 注册容器
err = prometheus.Register(pushCounter)
if err != nil {
fmt.Println("Push counter couldn't be registered AGAIN, no counting will happen:", err)
package com.satya.arcoresample
import android.content.Context
import android.hardware.Sensor
import android.hardware.SensorEvent
import android.hardware.SensorEventListener
import android.hardware.SensorManager
import android.location.Location
import android.os.Build
import android.os.Bundle
@huyinghuan
huyinghuan / encrypt_file_pkcs5_pkcs7.go
Created May 31, 2017 07:44
golang encrypt with pkcs5 and pkcs7
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"errors"
"io"
"io/ioutil"
@antifuchs
antifuchs / iterm2_zsh_init.zsh
Last active July 19, 2024 07:47
tmux-enabled iterm2 shell integration for zsh.
if [[ -o login ]]; then
TMUX_PREFIX=""
if [[ ! -z "$TMUX" ]] ; then
# Via
# <http://blog.yjl.im/2014/12/passing-escape-codes-for-changing-font.html>:
TMUX_PREFIX='\ePtmux;\e'
TMUX_POSTFIX='\e\\'
fi
# Indicates start of command output. Runs just before command executes.
@jemygraw
jemygraw / golang_rsa_oaep.go
Created November 13, 2014 02:24
Golang RSA-OAEP Encrypt&Decrypt
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
"crypto/x509"
"encoding/base64"
"encoding/pem"
"fmt"