Skip to content

Instantly share code, notes, and snippets.

View tangnotes's full-sized avatar

James Tang tangnotes

View GitHub Profile
@tangnotes
tangnotes / openssl-rsa-x509-demo.sh
Last active July 4, 2016 03:03
X509, RSA Demo with OpenSSL
# parse X509 Certificate
openssl x509 -in fwso_cn.crt -noout -text
# extract pubkey from X509 certificate
openssl x509 -in fwso_cn.crt -noout -pubkey
# extract pubkey from RSA private key
openssl rsa -in ~/.ssh/id_rsa -pubout -out id_rsa.pub
# sign data with private key
@tangnotes
tangnotes / cassandra-exception.log
Created July 6, 2016 02:11
Cassandra exception: AssertionError
INFO [CompactionExecutor:3] 2016-07-06 10:02:38,636 CompactionTask.java:141 - Compacting [SSTableReader(path='/data0/cassandra/data/system/schema_columnfamilies-45f5b36024bc3f83a3631034ea4fa697/system-schema_columnfamilies-ka-32-Data.db'), SSTableReader(path='/data0/cassandra/data/system/schema_columnfamilies-45f5b36024bc3f83a3631034ea4fa697/system-schema_columnfamilies-ka-31-Data.db'), SSTableReader(path='/data0/cassandra/data/system/schema_columnfamilies-45f5b36024bc3f83a3631034ea4fa697/system-schema_columnfamilies-ka-29-Data.db'), SSTableReader(path='/data0/cassandra/data/system/schema_columnfamilies-45f5b36024bc3f83a3631034ea4fa697/system-schema_columnfamilies-ka-30-Data.db')]
INFO [CompactionExecutor:5] 2016-07-06 10:02:38,637 CompactionTask.java:141 - Compacting [SSTableReader(path='/data0/cassandra/data/system/schema_columns-296e9c049bec3085827dc17d3df2122a/system-schema_columns-ka-31-Data.db'), SSTableReader(path='/data0/cassandra/data/system/schema_columns-296e9c049bec3085827dc17d3df2122a/system-sc
@tangnotes
tangnotes / golang-x-tools-net.sh
Last active July 6, 2016 07:42
Get gloang.org/x/tools, golang/x/net... from Github
GOX=src/golang.org/x
mkdir -p $GOX
cd $GOX
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/net.git
git clone https://github.com/golang/oauth2.git
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/image.git
git clone https://github.com/golang/text.git
@tangnotes
tangnotes / DataTimeExample.java
Last active July 19, 2016 14:37
Date Time Example in Java
import java.util.Date;
import java.util.Locale;
import java.util.Calendar;
import java.util.TimeZone;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
public class DateTime {
public static void main(String[] args) {
String ts = "1468857599";
@tangnotes
tangnotes / run-hadoop-jar.sh
Last active July 22, 2016 02:46
Run Hadoop MapReduce Job
#!/bin/bash
function _echo() {
echo "`date +'%F %T'` - $1"
}
if [ $# -lt 1 ]
then
echo "Usage: $0 YYYY-MM-DD [HH]"
exit 1
@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"
@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 / 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 / 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 / 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