Skip to content

Instantly share code, notes, and snippets.

View jondkelley's full-sized avatar
:octocat:

Jonathan D Kelley jondkelley

:octocat:
View GitHub Profile
@jondkelley
jondkelley / readme.md
Created December 13, 2019 19:50
Bash getopt long options with values usage example.

Bash getopt long options with values usage example

#!/bin/bash -e
# default args
TEST_MODE=FALSE
ENDPOINT_HOSTNAME=""
AUX=""

FLAG_LIST=(
@jondkelley
jondkelley / terralock.py
Last active June 13, 2023 20:49
Removes a broken terraform lock state
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# To fix this issue in terraform:
# Failed to unlock state: failed to retrieve lock info: unexpected end of JSON input
# Python does what Terraform cannot do!
"""Delete terraform lock
Usage:
terralock.py --list --table TABLE_NAME
@jondkelley
jondkelley / Jenkinsfile_Inception.groovy
Created October 15, 2019 14:39
Jenkinsfile Inception (docker, on docker, on docker) concept
/* FORWARD:
TL;DR : The poor mans circleCI pattern.
this Jenkinsfile is like .circle/config.yml but it lives in .jenkins/Jenkinsfile and is groovy 💔 not YaML 💖
you want to create a Workflow Multibranch pipeline job that can build off many tags/branches with this scripted DSL in git
this pattern is unique as it can spawn multi-container pipelines from your intermediate container using an INCEPTION technique
a jenkins community first? yay im first at something! maybe that's bad.
--
why do it? because CircleCI rocks, jenkins sucks, but it sucks less now. maybe?
--
::TODO:: Provide Jenkins Job Builder template to build many Workflow jobs off many github repos, sorta like Circle
@jondkelley
jondkelley / ec2.md
Last active August 12, 2019 19:14
Amazon Awesome Cheatsheet

Assuming roles for commands

aws sts assume-role --role-arn arn:aws:iam::1234567890:role/assumed_role_or_user --role-session-name session_name --profile developer

Then use the tokens you get from the command output.

export AWS_ACCESS_KEY_ID=aaaaaabbbbbcccccddddddd
export AWS_SECRET_ACCES_KEY=aaaaaabbbbbcccccddddddd
@jondkelley
jondkelley / how_to_use_docker_lint_tester.md
Created July 31, 2019 22:02
how_to_use_docker_lint_tester.md

The general purpose of this fork is streamlined pass/fail testing.

How to use to lint your dockerfile images with CircleCI automatically

File: ./.circleci/config.yml

version: 2.1

jobs:
@jondkelley
jondkelley / lint-dockerfile.sh
Created July 9, 2019 15:03
Lint Dockerfiles for CI/CD
#!/usr/bin/env bash
# usage: ./lint-dockerfile.sh <path-to-dockerfile>
# purpose: lints dockerfile for common errors
# requires: docker to be installed
DOCKERFILE_PATH=$1
echo "Linting dockerfile : DOCKERFILE_PATH"
docker run -it --rm --privileged -v `pwd`:/root/ projectatomic/dockerfile-lint dockerfile_lint -f ${DOCKERFILE_PATH} | grep ERRORS > dockerfile-lint.out
@jondkelley
jondkelley / keybase.md
Created May 28, 2019 14:43
keybase.md

Keybase proof

I hereby claim:

  • I am jondkelley on github.
  • I am jondkelley (https://keybase.io/jondkelley) on keybase.
  • I have a public key ASCFZQZREFgmJFVe_RYCwP5WlKXg6FcHspzlIFaeIV3QAQo

To claim this, I am signing this object:

@jondkelley
jondkelley / diagnose_dns.py
Last active March 13, 2019 14:14
diagnose dns with dynect
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pip3 install dnspython3
# pip3 install dnspython
import json
import dns.resolver
import requests
import os
@jondkelley
jondkelley / gist:b2e693e07acfbc3dac97705464edc9bb
Created October 25, 2018 19:44
cat a file in Windows using ansible
---
- name: 'get newrelic-infra config'
win_shell: 'more newrelic-infra.yml'
args:
chdir: 'C:\Program Files\New Relic\newrelic-infra\'
executable: cmd
register: hello
- name: 'show newrelic-infra config'