Skip to content

Instantly share code, notes, and snippets.

@drmikecrowe
drmikecrowe / FormService.js
Created October 22, 2014 12:34
Complex rendering solution for https://github.com/caolan/forms
var forms = require('forms');
var fields = forms. fields,
validators = forms.validators,
widgets = forms.widgets;
var _ = require('lodash');
var fs = require('fs');
function repl(str,arr) {
_.forOwn(arr,function(value,key) {
var search = '{'+key+'}';
@drmikecrowe
drmikecrowe / README.md
Last active August 29, 2015 14:16
Reformat Gherkin test scripts to line up properly

Setup/Configuration

Here's how our tests are setup:

  • Tests are grouped in subdirectories
  • Each directory/filename is prefixed with a number between 100-999, typically incremented by 10. This allows us to insert new tests into the stream of sequential tests
  • Tests start at 100, but configuration setup tests start at 010.
  • Tests are tagged according to the directory, and directory/file

This is very easy to understand/use, especially when you get 1000s of steps/scenarios and complex tests in your setup.

@drmikecrowe
drmikecrowe / app.yml
Last active August 29, 2015 14:17 — forked from Zolmeister/app.yml
---
# file: roles/app/tasks/main.yml
- name: ensure logging directory exists
file: path=/var/log/acme state=directory
tags:
- install
- name: ensure config directory exists
file: path=/etc/acme/app state=directory
docker-yml() {
docker inspect -f $'
{{.Name}}
image: {{.Config.Image}}
entrypoint: {{json .Config.Entrypoint}}
environment: {{range .Config.Env}}
- {{.}}{{end}}
' $1
}
@drmikecrowe
drmikecrowe / reindex-db.js
Last active July 25, 2016 07:22
Complex indices (and post-create index) of Waterline models
/**
* FILE: api/hooks/reindex-db.js
*
* Created by mcrowe on 1/28/15.
*
* Insures indices recreated if needed, and allows complex indicies to be specified in the model as well. Example:
*
module.exports = {
schema : true,
version : "1.3",
@drmikecrowe
drmikecrowe / Dockerfile
Created January 14, 2017 04:01
Working PHP Docker Compose System with PhantimJS testing
# Build using docker build -t php-drmikecrowe
FROM php:5.6-apache
MAINTAINER Emilien Kenler <hello@emilienkenler.com>
RUN apt-get update && apt-get install -y git libpq-dev libmcrypt-dev zlib1g-dev libicu-dev g++ graphviz && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install pdo_pgsql pdo_mysql mbstring mcrypt zip sockets intl bcmath mysqli
RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer.phar && \
#!/bin/bash
usage() {
cat << EOF
Usage: $0 [OPTION]... COMMAND
Execute the given command in a way that works safely with cron. This should
typically be used inside of a cron job definition like so:
* * * * * $(which "$0") [OPTION]... COMMAND
Arguments:
@drmikecrowe
drmikecrowe / find_latest_ubuntu_amis.sh
Last active October 13, 2017 22:31 — forked from antimius/find_latest_ami.sh
Script to find and print the latest stable, Ubuntu version
#!/bin/bash
# prints latest, stable, HVM, EBS GP2 backed AMIs for major OSs
UBUNTU=099720109477
REGIONS="us-east-1 us-east-2 us-west-1 us-west-2"
for REGION in $REGIONS; do
echo -n "$REGION: "
aws ec2 describe-images --region=$REGION --owners $UBUNTU --filters 'Name=name,Values=*hvm-ssd*16.04*' --query 'Images[*].[ImageId,CreationDate,Name]' --output text | sort -k2 -r | head -n 1
@drmikecrowe
drmikecrowe / search-aws-amis.sh
Created October 13, 2017 23:09
Search for the latest releases for a given search string. Assumes that vendors release in bulk, so it looks for over 2 images released in a day and shows those matches
#!/bin/bash
LINES=6
if [ $# -ne 1 ];then
echo "Usage:"
echo " $0 keyword"
exit 1
fi
@drmikecrowe
drmikecrowe / make.log
Created March 17, 2018 11:00
Make logfile
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.2b1
loading pickled environment... done
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 4 changed, 0 removed
reading sources... [ 25%] leo.core
reading sources... [ 50%] leo.external
reading sources... [ 75%] leo.external.concurrent.futures
reading sources... [100%] leo.plugins
Can not import path from plugin leo.plugins.at_view