Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Smith MikaelSmith

View GitHub Profile
View pg-upgrade.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app.kubernetes.io/name: cd4pe-postgres
name: postgres
namespace: cd4pe
spec:
replicas: 1
selector:
View app.js
const Express = require('express');
const Session = require('express-session');
const BodyParser = require('body-parser');
const Keycloak = require('keycloak-connect');
const Cors = require('cors');
const hostname = '127.0.0.1';
const port = 3000;
var app = Express();
@MikaelSmith
MikaelSmith / github.rb
Last active Mar 25, 2020
Collect candidates for Puppet-owned gems published to rubygems.org
View github.rb
#!/usr/bin/env ruby
require 'octokit'
token = ENV['GITHUB_TOKEN']
if token.nil? || token.empty?
puts "GITHUB_TOKEN required for authentication"
exit 1
end
client = Octokit::Client.new(access_token: token)
@MikaelSmith
MikaelSmith / goodreads.rb
Last active Jun 11, 2019
Wash External Plugin Example
View goodreads.rb
#!/usr/bin/env ruby
# A script for exploring your Goodreads library with Wash
#
# Requirements:
# - `gem install oauth nokogiri --user-install`
# Note that BitBar runs without shell setup, so it will likely use the system ruby.
# - A developer key/secret from https://www.goodreads.com/api/keys
# stored in GOODREADS_KEY, GOODREADS_SECRET environment variables.
require 'json'
@MikaelSmith
MikaelSmith / active.1m.sh
Last active Jul 12, 2019
Wash / BitBar Examples
View active.1m.sh
#!/usr/bin/env wash
# Count all and all running EC2 instances
running=`find aws -action exec -meta .State.Name running 2>/dev/null | wc -l | xargs`
total=`find aws -action exec -meta .State.Name -exists 2>/dev/null | wc -l | xargs`
echo EC2 $running / $total
# Count S3 buckets
buckets=`find aws -maxdepth 4 -path '*/resources/s3/*' 2>/dev/null | wc -l | xargs`
echo S3 $buckets
View Puppetfile
mod 'puppetlabs-stdlib'
mod 'pltraining-dirtree'
mod 'puppetlabs-inifile'
mod 'puppet-archive'
mod 'puppetlabs-java_ks'
mod 'puppet-rundeck'
@MikaelSmith
MikaelSmith / swarm.pp
Last active Nov 12, 2018
Install and bootstrap Docker Swarm using Bolt + the Puppet Docker module
View swarm.pp
plan examples::swarm(TargetSpec $managers, TargetSpec $workers) {
$hosts = [$managers, $workers]
$hosts.apply_prep
apply($hosts) {
include 'docker'
}
# Initialize the swarm on a single manager.
$targets = get_targets($managers)
$master = $targets[0]
@MikaelSmith
MikaelSmith / transform.pp
Last active Oct 1, 2018
Transforming hash in Puppet
View transform.pp
$data = [
{
"certname" => "server1",
"parameters" => {
"port" => 1234,
"job" => "job1"
}
},
{
"certname" => "server2",
@MikaelSmith
MikaelSmith / domain-controller.pp
Last active Sep 20, 2018
Windows Bootstrapping
View domain-controller.pp
# Requires Powershell 5, Puppet, and the puppetlabs-dsc module.
# These variables may need customization.
$domain_name = 'example.com'
$domain_credential = {
'user' => 'Administrator',
'password' => 'Password1!'
}
$dns_servers = ['10.240.0.10','10.240.1.20']
['AD-Domain-Services','RSAT-AD-PowerShell','RSAT-AD-Tools'].each |String $feature| {
View Functions to switch between versions
java8 () {
latest=`ls -d /Library/Java/JavaVirtualMachines/jdk1.8.0_*.jdk | sed 's/^.*jdk1\.8\.0_//' | sort -n | tail -1`
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_${latest}Contents/Home
java -version
}
java9 () {
export JAVA_HOME=/Library/Java/Home
java -version
}
You can’t perform that action at this time.