Skip to content

Instantly share code, notes, and snippets.

View kzap's full-sized avatar
🏠
Working from home

Andre Marcelo-Tanner kzap

🏠
Working from home
View GitHub Profile
@kzap
kzap / terraform-app.sh
Created June 28, 2016 15:54
Wrapper for terraform that lets you specify an environment and calls an $ENV.tfvars file, uses a $ENV.tfstate file and sets the env variable
#!/bin/bash
#
# terraform-app
#
# This to terraform the servers for the Galleon App
# By storing the date now, we can calculate the duration of provisioning at the
# end of this script.
start_seconds="$(date +%s)"
@kzap
kzap / module.tf
Last active August 8, 2019 21:31
Terraform: How to pass map to module
variable "region" {
default = "tr2"
description = "The region of openstack, for image/flavor/network lookups."
}
variable "image" {
default = {
tr2 = "eee08821-c95a-448f-9292-73908c794661"
tr2-1 = ""
RegionOne = "WRONG VALUE"
@kzap
kzap / gist:5819745
Last active May 27, 2020 23:09
If you want to give only Travis-CI access to a private key or secret file in your repository, you will need to encrypt it, but rather than storing the entire encrypted file in an environment variable, just store the a secret password in a secure environment variable that you will use to encrypt and decrypt your private key file. The encryption o…
# generate your private key, put the public key on the server you will be connecting to
ssh-keygen -t rsa -f ./my_key
# generate the password/secret you will store encrypted in the .travis.yml and use to encrypt your private key
cat /dev/urandom | head -c 10000 | openssl sha1 > ./secret
# encrypt your private key using your secret password
openssl aes-256-cbc -pass "file:./secret" -in ./my_key -out ./my_key.enc -a
# download your Travis-CI public key via the API. eg: https://api.travis-ci.org/repos/travis-ci/travis-ci/key
@kzap
kzap / create-lvm.sh
Created June 26, 2015 02:28
LVM Script
echo RTFM >&2;
exit -1;
N=1
yum install -y lvm2
D=$(grep "unknown partition table" /var/log/messages | tail -n 1 | perl -pe 's/.*: ([^:]*): unknown.*/$1/g');
D=/dev/$D
pvcreate $D
vgcreate vg_$N $D
S=$(vgdisplay vg_$N | grep Total | perl -pe 's/[^0-9]+//g')
@kzap
kzap / dashboard.json
Created April 29, 2020 08:04
Grafana K8s Resources CPU w/ Throttle Dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",