Skip to content

Instantly share code, notes, and snippets.

View jdowning's full-sized avatar
😇

Justin Downing jdowning

😇
View GitHub Profile
@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 / 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 / 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 / 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}'
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 / confluence-rename-users.sql
Created May 18, 2012 12:46 — forked from ssbarnea/confluence-rename-users.sql
Confluence user renaming PostgreSQL stored procedure.
DECLARE vdir integer;
BEGIN
-- BEGIN;
-- ^not needed for stored procedure
CREATE TABLE IF NOT EXISTS usermigration
(
oldusername character varying(255) NOT NULL,
@jdowning
jdowning / gist:3295929
Created August 8, 2012 15:27 — forked from sstephenson/gist:1120938
Quick guide to installing rbenv
# Clone rbenv into ~/.rbenv
git clone git@github.com:sstephenson/rbenv.git ~/.rbenv
# Add rbenv to your PATH
# NOTE: rbenv is *NOT* compatible with rvm, so you'll need to
# remove rvm from your profile if it's present. (This is because
# rvm overrides the `gem` command.)
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"' >> ~/.bash_profile
exec $SHELL
@jdowning
jdowning / gist:3343404
Created August 13, 2012 19:16
Enable multiverse for Ubuntu Precise 12.04
sudo sed -i "33,36s/^# //g" /etc/apt/sources.list
@jdowning
jdowning / gist:3946896
Created October 24, 2012 15:53
Install Postgresql 9.2 on Ubuntu
aptitude install -y python-software-properties
add-apt-repository -y ppa:pitti/postgresql
aptitude update
aptitude install -y postgresql-9.2 postgresql-server-dev-9.2
@jdowning
jdowning / gist:4156780
Created November 27, 2012 20:24
Twitter Crashing on Mac OSX 10.8.2
Process: Twitter [29188]
Path: /Applications/Twitter.app/Contents/MacOS/Twitter
Identifier: com.twitter.twitter-mac
Version: 2.1.1 (2.1.1)
App Item ID: 409789998
App External ID: 3768515
Code Type: X86-64 (Native)
Parent Process: launchd [223]
User ID: 501