This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# NixOS install script synthesized from: | |
# | |
# - Erase Your Darlings (https://grahamc.com/blog/erase-your-darlings) | |
# - ZFS Datasets for NixOS (https://grahamc.com/blog/nixos-on-zfs) | |
# - NixOS Manual (https://nixos.org/nixos/manual/) | |
# | |
# It expects the name of the block device (e.g. 'sda') to partition |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker-yml() { | |
docker inspect -f $' | |
{{.Name}} | |
image: {{.Config.Image}} | |
entrypoint: {{json .Config.Entrypoint}} | |
environment: {{range .Config.Env}} | |
- {{.}}{{end}} | |
' $1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# 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 |