Skip to content

Instantly share code, notes, and snippets.

View curtisz's full-sized avatar

Curtis Z curtisz

  • Strike Enterprises
  • The Human Homeworld
View GitHub Profile
@curtisz
curtisz / macvlan_ipvlan_networking.sh
Created August 21, 2018 08:24
Test various macvlan/ipvlan networking configurations in Docker
#!/bin/sh
#
# Macvlan is merged upstream.
# Test a number of network creates, deletes and runs. Each testing
# different scenarios and configuration options for macvlan and ipvlan
#
# Change eth0 to the link to be used for the parent link `-o parent=`
#
# modified tests / added features from the original gist found here:
# https://github.com/nerdalert/dotfiles/blob/master/ipvlan-macvlan-it.sh
@curtisz
curtisz / testkit.sh
Created April 10, 2018 03:07
Simple testkit init script
#!/bin/bash
# this is just the way i like it. do whatever you want.
# you'll need to put your AWS creds in ~/.aws/credentials or supply them here
# platform string is defined by the driver
TESTKIT_PLATFORM_LINUX="ubuntu_16.04"
# constructed inside the install script with:
# (for ubuntu):
# package_pattern="$(echo "$VERSION" | sed "s/-ee-/~ee~/g" | sed "s/-/.*/g").*-0~ubuntu"
@curtisz
curtisz / 0_dct_demo.sh
Created February 2, 2017 14:00 — forked from mbentley/0_dct_demo.sh
Docker Content Trust Demo (January 2017)
### set environment variables
DTR_URL="ddcbeta.mac"
alias notary="notary -s https://${DTR_URL} -d ~/.docker/trust --tlscacert ~/.docker/tls/ddcbeta.mac/ca.crt"
REPO="admin/signtest"
USERNAME="admin"
### admin
# get certificate from client bundle, send public key to the admin
cd ~/ucp-bundles/local

Keybase proof

I hereby claim:

  • I am curtisz on github.
  • I am curtisz (https://keybase.io/curtisz) on keybase.
  • I have a public key whose fingerprint is C4D5 B962 DED9 95C6 B704 8A19 A47B 9835 612C A82D

To claim this, I am signing this object:

man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
@curtisz
curtisz / querystring.js
Last active November 9, 2015 23:38
Parse/Prepare Query String (JavaScript)
/**
* @function parseQueryString
* Parse query string and return object containing parameters and their values.
* @param {string} the (encoded) query string to parse
* @return {object} the parsed query string object
*/
var parseQueryString = function( string ) {
var query = {};
string.split('&').forEach(function(item) {
query[item.split('=')[0]] = decodeURIComponent(item.split('=')[1]);
@curtisz
curtisz / parseurl.js
Created November 9, 2015 23:07
RFC 3986 URL Parsing Regular Expression (JavaScript)
/* ***********************************************************************************
Hero authors of RFC 3986 (http://www.ietf.org/rfc/rfc3986.txt) gave us this regex
for parsing (well-formed) URLs into their constituent pieces:
^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
Which for the following URL:
http://www.ics.uci.edu/pub/ietf/uri/#Related
@curtisz
curtisz / getxpath.js
Last active November 10, 2015 17:45
Get Element XPath
var getElementXPath = function(element) {
if (element && element.id) {
// has id, so use it instead of full xpath
return '//' + element.nodeName.toLowerCase() + '[@id="' + element.id + '"]';
} else {
// gets absolute xpath
return getElementTreeXPath(element);
}
};
var getElementTreeXPath = function(element) {
@curtisz
curtisz / bling.js
Last active August 29, 2015 14:23 — forked from paulirish/bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document)
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn)
}
NodeList.prototype.__proto__ = Array.prototype