Skip to content

Instantly share code, notes, and snippets.

View congnt24's full-sized avatar
💭
exploring

Cong Nguyen congnt24

💭
exploring
  • Hanoi
View GitHub Profile
@congnt24
congnt24 / openssl.md
Created May 8, 2019 10:18 — forked from NoMan2000/openssl.md
Common OpenSSL Commands with Keys and Certificates

Common OpenSSL Commands with Keys and Certificates

SSL Info

Generate RSA private key with certificate in a single command

openssl req -x509 -newkey rsa:4096 -sha256 -keyout example.key -out example.crt -subj "/CN=example.com" -days 3650 -passout pass:foobar

Generate Certificate Signing Request (CSR) from private key with passphrase

openssl x509 -x509toreq -in example.crt -out example.csr -signkey example.key -passin pass:foobar

@congnt24
congnt24 / web-servers.md
Created March 10, 2019 05:04 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
git clone https://github.com/vfarcic/k8s-specs.git
cd k8s-specs
git pull
open "https://console.aws.amazon.com/iam/home#/security_credential"
export AWS_ACCESS_KEY_ID=[...]
@congnt24
congnt24 / app.js
Created May 21, 2018 14:53 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@congnt24
congnt24 / Config-Coreos-Cluster.md
Created February 23, 2018 04:40 — forked from DenisIzmaylov/NOTES.md
Step By Step Guide to Configure a CoreOS Cluster From Scratch

Step By Step Guide to Configure a CoreOS Cluster From Scratch

This guide describes how to bootstrap new Production Core OS Cluster as High Availability Service in a 15 minutes with using etcd2, Fleet, Flannel, Confd, Nginx Balancer and Docker.

Content

@congnt24
congnt24 / gist:2bb4e861154f26659421fb8abee8e96c
Created December 6, 2017 08:30 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@congnt24
congnt24 / docker-compose.yml
Created November 8, 2017 08:19 — forked from elleryq/docker-compose.yml
docker + node-exporter + prometheus + promdash
# Need to do the following steps:
# 1. create /var/prometheus first.
# 2. run: docker-compose run promdash ./bin/rake db:migrate
nodeexporter:
image: prom/node-exporter
ports:
- "9100:9100"
prometheus:
image: prom/prometheus
@congnt24
congnt24 / SendSMSViewController.swift
Created August 28, 2017 15:13 — forked from soggybag/SendSMSViewController.swift
Send SMS Messages with Swift
import UIKit
import MessageUI // Import MessageUI
// Add the delegate protocol
class ViewController: UIViewController, MFMessageComposeViewControllerDelegate {
// Send a message
func sendMessage() {
let messageVC = MFMessageComposeViewController()
messageVC.body = "Message String"

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream