Skip to content

Instantly share code, notes, and snippets.

@lhriley
lhriley / gist:6bf75fd083c440af19f982233b33bdcd
Created June 22, 2017 23:28
Find all file types in a given directory tree
find /var/log/* | xargs file
/var/log/apt: directory
/var/log/auth.log: ASCII text, with very long lines
/var/log/btmp: empty
/var/log/dist-upgrade: directory
/var/log/dmesg: ASCII text
/var/log/dpkg.log: ASCII text
/var/log/faillog: data
/var/log/fsck: directory
/var/log/fsck/checkroot: ASCII text

Keybase proof

I hereby claim:

  • I am lhriley on github.
  • I am loop_io (https://keybase.io/loop_io) on keybase.
  • I have a public key ASBkMAm0iqkMuCh4074LjKPWniV3TKdiFhgKGbtL1GKJhgo

To claim this, I am signing this object:

@lhriley
lhriley / packer-utils-fail-steps.md
Last active November 2, 2017 18:39
Steps to reproduce packer failure with utils.sh file

Steps to reproduce

  1. Create a packer project
  2. In your <config>.json file similar to the following:
{
  "builders": [
    {
      "ami_name"        : "packer-bastion-{{timestamp}}",
      "ami_regions"     : [ "{{user `aws_region_secondary`}}" ],
@lhriley
lhriley / packer-debug-utils-fail.log
Created November 2, 2017 19:05
Debug log for packer fail with utils.sh file.
2017/11/02 11:15:19 [INFO] Packer version: 1.1.1
2017/11/02 11:15:19 Packer Target OS/Arch: linux amd64
2017/11/02 11:15:19 Built with Go Version: go1.9
2017/11/02 11:15:19 Detected home directory from env var: /home/user
2017/11/02 11:15:19 Using internal plugin for parallels-pvm
2017/11/02 11:15:19 Using internal plugin for azure-arm
2017/11/02 11:15:19 Using internal plugin for parallels-iso
2017/11/02 11:15:19 Using internal plugin for digitalocean
2017/11/02 11:15:19 Using internal plugin for oracle-oci
2017/11/02 11:15:19 Using internal plugin for amazon-ebs
@lhriley
lhriley / aws-cert-import.sh
Created February 3, 2018 02:10
AWS CA import script for JDK keystore
#!/bin/bash -e
# create a temp dir in which to work
OLDDIR="$PWD"
TMPDIR="/tmp/_aws-ca"
mkdir "${TMPDIR}" && cd "${TMPDIR}"
AWS_CERTS=(
AmazonRootCA1.pem
@lhriley
lhriley / wait_for_docker_container_logs.sh
Last active March 8, 2018 20:06
Wait for docker container, then watch logs
#!/bin/bash
service="CONTAINER_NAME"; echo "waiting for docker container '${service}' "; while [[ ! $(docker ps | grep "${service}") ]]; do echo -n "."; sleep 1; done; docker logs -f $(docker ps -a | grep "${service}" | head -n1 | awk '{print $1}');
@lhriley
lhriley / kill_named_docker_container.sh
Created March 8, 2018 20:09
Quickly kill a named docker container without knowing all of the details of it
#!/bin/bash
service="DOCKER_CONTAINER"; docker kill $(docker ps | grep "${service}" | awk '{print $1}')