Skip to content

Instantly share code, notes, and snippets.

View tangnotes's full-sized avatar

James Tang tangnotes

View GitHub Profile
@tangnotes
tangnotes / json-sample.json
Created May 26, 2017 15:51
JSON sample used for testing editor functions.
{
"name": "James Tang", "age": 18,
"comment": [
{
"content": "Very young"
},
{"content": "Excellent"
}
]
}
@tangnotes
tangnotes / ubuntu-essential-pkgs.sh
Last active June 13, 2017 11:17
Essential packages for Ubuntu(git, vim, lua, etc.)
#!/bin/bash
sudo apt install git curl wget python2.7-dev lua5.3 liblua5.3 liblua5.3-dev libncurses5 libncurses5-dev ncurses-base ncurses-bin ncurses-term
git clone https://github.com/vim/vim.git
cd vim
./configure --prefix=/usr --with-features=huge --enable-gui=no --without-x --enable-luainterp --enable-pythoninterp --enable-perlinterp
make VIMRUNTIMEDIR=/usr/share/vim/vim80
@tangnotes
tangnotes / ssh-port-forwarding.sh
Last active July 4, 2017 16:21
SSH Port Forwarding
#!/bin/bash
HOSTNAME=YOUR_HOST_NAME
USERNAME=YOUR_USER_NAME
if [ $# -lt 1 ]
then
echo "Usage: $0 PORT [TARGET_PORT]"
exit 1
fi
@tangnotes
tangnotes / all_child_pids.sh
Last active September 5, 2017 15:20
Get all child PIDs recursively
#!/bin/bash
ppids=$1
if [ "x$ppids" == "x" ]
then
echo "Usage: $0 PPID"
exit 1
fi
@tangnotes
tangnotes / vimlocal
Created October 25, 2017 20:34
Vim Local
; .vimlocal
set tabstop=2
set shiftwidth=2
@tangnotes
tangnotes / demo-upstream-nginx.conf
Created January 6, 2018 11:03
UVE Core deploy log
server {
listen 80;
server_name upstream.test.uve.io;
default_type 'application/json';
location / {
content_by_lua_block {
ngx.say('{"data":[{"uid":"123456","name":"James"}],"__tmeta":{"mkey1":"mval1","mkey2":"mval2"}}')
}
}
}
@tangnotes
tangnotes / _bash_profile
Last active July 5, 2018 15:00
Mac Bash Profile
export TANGO_ENV=personal_laptop
export PS1="[\033[32m\d \t\033[0m] \h: \033[36m\w\033[0m $\n> "
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
export PATH=/usr/local/bin:$PATH
@tangnotes
tangnotes / iterm2-default-config-2.json
Last active April 24, 2018 14:28
iTerm2 Configuration
{
"Ansi 6 Color" : {
"Green Component" : "0.5960785",
"Blue Component" : "0.6039215999999999",
"Red Component" : "0.02352941"
},
"Tags" : [
],
"Ansi 12 Color" : {
@tangnotes
tangnotes / nginx.service
Created July 12, 2018 10:06
Nginx Systemd: /lib/systemd/system/nginx.service
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
@tangnotes
tangnotes / pngpaste.sh
Created July 18, 2018 09:46
pngpage for Ubuntu
#!/bin/bash
file=$1
if [ "x$file" == "x" ]
then
echo "Usage: $0 FILE_NAME"
exit 1
fi