Skip to content

Instantly share code, notes, and snippets.

View kennedyj's full-sized avatar

Josh Kennedy kennedyj

View GitHub Profile
@kennedyj
kennedyj / templater
Created February 19, 2015 20:41
Stupid Simple Jinja2 CLI
#!/usr/bin/env python
import argparse
import jinja2
import json
import sys
"""
read a template from stdin or a file, load variables from json or as an
argument, and then output to file or stdout
"""
@kennedyj
kennedyj / guided.json
Created February 18, 2015 23:57
Kibana 3 Guided Dashboard
{
"title": "Your Basic Dashboard",
"services": {
"query": {
"list": {
"0": {
"query": "*",
"alias": "",
"color": "#7EB26D",
"id": 0,
@kennedyj
kennedyj / check_domain.pl
Created April 22, 2014 17:04
Nagios Domain Checks
#!/bin/bash
####################################################
# script to check domain name experation time.
# it works only on UNIX system
# you need to install whois on system
# yum install whois - for centos OS
#
#
#
####################################################
@kennedyj
kennedyj / list-volumes.py
Last active August 29, 2015 14:00
List docker volumes
#!/usr/bin/python
# e.g. docker ps -a | grep 'my name' | awk '{print $1}' | xargs docker inspect | ./volume-list.py
import json
import fileinput
raw = []
for line in fileinput.input():
raw.append(line)
data = json.loads(''.join(raw))
@kennedyj
kennedyj / check_apache_certs.sh
Last active August 29, 2015 13:58
Check local apache certs
#! /bin/bash
#
# Usage: ./check_apache_certs -p apachepath
#
CUT=$(which cut)
SED=$(which sed)
GREP=$(which grep)
AWK=$(which awk)
SORT=$(which sort)
@kennedyj
kennedyj / keybase.md
Created April 1, 2014 17:33
Publicly proving my github account with keybase.

Keybase proof

I hereby claim:

  • I am kennedyj on github.
  • I am jkennedy (https://keybase.io/jkennedy) on keybase.
  • I have a public key whose fingerprint is DF79 A235 C9C2 4CDD 5936 2A1C D60A 5FBF 2421 4A84

To claim this, I am signing this object:

@kennedyj
kennedyj / vim-golang.sh
Created February 10, 2014 18:57
Install Golang Vim files on OS X
mkdir -p $HOME/.vim/ftplugin/go
mkdir -p $HOME/.vim/ftdetect
mkdir -p $HOME/.vim/syntax
mkdir -p $HOME/.vim/autoload/go
# make sure GOROOT is properly set, brew example
# GOROOT == /usr/local/Cellar/go/1.2/
cd $GOROOT/misc/vim
find . -type f -exec cp {} $HOME/.vim/{} \;
@kennedyj
kennedyj / prune.sh
Created January 16, 2014 22:53
prune unused docker images
#!/bin/bash
# Get in use image tags
docker ps | grep -v 'IMAGE' | awk '{ print $2}' > tags-inuse.txt
# Get all images with tags, combine the image and tag keep the id
docker images -a | grep -v 'REPOSITORY' | grep -v '^<none>' | awk '{print $1":"$2"\t"$3}' > tags-full.txt
# Remove the in-use tags from the full list
grep -v -f tags-inuse.txt tags-full.txt > tags-prune-list.txt
@kennedyj
kennedyj / docker-mem.sh
Last active January 2, 2016 18:39
See memory being used by a docker container
#!/bin/bash
getmem() {
name=$1
image=$(docker ps | grep $name | awk '{print $2}')
short=$(docker ps | grep $name | awk '{print $1}')
long=$(docker inspect $short | grep ID | awk '{print $2}' | sed 's~[",]~~g')
rss=$(grep total_rss /sys/fs/cgroup/memory/lxc/$long/memory.stat | awk '{print $2}')
@kennedyj
kennedyj / profile-wallet.sh
Created August 6, 2013 17:34
Change wallet database for acrylic apps wallet on mac. http://www.acrylicapps.com/wallet/mac/
#!/bin/bash
# setup path to the applications expected path
export wallet_db="/Users/$(whoami)/Library/Containers/com.acrylic.Wallet/Data/Library/Application Support/Wallet/Database.wallet"
# configure any wallets to be used. each item in the list must also have a variable that matches
# ie: personal wallet_personal_db
export wallet_db_list=( personal group other )
export wallet_personal_db="/Users/$(whoami)/Wallets/Personal.wallet"