Skip to content

Instantly share code, notes, and snippets.

Michael Smith MikaelSmith

Block or report user

Report or block MikaelSmith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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
# stored in GOODREADS_KEY, GOODREADS_SECRET environment variables.
require 'json'
MikaelSmith /
Last active Jul 12, 2019
Wash / BitBar Examples
#!/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 / 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]
apply($hosts) {
include 'docker'
# Initialize the swarm on a single manager.
$targets = get_targets($managers)
$master = $targets[0]
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 / 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 = ''
$domain_credential = {
'user' => 'Administrator',
'password' => 'Password1!'
$dns_servers = ['','']
['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
MikaelSmith / test.cpp
Created Aug 26, 2016
Boost date_time posix_time breaking
View test.cpp
#include <limits>
#include <iostream>
#include <boost/date_time/posix_time/posix_time.hpp>
using namespace boost::posix_time;
int main(int argc, char** argv)
MikaelSmith /
Last active Feb 23, 2016
C++ SSL JSON Prettifier (Boost.asio)
#include <iostream>
#include <cstdint>
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#include <rapidjson/reader.h>
#include <rapidjson/prettywriter.h>
#include <rapidjson/filewritestream.h>
using namespace std;
using boost::asio::ip::tcp;
MikaelSmith /
Last active Dec 7, 2015
Functional C++14 λ Syntax
#include <iostream>
#include <vector>
template <typename T, typename... TArgs, template <typename...>class C, typename F>
auto fn_map(const C<T,TArgs...>& container, const F& f) {
using resultType = decltype(f(std::declval<T>()));
C<resultType> result;
for (const auto& item : container)
return result;
You can’t perform that action at this time.