Skip to content

Instantly share code, notes, and snippets.

View tangnotes's full-sized avatar

James Tang tangnotes

View GitHub Profile
@tangnotes
tangnotes / vimlocal
Created October 25, 2017 20:34
Vim Local
; .vimlocal
set tabstop=2
set shiftwidth=2
@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 / 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 / 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 / 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 / markdown-samples.md
Created May 26, 2017 15:48
Markdown samples, generally used for editor & markdown convertor testing.

Title (H1)

Title (H2)

List

  • option 1
  • option 2
@tangnotes
tangnotes / lets-encrypt-certbot.log
Created May 8, 2017 22:08
Let's Encrypt Certbot log
certbot certonly --webroot -w /usr/local/nginx/html -d example.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for notes.fwso.cn
Using the webroot path /usr/local/nginx/html for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Generating key (2048 bits): /etc/letsencrypt/keys/0000_key-certbot.pem
@tangnotes
tangnotes / gist:1b80213eecd6fd76adc241cdcd8d5e7b
Created April 7, 2017 15:18
vim compilation on Mac OSx
./configure --prefix=/usr/local --mandir=/usr/local/Cellar/vim/8.0.0543/share/man --enable-multibyte --with-tlib=ncurses --enable-cscope --with-compiledby --with-lua-prefix=/usr/local/Cellar/lua/5.2.4_4 --enable-luainterp=yes
@tangnotes
tangnotes / bytes-reader.go
Created November 29, 2016 02:30
Go Reader example
//https://play.golang.org/p/d2ILCDInTy
package main
import (
"bytes"
"fmt"
"io"
)
@tangnotes
tangnotes / smtp-auth-tcp-example.go
Created July 26, 2016 02:30
TCP Example of SMTP Authentication
// reference: https://tools.ietf.org/html/rfc5321
package main
import (
"bufio"
"encoding/base64"
"fmt"
"log"
"net"
"os"