Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Darkness navono

I may be slow to respond.
Block or report user

Report or block navono

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
navono / reconn.go
Created Jul 23, 2019
websocket reconnect in golang
View reconn.go
package reconWS
import (
View convertion.js
function Uint8ArrayToString(fileData){
var dataString = "";
for (var i = 0; i < fileData.length; i++) {
dataString += String.fromCharCode(fileData[i]);
return dataString
navono / protobufjs
Created Jun 21, 2019
Load proto(with third party proto files) with protobufjs
View protobufjs
const root = new protobuf.Root();
root.resolvePath = function(origin, target) {
if (origin.length === 0) {
return target;
if (target.startsWith('are')) {
const protoPath = path.resolve(__dirname, '../', target)
console.log('path: ', protoPath);
navono / gracefulStop.go
Created Jun 18, 2019
Golang graceful stop
View gracefulStop.go
package main
import (
func main() {
navono /
Last active Jun 13, 2019
proto shell 编译脚本
#! /bin/bash
# Directory to write generated code to
navono / protoc.cmd
Last active Jun 20, 2019
使用 batch 编译 proto 文件
View protoc.cmd
REM 声明采用UTF-8编码
chcp 65001
echo "请先安装 Golang 和 protoc,然后安装 protoc 插件"
REM plugin binary path
set PROTOC_GEN_TS_PATH=%cd%\\bin\\node_modules\\.bin\\protoc-gen-ts.cmd
set PROTOC_GEN_GRPC_PATH=%cd%\\bin\\grpc_cpp_plugin.exe
set PROTOC_GEN_LINT_PATH=%cd%\\bin\\protoc-gen-lint.exe
navono /
Created Jun 12, 2019
add prefix string in list
MYLIST=(var1 var2 var3)
echo ${MYLIST[@]/#/my_}
# Output: my_var1 my_var2 my_var3
IGNORE_TABLES=(table1 table2 table3)
echo mysqldump ${IGNORE_TABLES[@]/#/--ignore-table=${DATABASE}.} ${DATABASE}
# Output: mysqldump --ignore-table=database1.table1 --ignore-table=database1.table2 --ignore-table=database1.table3 database1
navono /
Created Jun 11, 2019
extract file name related info
filename=$(basename "$fullfilename")
echo "Input File: $fullfilename"
echo "Filename without Path: $filename"
echo "Filename without Extension: $fname"
navono / Dockerfile
Created May 22, 2019
create image that compile proto files
View Dockerfile
FROM ubuntu:latest
RUN apt-get update && apt-get install -y \
automake \
build-essential \
git \
libtool \
make \
npm \
wget \
navono /
Created May 22, 2019
create cpp output with protoc
protoc -Iapi/proto/v1 -Ithird_party --grpc-cpp_out=cmd/client-rest-cpp/api/v1 --cpp_out=cmd/client-rest-cpp/api/v1 --plugin=protoc-gen-grpc-cpp="C:\\Program Files (x86)\\grpc\\bin\\grpc_cpp_plugin.exe" todo-service.proto
protoc -Ithird_party --plugin=protoc-gen-grpc-cpp="C:\\Program Files (x86)\\grpc\\bin\\grpc_cpp_plugin.exe" --cpp_out=cmd/client-rest-cpp/api/v1 third_party/google/api/annotations.proto
protoc -Ithird_party --plugin=protoc-gen-grpc-cpp="C:\\Program Files (x86)\\grpc\\bin\\grpc_cpp_plugin.exe" --cpp_out=cmd/client-rest-cpp/api/v1 third_party/google/api/http.proto
protoc -Ithird_party --plugin=protoc-gen-grpc-cpp="C:\\Program Files (x86)\\grpc\\bin\\grpc_cpp_plugin.exe" --cpp_out=cmd/client-rest-cpp/api/v1 third_party/protoc-gen-swagger/options/annotations.proto
protoc -Ithird_party --plugin=protoc-gen-grpc-cpp="C:\\Program Files (x86)\\grpc\\bin\\grpc_cpp_plugin.exe" --cpp_out=cmd/client-rest-cpp/api/v1 third_party/protoc-gen-swagger/options/openapiv2.proto
You can’t perform that action at this time.