Skip to content

Instantly share code, notes, and snippets.

View iDanielLaw's full-sized avatar

Daniel Law iDanielLaw

  • Imagine No Limit Technology
View GitHub Profile
#!/bin/bash
# Create and sign a JWT token with ES256 given the path to an ECDSA
# private key and a JSON payload.
# $0 path/to/keypair.der '{"JSON": "payload"}'
# Example keypair creation:
# openssl ecparam -name prime256v1 -genkey -noout -outform DER > example-keypair.der
# A few tips for generating the payload:
# - Pipe raw strings through `jq --raw-input .` to encode them as
@iDanielLaw
iDanielLaw / Lava Lamp RNG.md
Created June 23, 2019 17:42 — forked from UnquietCode/Lava Lamp RNG.md
Lava Lamp Random Number Generator

Lava Lamp Random Number Generator

(extracted from the now defunct SGI project at http://lavarand.sgi.com/cgi-bin/how.cgi via the magical Internet Archive Wayback Machine)

Lava Lamps can be used as a source of randomness, which can be used to establish a random number generator. The output of the RNG can then be consumed by various computer applications.

Step 1: Establish a chaotic system

(Set up Lava Lite® lamps in a machine room.)

@iDanielLaw
iDanielLaw / README.md
Created June 28, 2019 13:21 — forked from hkwi/README.md
Linux vxlan nat traversal example

This example shows vxlan nat traversal, using UDP hole punching.

         +---------------+
         | (node5) vxlan |
         +---------------+
                  | uplink
       +--------------------+
       | (node4) masquerade |
 +--------------------+
@iDanielLaw
iDanielLaw / Netfilter-IPTables-Diagrams.md
Created July 2, 2019 19:38 — forked from nerdalert/Netfilter-IPTables-Diagrams.md
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.

@iDanielLaw
iDanielLaw / gist:20852821dfc931ea2679971e4e1f5e07
Created July 8, 2019 07:56 — forked from rlex/gist:2ec8562c4642032600e3e4c8a5acac4b
Mikrotik <-> Linux GRE/IPSec, strongswan
config setup
charondebug="ike 2, knl 2, cfg 2, net 2, esp 2, dmn 2, mgr 2"
conn %default
# keyexchange=ikev2
conn mikrotik-1
# Try connect on daemon start
auto=start
@iDanielLaw
iDanielLaw / docker-migrate.sh
Created July 17, 2019 08:56 — forked from kimh/docker-migrate.sh
Shell script to demonstrate docker migration with CRIU
#!/bin/bash -e
function run-vg-cmd() {
pushd $1
eval $2
popd
}
function usage() {
echo "Usage: $0 container from-vagrant-dir to-vagrant-dir"
@iDanielLaw
iDanielLaw / create-docker-tls.sh
Created August 8, 2019 12:34 — forked from Stono/create-docker-tls.sh
Creating and setting up Docker for TLS
#!/bin/bash
# This script will help you setup Docker for TLS authentication.
# Run it passing in the arguement for the FQDN of your docker server
#
# For example:
# ./create-docker-tls.sh myhost.docker.com
#
# The script will also create a profile.d (if it exists) entry
# which configures your docker client to use TLS
#
@iDanielLaw
iDanielLaw / tls-server-in-memory-cert.go
Created August 15, 2019 09:14 — forked from shivakar/tls-server-in-memory-cert.go
TLS server with in-memory self-signed certificate
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"errors"
"log"
@iDanielLaw
iDanielLaw / client_tls_info.go
Created August 15, 2019 14:12 — forked from husobee/client_tls_info.go
discovery of tls in go, and the handshake process
package main
import (
"crypto/tls"
"encoding/json"
"fmt"
"log"
"net"
"net/http"
)