Skip to content

Instantly share code, notes, and snippets.

@bltb
bltb / docker-for-mac.md
Created August 14, 2020 22:37 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker for Mac Moby VM

2018 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Moby VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@bltb
bltb / tls-client.go
Created September 2, 2018 21:43 — forked from michaljemala/tls-client.go
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@bltb
bltb / repermute.py
Created August 28, 2017 08:59 — forked from mdeous/repermute.py
generate all possible permutations of a regex
# -*- coding: utf-8 -*-
#
# Used like this:
#
# from repermute import ipermute
#
# for s in ipermute('[A-Z]\d'):
# print s
#
# Almost all regular expression constructs are supported except for '*'
@bltb
bltb / ppurlcat.py
Created June 6, 2017 12:18
A crude proxy protocol v1 test client
#!/usr/bin/env python
import socket
import ssl
import sys
from urlparse import urlparse
'''Crude test client to a HTTP(S) server listening for proxy protocol
connections. Takes a HTTP(S) url as an argument and prints out the raw
response.
@bltb
bltb / loadchain.go
Created February 14, 2017 12:21 — forked from laher/loadchain.go
how to load a certificate chain in Go. See how https://github.com succeeds and https://facebook.com fails.
package main
import (
"fmt"
"net/http"
"crypto/tls"
"crypto/x509"
"encoding/pem"
)
var chain=`-----BEGIN CERTIFICATE-----
MIIG5jCCBc6gAwIBAgIQAze5KDR8YKauxa2xIX84YDANBgkqhkiG9w0BAQUFADBs
@bltb
bltb / http-benchmark.md
Created January 19, 2017 16:00 — forked from denji/http-benchmark.md
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)

Tools

Located in alphabetical order (not prefer)

  • ab – slow and single threaded, written in C
  • apib – most of the features of ApacheBench (ab), also designed as a more modern replacement, written in C
  • baloo – Expressive end-to-end HTTP API testing made easy, written in Go (golang)
  • bombardier – Fast crossplatform HTTP benchmarking tool, written in Go (golang)
  • curl-loader – performance loading of various application services and traffic generation, written in C
  • fasthttploader – benchmark (kinda ab) with autoadjustment and charts based on fasthttp library, write in Go (golang)
@bltb
bltb / buildHAProxy.sh
Created December 10, 2016 11:28 — forked from codingtony/buildHAProxy.sh
Compile of Haproxy using LibreSSL static. See https://github.com/codingtony/docker-build-haproxy for how to use with a Docker Image
#!/bin/bash -e
DIR=$PWD
LIBRESSL=libressl-2.5.0
HAPROXY=haproxy-1.6.9
PCRE=pcre-8.39
LUA=lua-5.3.0
READLINE=readline-6.3
NCURSES=ncurses-6.0
@bltb
bltb / grave-v4.vcl
Created October 4, 2016 20:09 — forked from perbu/grave-v4.vcl
sub vcl_hit {
if (obj.ttl >= 0s) {
# normal hit
return (deliver);
}
# We have no fresh fish. Lets look at the stale ones.
if (std.healthy(req.backend_hint)) {
# Backend is healthy. Limit age to 10s.
if (obj.ttl + 10s > 0s) {
set req.http.grace = "normal(limited)";
elsif DRIVER == :phantomjs
capabilities = Selenium::WebDriver::Remote::Capabilities.phantomjs("phantomjs.page.settings.userAgent" => "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36 PerformanceMonitoringBot/0.0.2")
# XXX. exclude
case `hostname`.strip
when
"ip-172-31-26-205",
"ip-172-31-8-248" #,
# "embora"
@bltb
bltb / ingdirect.py
Created November 12, 2015 06:39 — forked from mindsocket/ingdirect.py
Munin plugin to log in to ING Direct (Australia) account and extract account balances
#!/usr/bin/env python
# -*- python -*-
#
# Plugin to track account balances on ingdirect.com.au, using selenium gymnastics to log in
#
# E.g.
# ln -s /usr/share/munin/plugins/ingdirect.py /etc/munin/plugins/ingdirect
#
# Needs (hint: pip install):
# selenium