Skip to content

Instantly share code, notes, and snippets.

View sdr01810's full-sized avatar

Steve Rogers sdr01810

  • Independent Consultant
  • Greater Boston Area
View GitHub Profile
@sdr01810
sdr01810 / artifactory.spin-up.sh
Last active June 28, 2017 20:41
Spin up a JFrog Artifactory server as a Docker container.
#!/bin/bash
## Spin up a JFrog Artifactory server as a Docker container.
## By Stephen D. Rogers <inbox.c7r@steve-rogers.com>, 2017-04.
##
## Usage:
##
## artifactory.spin-up [--interactive|-i] [--restart policy] [--tty|-t] [listening_port]
##
## The Artifactory listening port (on the container host) defaults to 8001.
##
@sdr01810
sdr01810 / docker.install.sh
Last active February 16, 2018 19:32
Install the latest stable Docker and associated tools.
#!/usr/bin/env bash
## Install the latest stable Docker and associated tools.
## By Stephen D. Rogers <inbox@c7r@steve-rogers.com>, 2017-04.
##
set -e
cmd_apt_get="${cmd_apt_get:-xx sudo apt-get --quiet}"
my_user_name="${my_user_name:-$(id -un)}"
@sdr01810
sdr01810 / git-server.spin-up.sh
Last active June 28, 2017 20:41
Spin up a Git server as a Docker container.
#!/bin/bash
## Spin up a Git server as a Docker container.
## By Stephen D. Rogers <inbox.c7r@steve-rogers.com>, 2017-06.
##
## Usage:
##
## git-server.spin-up [--interactive|-i] [--restart policy] [--tty|-t] [listening_port]
##
## The git-server listening port (on the container host) defaults to 2203.
##
@sdr01810
sdr01810 / jenkins.spin-up.sh
Last active June 28, 2017 20:42
Spin up a Jenkins server as a Docker container.
#!/bin/bash
## Spin up a Jenkins server as a Docker container.
## By Stephen D. Rogers <inbox.c7r@steve-rogers.com>, 2017-04.
##
## Usage:
##
## jenkins.spin-up [--interactive|-i] [--restart policy] [--tty|-t] [listening_port [cli_listening_port]]
##
## The Jenkins listening port (on the container host) defaults to 8002.
## The Jenkins CLI listening port (on the container host) defaults to 2202.
@sdr01810
sdr01810 / Jenkinsfile.hello-world
Last active June 21, 2017 21:22
A simple Jenkinsfile example; useful for confirming a Jenkins installation.
pipeline {
agent { docker 'maven' }
stages {
stage('build') {
steps {
sh 'echo "Hello World"'
sh 'mvn --version || :'
}
}
}
@sdr01810
sdr01810 / nginx.spin-up.sh
Last active January 13, 2018 02:33
Spin up an Nginx server as a Docker container.
#!/bin/bash
## Spin up a Nginx server as a Docker container.
## By Stephen D. Rogers <inbox.c7r@steve-rogers.com>, 2017-06.
##
## Usage:
##
## nginx.spin-up [--interactive|-i] [--restart policy] [--tty|-t] [listening_port]
##
## The Nginx listening port (on the container host) defaults to 80.
##
@sdr01810
sdr01810 / tomcat.spin-up.sh
Last active January 13, 2018 02:33
Spin up a Tomcat server as a Docker container.
#!/bin/bash
## Spin up a Tomcat server as a Docker container.
## By Stephen D. Rogers <inbox.c7r@steve-rogers.com>, 2017-07.
##
## Usage:
##
## tomcat.spin-up [--interactive|-i] [--restart policy] [--tty|-t] [listening_port]
##
## The Tomcat listening port (on the container host) defaults to 8080.
##
@sdr01810
sdr01810 / ubuntu.dev.ws.provision.step.poe.vagrant.sh
Created August 24, 2017 18:26
Unattended installation of Vagrant on Ubuntu.
##/bin/bash
##
vagrant_deb_url='https://releases.hashicorp.com/vagrant/1.8.6/vagrant_1.8.6_x86_64.deb'
vagrant_deb_fpn="${HOME}/Downloads/${vagrant_deb_url##*/}"
if ! [ -e "${vagrant_deb_fpn:?}" ] ; then
xx wget -q -O "${vagrant_deb_fpn:?}" "${vagrant_deb_url:?}"
fi
@sdr01810
sdr01810 / post_delayed_exit.functions.sh
Created October 26, 2017 16:45
Shell function post_delayed_exit() and friends.
delayed_exit_p=
function post_delayed_exit() { # exit_code explanation ...
local exit_code="${1:?missing argument: exit_code}" ; shift
: "${1:?missing argument: explanation}"
if [ -z "${delayed_exit_p}" ] ; then
@sdr01810
sdr01810 / check_user_is_root_or_devops.functions.sh
Created October 26, 2017 16:47
Shell function check_user_is_root_or_devops() and friends.
function check_user_is_root_or_devops() {
if ! user_is_root_or_devops ; then
post_delayed_exit 2 "You must be root or devops to execute this command; aborting."
fi
}
function user_is_root_or_devops() {