Skip to content

Instantly share code, notes, and snippets.

@mdelillo
mdelillo / loop.sh
Created January 10, 2020 20:40
Function to run a command in parallel batches
#!/usr/bin/env bash
loop() {
total_runs=$1
runs_per_loop=$2
shift
shift
int_regex='^[0-9]+$'
@mdelillo
mdelillo / cf-deployment-with-cats.yml
Created March 17, 2020 20:13
Concourse pipeline for getting a cf-deployment with the toolsmiths-env-resource and running CATS
---
resource_types:
- name: toolsmiths-envs
type: docker-image
source:
repository: cftoolsmiths/toolsmiths-envs-resource
resources:
- name: cf-deployment-env
type: toolsmiths-envs
@mdelillo
mdelillo / open-tracker-story.kmmacros
Created May 11, 2020 21:23
Keyboard Maestro - Open Tracker Story
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>Activate</key>
<string>Normal</string>
<key>CreationDate</key>
<real>610923730.30395901</real>
<key>Macros</key>
@mdelillo
mdelillo / create-builder
Last active July 21, 2020 21:01
Create a builder from specified buildpacks, buildpackages, and mixins
#!/usr/bin/env bash
set -euo pipefail
timestamp="$(date +%s)"
builder_name="builder-${timestamp}"
mixins=""
buildpackages=()
buildpacks=()
@mdelillo
mdelillo / mkexec.sh
Created July 23, 2020 20:55
Bash function for creating `fly exec` scripts from concourse task config files
mkexec() {
if [[ $# != 1 ]]; then
echo "Usage: ${FUNCNAME[0]} </path/to/task/config.yml>"
return 1
fi
task_config=$1
if ! [[ -f "${task_config}" ]]; then
echo "Could not find file ${task_config}"
@mdelillo
mdelillo / run-func-on-dirs-in-parallel.sh
Created August 5, 2020 14:43
Runs a bash function on all child directories in parallel
#!/usr/bin/env bash
set -euo pipefail
do_something() {
dir=$1
echo "doing something with $dir"
sleep 1
}