Skip to content

Instantly share code, notes, and snippets.

View gkze's full-sized avatar
🛠️
perpetually tinkering

George Kontridze gkze

🛠️
perpetually tinkering
View GitHub Profile
@gkze
gkze / frost.sh
Created July 16, 2013 18:28
Stephen Frost's crazy one-liner
#!/bin/bash
for host in *; do NAME=`echo $host | cut -f1 -d.`; DOMAIN=`echo $host | cut -f2 -d.`; IPMI="$NAME.ipmi.$DOMAIN.resonatedigital.net"; IP=`host $IPMI | cut -f4 -d' '`; if [ "$IP" != "found:" ]; then cat TEMPLATE.cfg | sed -e "s:NAME:$NAME.ipmi.$DOMAIN:" -e "s:IPADDRESS:$IP:" -e 's:rsnt_iad_linux_physical_hadoop:rsnt_iad_oob_ipmi:' -e 's:generic-rsnt-iad-linux-host:generic-rsnt-iad-host:' | grep -v 'register' > ../../../oob/ipmi/$NAME.ipmi.$DOMAIN.cfg; fi; done
@gkze
gkze / kern_clean.sh
Created March 6, 2014 05:05
Dirty dirty way to clean your old kernel images
# Do no try this at home kids
dpkg -l | grep -E 'linux-(image|headers)' | grep -v $(uname -r|sed 's:-generic::g') | awk '{print $2}' | xargs apt-get -y remove
@gkze
gkze / stars
Last active August 29, 2015 14:01
seq 25 | xargs -P25 -I{} zsh -c "http get https://api.github.com/user/starred\?per_page\=100\&page\={} | jq -r '.[]|[.pushed_at,.stargazers_count,.language,.html_url,.description]|@csv' &" | sort -Vu > /tmp/stars.csv
@gkze
gkze / pig.py
Created August 8, 2014 08:41
Pig latin
def pig(string):
return ' '.join(map(lambda x: x + 'ay' if x in 'aeiou' else x[1:] + x[:1] + 'ay', string.split()))
#!/bin/bash
echo "Install the necessary tools"
sudo apt-get -y install make flex bison libtool libevent-dev automake pkg-config libssl-dev libboost-all-dev libbz2-dev build-essential g++ python-dev git
echo "git cloning Thrift"
git clone https://github.com/apache/thrift.git
pushd thrift
@gkze
gkze / log.sh
Last active August 29, 2015 14:11
Colored logging in bash
#!/bin/bash
# Exit on error
set -e
# Logging utility
log() {
# Escape codes for colored output
C_GREEN="\033[32m"
C_NORMAL="\033[0m"
C_RED="\033[31m"
variable "aws_access_key" {}
variable "aws_secret_key" {}
provider "aws" {
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
region = "us-east-1"
}
resource "aws_vpc" "terraform-testing" {
@gkze
gkze / members.py
Last active August 29, 2015 14:16
Consul members in JSON
import json
import re
import subprocess
def get_data():
patt = re.compile("[^\s]+")
p = subprocess.Popen(['consul', 'members', '-detailed'], shell=False, stdout=subprocess.PIPE)
d, _ = p.communicate()
@gkze
gkze / crash.log
Created July 7, 2015 18:01
Terraform crashing when deleting "aws_route" resource
2015/07/07 17:56:59 [INFO] Terraform version: 0.6.0 dev e19304a783bda4babd381a8459ecc5de06476e22+CHANGES
2015/07/07 17:56:59 Detected home directory from env var: /home/vagrant
2015/07/07 17:56:59 [DEBUG] Discovered plugin: atlas = /opt/gopath/src/github.com/hashicorp/terraform/bin/terraform-provider-atlas
2015/07/07 17:56:59 [DEBUG] Discovered plugin: aws = /opt/gopath/src/github.com/hashicorp/terraform/bin/terraform-provider-aws
2015/07/07 17:56:59 [DEBUG] Discovered plugin: azure = /opt/gopath/src/github.com/hashicorp/terraform/bin/terraform-provider-azure
2015/07/07 17:56:59 [DEBUG] Discovered plugin: cloudflare = /opt/gopath/src/github.com/hashicorp/terraform/bin/terraform-provider-cloudflare
2015/07/07 17:56:59 [DEBUG] Discovered plugin: cloudstack = /opt/gopath/src/github.com/hashicorp/terraform/bin/terraform-provider-cloudstack
2015/07/07 17:56:59 [DEBUG] Discovered plugin: consul = /opt/gopath/src/github.com/hashicorp/terraform/bin/terraform-provider-consul
2015/07/07 17:56:59 [DEBUG] Discovered plug
require 'formula'
class CBTerraform < Formula
desc "Chartboost monkey-patched Terraform with the aws_route resource"
homepage "https://terraform.io"
url "https://s3.amazonaws.com/chartboost/ops/tools/terraform_0.6.1-dev_dawrin_amd64.tar.gz"
sha256 "eead54352cd136c90e1780d496e3a0dfbd89ab5f9283f4d4e8c2808a39aad836"
head "https://github.com/gkze/terraform.git", :branch => "master"
end