Skip to content

Instantly share code, notes, and snippets.

View Gabelbombe's full-sized avatar

Till Eulenspiegel Gabelbombe

  • The Deep Darkness, WA
View GitHub Profile
#!/usr/bin/env bash -xe
release=$(curl --silent https://golang.org/doc/devel/release.html |grep -Eo 'go[0-9]+(\.[0-9]+)+' |sort -V |uniq |tail -1)
os=$(uname -s |tr '[:upper:]' '[:lower:]')
arch=$(case "$(uname -m)" in i*) echo '386' ;; x*) echo 'amd64' ;; *) echo 'armv61'; esac)
curl --silent https://storage.googleapis.com/golang/$release.$os-$arch.tar.gz \
| sudo tar -vxz --strip-components 1 -C $(dirname $(dirname $(which go)))
[ec2-user@ip-xx-xxx-xxx-xxx ~]$ nslookup production.cloudflare.docker.com 8.8.8.8
;; connection timed out; no servers could be reached
[ec2-user@ip-xx-xxx-xxx-xxx ~]$ nslookup production.cloudflare.docker.com 8.8.8.8
;; connection timed out; no servers could be reached
[ec2-user@ip-xx-xxx-xxx-xxx ~]$ nslookup production.cloudflare.docker.com 10.128.8.8
;; connection timed out; no servers could be reached
[ec2-user@ip-xx-xxx-xxx-xxx ~]$ nslookup production.cloudflare.docker.com 10.128.0.2
@Gabelbombe
Gabelbombe / nomad-job.log
Last active April 25, 2019 19:24
Stale Nomad job that got stuck because of... yeah, thanks thobe....
ehimeken in ~/nomad-orchestrator/examples/root-example
○ → nomad job status
ID Type Priority Status Submit Date
fabio system 50 running 2019-04-25T11:15:22-07:00
ping_service service 50 running 2019-04-25T11:20:09-07:00
ehimeken in ~/nomad-orchestrator/examples/root-example
○ → nomad job status ping_service
ID = ping_service
Name = ping_service
@Gabelbombe
Gabelbombe / packer-min.json
Last active April 22, 2019 18:46
Minimum IAM policy required by AWS for Packer to do its thing. https://github.com/mitchellh/packer Permissions are broken out by API functionality and a resource array has been defined with a wild card for each group. For tighter security resource level permissions can be applied per this documentation: http://aws.typepad.com/aws/2013/07/resourc…
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "PackerSecurityGroupAccess",
"Action": [
"ec2:CreateSecurityGroup",
"ec2:DeleteSecurityGroup",
"ec2:DescribeSecurityGroups",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:RevokeSecurityGroupIngress"
#!/bin/bash
# Script to clean ECR repos
## Usage:
## ./clean-old-ecr-images.sh <IMAGE-REPO-NAME> <WEEKS-TO-KEEP>
##
## Non-interactive, for running in cron or your C.I.:
## echo "y" | ./clean-old-ecr-images.sh <IMAGE-REPO-NAME> <WEEKS-TO-KEEP>
@Gabelbombe
Gabelbombe / func-newaddr.sh
Last active May 18, 2021 00:39
Rotate your mac on command, or force reiteration with CRONTabbin the SOB.....
## Alter your comps fingerprint..
function rollmac()
{
# Disassociate yourself from the airport binary
# http://osxdaily.com/2007/01/18/airport-the-little-known-command-line-wireless-utility/
! hash airport 2>/dev/null && {
[ -f /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport ] && {
ln -fs /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport /usr/local/bin
} || {
# Dave's not here..
ansible-playbook 2.6.4
config file = /Users/jddaniel/Repositories/Infra/Hashi/Terraform/terraform-jenkins/ansible/ansible.cfg
configured module search path = [u'/Users/jddaniel/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 2.7.15 (default, Jul 23 2018, 21:27:06) [GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)]
Using /Users/jddaniel/Repositories/Infra/Hashi/Terraform/terraform-jenkins/ansible/ansible.cfg as config file
setting up inventory plugins
Parsed /usr/local/bin/terraform-inventory inventory source with script plugin
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python2.7/site-packages/ansible/plugins/callback/default.pyc
export TF_VAR_aws_profile TF_VAR_aws_vpc TF_VAR_aws_net
# An implicit guard target, used by other targets to ensure
# that environment variables are set before beginning tasks
assert-%:
@ if [ "${${*}}" = "" ] ; then \
echo "Environment variable $* not set" ; \
exit 1 ; \
fi
@Gabelbombe
Gabelbombe / ec2-export.sh
Created September 12, 2018 16:45
Export an EC2 instance from CLI
aws --profile {aws_profile} --region {aws_region} \
ec2 create-instance-export-task \
--instance-id {instance_id} \
--target-environment {target_environment} \
--export-to-s3-task DiskImageFormat={disk_image_format},ContainerFormat=ova,S3Bucket={s3_bucket},S3Prefix={s3_prefix}
@Gabelbombe
Gabelbombe / findMissingNums.js
Created June 26, 2018 17:46
Find missing numbers in an array of numbers
// Solution: sort numbers first, then test the offset(s)
// Disclosure: this is not a great idea for 4 billion numbers
// and is completely inefficient
var numArray = [ 2, 3, 1, 5, 7, 10 ];
var findMissingNumbers = function (numArray)
{
var missing = [];
numArray.sort(