Skip to content

Instantly share code, notes, and snippets.

View g10guang's full-sized avatar
🤑
Running On My Way

Liu XiGuang g10guang

🤑
Running On My Way
View GitHub Profile
@g10guang
g10guang / .ideavimrc
Last active March 26, 2022 09:59
.ideavimrc
set incsearch
set hls
set smartcase
set ignorecase
set visualbell
set noerrorbells
set easymotion
@g10guang
g10guang / cmd.md
Last active May 28, 2021 02:19
unix useful command

delete file exclude pattern:

find . ! -name '*.apk*' -delete

extract apk file

unzip xxxx.apk -d ${target_dir}
@g10guang
g10guang / go_mmap_example.go
Created July 10, 2020 13:50
go mmap example
package main
import (
"fmt"
"io/ioutil"
"os"
"syscall"
"unsafe"
)
@g10guang
g10guang / main.go
Last active April 10, 2020 15:38 — forked from manishtpatel/main.go
GoLang Encrypt string to base64 and vice versa using AES encryption.
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)
@g10guang
g10guang / go_update_package.md
Created February 4, 2020 06:32
go update package

govendor

govendor fetch github.com/nsqio/go-nsq/...

go mod

go get github.com/nsqio/go-nsq@v1.0.7
@g10guang
g10guang / socket_fork.py
Last active February 1, 2020 10:20
python code create socket reuseaddr with subprocess and reuseaddr + reuseport
import os
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
print('create socket')
s.bind(('0.0.0.0', 19823))
@g10guang
g10guang / useful_git_cmd.md
Created January 24, 2020 09:23
useful git command

Remove untrace file.

git clean -fd
@g10guang
g10guang / remove_html_tag.go
Created January 18, 2020 12:33
golang remove html tag from string
package utils
import (
"regexp"
"sort"
"strings"
)
// match html tag and replace it with ""
func RemoveHtmlTag(in string) string {
@g10guang
g10guang / install-mongo-shell.sh
Last active January 7, 2020 04:47
install mongo-shell
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt update
sudo apt install -y --allow-unauthenticated mongodb-org-shell
@g10guang
g10guang / .mongorc.js
Created December 30, 2019 11:48
my mongo shell
// pretty print for find()
DBQuery.prototype._prettyShell = true