Skip to content

Instantly share code, notes, and snippets.

View brillozon's full-sized avatar
:electron:
making more things

Mike Martinez brillozon

:electron:
making more things
  • Bayer Crop Science
  • Saint Louis, MO
View GitHub Profile
@brillozon
brillozon / handler.js
Created April 10, 2018 23:10
Run AWS Lambda functions as CRON jobs.
'use strict';
module.exports.runonce = (event, context, callback) => {
// Simply note that we executed in the logs and move on.
// Find the logs in Cloudwatch LogGroup /aws/lambda/lambda-cron-dev-runonce
console.log('executing cron job');
callback(null, {});
};
@brillozon
brillozon / etc-default-nimbus
Created April 30, 2015 02:39
SysV initscript for mounting EC2 volumes, including creating a swap partition on the first available ephemeral drive.
# Default configuration values for nimbus startup.
region=us-west-2
role=nimbus-dev
# Ephemeral mounting
localmount=/project
# EBS mounting
mount=/ebs
@brillozon
brillozon / load-aws-metadata.sh
Last active June 9, 2016 11:53
Loading EC2 instance and CFN stack metadata from AWS and into JSON files.
#!/bin/bash
datadir=awsdata
instancedatafile=$datadir/instancedata.json
stackdatafile=$datadir/stack-metadata.json
# Put all the extracted data into one directory.
/bin/mkdir -p $datadir
curl="/usr/bin/curl --retry 3 --silent --show-error --fail"
@brillozon
brillozon / blowfish.cpp
Created October 14, 2013 23:27
Getting the blowfish encryption to work on a command line with the correct PKCS#5 padding applied. I would have preferred to have used the openssl command directly, but the padding doesn't seem to line up right. And this gave me a chance to do some evp programming again.
#include <openssl/evp.h>
#include <string>
#include <iostream>
/**
* @brief Blowfish string encoding.
*
* @param key - ASCII key value for the encryption.
* @param plaintext - the ASCII plaintext password to encrypt.
@brillozon
brillozon / dts_facet.cpp
Created October 14, 2013 17:59
This captures how I am extracting date/time stamps from QuickFIX logfiles by simply calling the extraction operator from the data stream onto a posix_time::ptime type. It does this by creating a facet describing the date/time stamp format and imbuing the stream with that facet.
#include <boost/date_time.hpp>
#include <iostream>
#include <sstream>
#include <string>
// Pseudo FIX logfile data.
const std::string line1 = "20130423-03:22:05.045 : 8=FIXT.1.1";
const std::string line2 = "20130423-03:24:05.339 : 8=FIXT.1.1";