Skip to content

Instantly share code, notes, and snippets.

View nghiaht's full-sized avatar

Huỳnh Trọng Nghĩa nghiaht

View GitHub Profile
@nghiaht
nghiaht / generate_rsa_keypair.sh
Created September 13, 2018 03:30
Generate RSA keypair (public, private + pkcs8) using openssl command
# Private key
openssl genpkey -algorithm RSA -out private.pem -pkeyopt rsa_keygen_bits:2048
# Public key
openssl rsa -pubout -in private.pem -out public_key.pem
# Private key in pkcs8 format (for Java maybe :D)
openssl pkcs8 -topk8 -in private.pem -out private_key.pem
## nocrypt (Private key does have no password)
@nghiaht
nghiaht / gist:d0ec99debc61cfab95a6e4c4767949ea
Last active August 8, 2018 08:23
Delete Redis keys by patterns
redis-cli --raw keys "$PATTERN" | xargs redis-cli del
library(maptools)
library(geosphere)
# load USA state-level spatial data
# download from http://gadm.org
# click the 'download' tab
# select county = 'united states', file format = 'R', click ok
# download 'level 1' for state-level data
load("USA_adm1.RData")