Skip to content

Instantly share code, notes, and snippets.

View Chen-tao's full-sized avatar

Chen-tao Chen-tao

  • ByteDance
  • Beijing China
View GitHub Profile
@Chen-tao
Chen-tao / pregit.sh
Created February 23, 2021 03:52
little alias with colorful msg in pull op.
#!/usr/bin/env bash
# define echo terminal style
# color: 0~6 --> black, red, green, yellow, blue, purple, cyan, grey
export COLOR_END=" \033[0m" # default style(black background, white foreground)
export YELLOW="\033[33m " # yellow
export LIGHTBLUE="\033[36m " # light bule
# echo -e "${YELLOW}echo command terminal style example${COLOR_END}"
echo -e "${YELLOW} git checkout master; git pull --rebase ${COLOR_END}"
@Chen-tao
Chen-tao / go-rpc-bm-client.go
Created April 12, 2018 12:00 — forked from skoowoo/go-rpc-bm-client.go
go rpc benchmark
package main
import (
"flag"
"fmt"
"log"
"net/rpc"
"sync"
"time"
)
@Chen-tao
Chen-tao / .gitignore
Created September 24, 2017 06:00 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@Chen-tao
Chen-tao / README.md
Created September 14, 2017 10:19 — forked from janlay/README.md
Yet another config for Surge.app

Install

  1. Modify index.txt with your output path and proxy info
  2. Use Text Builder to build configuration for Surge: $ text-builder -index /path/to/index.txt Or run $ sh build-all to build all your index files.
  3. Import configuration via AirDrop/iTunes/Dropbox/iCloud

本人不提供任何保证和技术支持,使用者自负风险。
There are no guarantees, no any support. Use it at your own risk.

@Chen-tao
Chen-tao / worker_original.go
Created September 11, 2017 12:14
Golang Workers / Job Queue
// Original code with Dispatcher
package main
import (
_ "expvar"
"flag"
"fmt"
"net/http"
_ "net/http/pprof"
"os"
#!/bin/sh
#
#该脚本为Linux下启动java程序的通用脚本。即可以作为开机自启动service脚本被调用,
#也可以作为启动java程序的独立脚本来使用。
#
#警告!!!:该脚本stop部分使用系统kill命令来强制终止指定的java程序进程。
#在杀死进程前,未作任何条件检查。在某些情况下,如程序正在进行文件或数据库写操作,
#可能会造成数据丢失或数据不完整。如果必须要考虑到这类情况,则需要改写此脚本,
#增加在执行kill命令前的一系列检查。
#

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

@Chen-tao
Chen-tao / GoT-screentimes--s06.json
Created July 16, 2017 16:28 — forked from aendra-rininsland/GoT-screentimes--s06.json
Game Of Thrones total screentimes (Up to and including Season 6)
[
{
"name": "Tyrion Lannister",
"imdbUrl": "http://www.imdb.com/character/ch0146096/",
"screentime": 293.3,
"episodes": 54,
"portrayedBy": {
"name": "Peter Dinklage",
"imdbUrl": "http://www.imdb.com/name/nm0227759/"
}
var shortHostName = ''
func getShortHostname() string {
if shortHostName == "" {
host, _ := os.Hostname()
if index := strings.Index(host, "."); index > 0 {
shortHostName = host[:index]
} else {
shortHostName = host
}
@Chen-tao
Chen-tao / dproxy.go
Created June 13, 2017 02:39
handle json without struct and like X-Path found for params
package main
import (
"encoding/json"
"fmt"
"github.com/koron/go-dproxy"
)
func main() {
var v interface{}