Skip to content

Instantly share code, notes, and snippets.

View bopjiang's full-sized avatar
🌴
On vacation

Peter Jiang bopjiang

🌴
On vacation
View GitHub Profile
@bopjiang
bopjiang / pythonlib.py
Last active November 27, 2023 03:02
python_lib
def write_list_to_file(filename, my_list):
with open(filename, 'w') as file:
file.writelines(str(item) + '\n' for item in my_list)
import os
directory = "/home/XX/Documents/blog-new/content/posts"
os.chdir(directory)
def do(filename):
r = open(filename, 'r')
lines = r.readlines()
r.close()
w = open(filename, 'w')
i = 0
package main
import (
"strings"
"fmt"
"github.com/pingcap/parser/ast"
"github.com/pingcap/parser"
_ "github.com/pingcap/tidb/types/parser_driver" // https://github.com/pingcap/parser/issues/43
)
#!/bin/bash
## exit when any error
## set -e
TIDB_CONTAINER_NAME=tidb-docker-compose_tidb_1
GOOS=linux GOARCH=amd64 make server || { printf "\e[31m!!! build failed !!!\e[0m\n"; exit 1; }
printf "\e[38;5;82mTiDB version before:\n\e[0m"
@bopjiang
bopjiang / docker-compose.yaml
Last active January 6, 2017 09:35
NSQD docker file
version: '2'
services:
nsqlookupd:
image: nsqio/nsq:v0.3.8
command: /nsqlookupd
restart: always
ports:
- "4160:4160"
- "4161:4161"
volumes:
@bopjiang
bopjiang / set_irq_affinity.sh
Created January 14, 2015 04:12
set irq affinity
# from https://code.google.com/p/ntzc/source/browse/trunk/zc/ixgbe/set_irq_affinity.sh
#
#
# setting up irq affinity according to /proc/interrupts
# 2008-11-25 Robert Olsson
# 2009-02-19 updated by Jesse Brandeburg
#
# > Dave Miller:
# (To get consistent naming in /proc/interrups)
# I would suggest that people use something like:
@bopjiang
bopjiang / cscope-go.sh
Created April 21, 2014 15:47
create cscope index for go project
#!/bin/bash
# generate cscope index files in current directory
# the generated cscope index files also include go standard packages
if [ $GOROOT = "" ]
then
echo "GOROOT is not set"
exit 1
fi