Skip to content

Instantly share code, notes, and snippets.

aws s3 sync --dryrun s3://$1/ $PWD --sse aws:kms
@atrakic
atrakic / gh-dl-release
Created February 15, 2018 12:45 — forked from maxim/gh-dl-release
Download assets from private Github releases
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
https://aws.amazon.com/blogs/compute/the-reinvent-2017-containers-after-party-guide/
@atrakic
atrakic / ansible_conditionals_examples.yaml
Created April 5, 2018 13:20 — forked from marcusphi/ansible_conditionals_examples.yaml
Ansible 1.3 Conditional Execution -- Very complete example with comments -- I find the conditional expressions to be ridiculously hard to get right in Ansible. I don't have a good model of what's going on under the surface so I often get it wrong. What makes it even harder is that there has been at least three different variants over the course …
---
# This has been tested with ansible 1.3 with these commands:
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts"
# NB: The type of the variable is crucial!
- name: Ansible Conditionals Examples
hosts: $hosts
vars_files:
curl -s https://api.github.com/users/atrakic/repos?per_page=200 | python -c $'import json, sys, os\nfor repo in json.load(sys.stdin): os.system("git clone " + repo["ssh_url"])'
cd k8s-specs
git pull
export AWS_ACCESS_KEY_ID=[...]
export AWS_SECRET_ACCESS_KEY=[...]
aws --version
<section data-transition='concave'>
<section id='local-kubernetes-environments-with-minikube'>
<a href="https://github.com/kubernetes/minikube"><img style="width:30%;" src="https://raw.githubusercontent.com/kubernetes/minikube/master/logo/logo.png" /></a>
<h2>Local Kubernetes Environments</h2>
<h3>with <a href="https://github.com/kubernetes/minikube"><code>minikube</code></a></h3>
<br/>
<h4 class='fragment grow'><a href="http://bit.ly/k8s-minikube"><code>bit.ly/k8s-minikube</code></a></h4>
</section>
<section data-background-transition='fade' data-background='black' id='presented-by-ryanj'>
<p>presented by <a href="http://twitter.com/ryanj/">@ryanj</a>, Developer Advocate at <a href='http://redhat.com' style='color:red;'>Red Hat</a></p>
#!/bin/bash
USER=${1:-atrakic}
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-)
PAGES=$((658/100+1))
echo You have $STARS starred repositories.
echo
PER_PAGE=10
PAGES=$((658/$PER_PAGE+1))
@atrakic
atrakic / remove-untagged-images-for-ecr
Created August 27, 2018 11:49 — forked from tsub/remove-untagged-images-for-ecr
Remove untagged images for ECR
#!/bin/sh
set -eu
type aws > /dev/null 2>&1 && type jq > /dev/null 2>&1 || {
echo 'Required aws-cli and jq'
exit 1
}
repositories=$(aws ecr describe-repositories --query 'repositories[*].repositoryName' | tr -d "[\",\t\n\r\"]")
@atrakic
atrakic / bash.generate.random.alphanumeric.string.sh
Created September 4, 2018 09:25 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1