Skip to content

Instantly share code, notes, and snippets.

@sturadnidge
sturadnidge / tcp-server.js
Last active January 7, 2018 01:22
node.js tcp server
var net = require('net');
var server = net.createServer(function(socket) {
socket.write('ADMIN HE DOING IT SIDEWAYS\r\n');
socket.pipe(socket);
});
server.listen(process.env.PORT);
@sturadnidge
sturadnidge / is-it-down.sh
Last active July 23, 2017 02:04
Quick and dirty HTTP monitor
#!/bin/bash
if [ $# -ne 1 ]
then
echo "Usage: $0 {host.fqdn}"
echo "runs curl against a host until it doesn't"
exit 1
fi
HOST=$1
@sturadnidge
sturadnidge / install_tmux_macos_no_brew.sh
Last active December 10, 2017 01:13
Install tmux on macOS 10.12 without need for brew or OpenSSL
#
# all credit to https://gist.github.com/shrayasr/8714601#gistcomment-2127790
#
## setup
TMUX_VER=2.6
LIBEVENT_VER=2.1.8-stable
TEMP_COMPILE=~/tmux-temp-compile
COMMON_INSTALL_PREFIX=/usr/local
@sturadnidge
sturadnidge / 12factor.req
Created July 14, 2017 01:42
Config file to generate a certificate signing request for 12factor.com for use with PCF (ie all required SANs)
[req]
default_bits = 2048
default_md = sha256
distinguished_name = subject
encrypt_key = no
prompt = no
req_extensions = req_ext
[subject]
countryName = AU
@sturadnidge
sturadnidge / rootCA.cfg
Created July 14, 2017 01:40
openssl config file for a root CA that will sign requests with subjectAltName(s)
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
@sturadnidge
sturadnidge / create_pcf_mysql.sh
Last active November 28, 2017 00:26
Creates the MySQL databases required for a PCF install
#!/bin/bash
if [ $# -ne 3 ]
then
echo "Usage: $0 {pcf-version} {mysql-host.fqdn} {mysql-user}"
echo "Creates PCF databases on a MySQL host"
exit 1
fi
VERSION="$1"
@sturadnidge
sturadnidge / clean_pcf_mysql.sh
Last active November 28, 2017 00:27
Cleans a PCF MySQL host
#!/bin/bash
if [ $# -ne 3 ]
then
echo "Usage: $0 {pcf-version} {mysql-host.fqdn} {mysql-user}"
echo "Cleans PCF databases on a MySQL host"
exit 1
fi
VERSION="$1"
@sturadnidge
sturadnidge / opsman_upload.sh
Last active August 4, 2017 01:46
Upload File to Ops Manager
#!/bin/bash
# uaac is an alias set in .profile of ops manager user
shopt -s expand_aliases
source ~/.profile
function usage {
printf "Usage: ${0##*/} <file-to-upload.pivotal>\n"
exit 1
}
@sturadnidge
sturadnidge / pivnet_download.sh
Last active April 10, 2017 08:20
Pivnet Download File
wget -O "<filename>" --header="Authorization: Token ${PIVNET_TOKEN}" file/to/download
@sturadnidge
sturadnidge / genCert.md
Last active March 21, 2023 09:38
Generate a self signed certificate in 1 line + a config file

To generate a self-signed cert, do the following:

openssl req -config 12factor.req -new -nodes -x509 -newkey rsa:2048 -sha256 -keyout 12factor.key -out 12factor.cert -days 3650

Where 12factor.req is:

[ req ]
default_bits        = 2048
default_keyfile     = 12factor.key