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
/*
* Generic hashmap manipulation functions
* SEE: http://elliottback.com/wp/hashmap-implementation-in-c/
*/
#ifndef __HASHMAP_H__
#define __HASHMAP_H__
#define MAP_MISSING -3 /* No such element */
#define MAP_FULL -2 /* Hashmap is full */
<?php
/**
* Catch php output buffering data over jQuery AJAX
*
* @author: Sohel Rana ([email protected])
* @author url: https://blog.sohelrana.me
* @link: https://blog.sohelrana.me/catch-php-output-buffering-data-jquery-ajax/
* @licence MIT
*/
@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"
)
@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 / 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 / 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 / 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 / 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 / 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 |
 +--------------------+