Skip to content

Instantly share code, notes, and snippets.

@sturadnidge
sturadnidge / tcp-server.js
Last active Jan 7, 2018
node.js tcp server
View tcp-server.js
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 Jul 23, 2017
Quick and dirty HTTP monitor
View is-it-down.sh
#!/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 Dec 10, 2017
Install tmux on macOS 10.12 without need for brew or OpenSSL
View install_tmux_macos_no_brew.sh
#
# 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 Jul 14, 2017
Config file to generate a certificate signing request for 12factor.com for use with PCF (ie all required SANs)
View 12factor.req
[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 Jul 14, 2017
openssl config file for a root CA that will sign requests with subjectAltName(s)
View rootCA.cfg
#
# 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 Nov 28, 2017
Creates the MySQL databases required for a PCF install
View create_pcf_mysql.sh
#!/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 Nov 28, 2017
Cleans a PCF MySQL host
View clean_pcf_mysql.sh
#!/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 Aug 4, 2017
Upload File to Ops Manager
View opsman_upload.sh
#!/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 Apr 10, 2017
Pivnet Download File
View pivnet_download.sh
wget -O "<filename>" --header="Authorization: Token ${PIVNET_TOKEN}" file/to/download
@sturadnidge
sturadnidge / genCert.md
Last active Jan 28, 2021
Generate a self signed certificate in 1 line + a config file
View genCert.md

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