Skip to content

Instantly share code, notes, and snippets.

@drmikecrowe
drmikecrowe / install.sh
Created June 28, 2023 08:56 — forked from mx00s/install.sh
NixOS install script based on @grahamc's "Erase Your Darlings" blog post
#!/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
@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
#!/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:
docker-yml() {
docker inspect -f $'
{{.Name}}
image: {{.Config.Image}}
entrypoint: {{json .Config.Entrypoint}}
environment: {{range .Config.Env}}
- {{.}}{{end}}
' $1
}
@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