Skip to content

Instantly share code, notes, and snippets.

View jdowning's full-sized avatar
😇

Justin Downing jdowning

😇
View GitHub Profile
OAuth = require('oauth').OAuth
_ = require 'underscore'
class LinkedInClient
@baseUrl: 'https://api.linkedin.com'
@requestTokenUrl: "#{@baseUrl}/uas/oauth/requestToken"
@accessTokenUrl: "#{@baseUrl}/uas/oauth/accessToken"
@authorizeUrl: "#{@baseUrl}/uas/oauth/authorize"
@profileFields: ['id', 'headline', 'first-name', 'last-name', 'public-profile-url', 'picture-url', 'educations', 'positions', 'email-address']
@jdowning
jdowning / mc-stat.sh
Created July 23, 2014 21:24
Memcached Stats
#!/bin/sh
(echo stats; sleep 0.1) | telnet localhost 11211 2>&1 | awk '/STAT $1/ {print $NF}'
@jdowning
jdowning / cra.sh
Last active August 29, 2015 14:02
Update cluster.routing.allocation.enable in Elasticsearch
#!/bin/bash -e
if [[ "$1" == "all" || "$1" == "none" ]]; then
echo -n -e "Setting cluster.routing.allocation.enable to \e[0;33m${1}\e[0m..."
resp=$(curl -s -XPUT localhost:9200/_cluster/settings?pretty -d "{\"transient\":{\"cluster.routing.allocation.enable\":\"${1}\"}}" | awk -F: '/acknowledged/ {print $2}')
if [[ "$resp" == " true," ]]; then
echo "Done!"
else
echo "Failed!"
echo $resp
exit 1
@jdowning
jdowning / swappy.sh
Created May 28, 2014 20:08
Swappy :: Calculate swap usage for each PID in Linux
#!/usr/bin/env bash
## Usage: swappy [-t|--total]
## Identify the processes that use swap
# Usage
test "$1" = "-h" -o "$1" = "--help" && {
grep '^##' <"$0" | cut -c4-
exit 2
}
@jdowning
jdowning / list-series.sh
Created May 9, 2014 19:31
InfluxDB 'list series' function
list-series () {
curl -s "localhost:8086/db/statsd/series?u=root&p=root&q=list+series" | python -mjson.tool | awk "/${1}/ {print \$2}" | sed -E 's/(\"|,)//g' | sort
}
@jdowning
jdowning / hosts
Created October 10, 2013 16:56
Run an `mtr --report` on a list of hosts and email the results
google.com
yahoo.com
amazon.com
@jdowning
jdowning / Puppetfile
Created August 26, 2013 18:24
PostgreSQL Cluster for Vagrant
forge "http://forge.puppetlabs.com"
mod "puppetlabs/apt"
mod "puppetlabs/ntp"
mod "puppetlabs/stdlib"
mod "puppetlabs/postgresql"
@jdowning
jdowning / ami-clean.sh
Last active December 26, 2023 20:09
Script to clean up Ubuntu EC2 instance before packaging as an AMI
#!/bin/bash
# This script cleans up your EC2 instance before baking a new AMI.
# Run the following command in a root shell:
#
# bash <(curl -s https://gist.github.com/justindowning/5921369/raw/ami-clean.sh)
function print_green {
echo -e "\e[32m${1}\e[0m"
}
@jdowning
jdowning / vagrant-clean.sh
Last active December 13, 2021 06:59
Script to clean up Ubuntu Vagrant box before packaging
#!/bin/bash
# This script zeroes out any space not needed for packaging a new Ubuntu Vagrant base box.
# Run the following command in a root shell:
#
# bash <(curl -s https://gist.github.com/justindowning/5670884/raw/vagrant-clean.sh)
function print_green {
echo -e "\e[32m${1}\e[0m"
}
@jdowning
jdowning / github-status.coffee
Last active December 12, 2015 03:48
Hubot script for GitHub Status
# Description:
# Get GitHub status
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands: