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 / config_linux.md
Last active March 20, 2022 03:21
config my new linux

ssh

config github/gitlab ssh key

ssh-keygen

ssh login with public key

@g10guang
g10guang / .ideavimrc
Created October 30, 2019 02:56
JetBrains .ideavimrc
set incsearch
set hls
set smartcase
set ignorecase
@g10guang
g10guang / choose_app.md
Last active October 1, 2019 15:11
符号的伟大

符号的伟大

连接目标和美好事物,喂养用户强大的大脑。

国庆回家发现家人连接着wifi,在刷今日头条、抖音,百度一下知识点,这一场景引发了我的一些思考,以下做个简单的分享:

  1. 品牌传递给用户的价值是非常重要的
  2. 将产品和美好事物或代名词做绑定有助于用户做选择
  3. 长期博弈下,真正优秀的产品才能留住用户

来几个口号:

@g10guang
g10guang / .tmux.conf
Last active January 8, 2020 09:29
My tmux conf
# cat << EOF > /dev/null
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
# /!\ do not edit this file
# instead, override settings in ~/.tmux.conf.local, see README.md
# -- general -------------------------------------------------------------------
@g10guang
g10guang / typo.py
Last active September 24, 2019 11:50
Correct typo according to http://norvig.com/spell-correct.html
#%%
letter = 'abcdefghijklmnopqrstuvwxyz'
import requests, re, collections
# fetch the big.txt to calculate every words probability.
big_text = requests.get("http://norvig.com/big.txt").text
#use regex to match all words and then count their frequency
statistic = collections.Counter(re.findall("\w+", big_text))
@g10guang
g10guang / derivce.cpp
Created September 23, 2019 12:19
Cpp virtual function testcase
#include <iostream>
using namespace std;
class Base1 {
public:
virtual void f() { cout << "Base1:f" << endl;}
virtual void g() { cout << "Base1::g" << endl;}
};
@g10guang
g10guang / vm.py
Created September 16, 2019 05:31
A stupid virtual machine.
import enum
class Instruction(enum.Enum):
HLT = 0
ADD = 1
POP = 2
PSH = 3
SET = 4
Get = 5
JMP = 6
@g10guang
g10guang / Google protobuf installation on Mac.md
Last active August 13, 2019 08:01 — forked from rajkrrsingh/Google protobuf installation on Mac
Steps to Install google protobuf on Mac
wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.bz2
tar xvf protobuf-2.5.0.tar.bz2
cd protobuf-2.5.0
./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi"
make -j 4 
sudo make install
protoc --version
@g10guang
g10guang / upsource.sh
Last active April 11, 2021 13:38
sync local code to remote server
set -ex
prepath=`dirname $PWD`
# make sure both mac & devbox satisfy, $GOPATH=$HOME/go
myhome="${HOME}/"
prepath=${prepath:${#myhome}}
# set your own devbox username, mine is liuxiguang
devboxusername="liuxiguang"
sshpass -p ${devboxusername} rsync -avr --delete --exclude=test.go --exclude=.idea --exclude=.vscode --exclude=output ${PWD} dev:/home/${devboxusername}/$prepath
echo $(date -u +"%Y-%m-%d %H:%M:%S%Z")

show diff between edit file and disk file

:w !diff % -