Skip to content

Instantly share code, notes, and snippets.

View mikemaccana's full-sized avatar

Mike MacCana mikemaccana

View GitHub Profile
@mikemaccana
mikemaccana / gist:5531683
Created May 7, 2013 10:25
Vanilla JS: select an option in a select box by value
// Required for 7000+ option select box used in EC2 UI that has no search
NodeList.prototype.forEach = Array.prototype.forEach
var requiredValue = 'snap-d1d0a88a'
var selectBox = document.querySelector('select')
selectBox.childNodes.forEach(function(element, index){
if ( element.value === requiredValue ) {
console.log('Found! Index is ', index)
selectBox.selectedIndex = index
}
#!/bin/bash
# herein we backup our indexes! this script should run at like 6pm or something, after logstash
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas,
# compress the data files, create a restore script, and push it all up to S3.
TODAY=`date +"%Y.%m.%d"`
INDEXNAME="logstash-$TODAY" # this had better match the index name in ES
INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/"
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put"
BACKUPDIR="/mnt/es-backups/"
YEARMONTH=`date +"%Y-%m"`
@mikemaccana
mikemaccana / gist:4170134
Created November 29, 2012 16:24
jshint on current production JQuery UI from front page of website (despite filename its just the production version).
: jshint Downloads/jquery-ui-1.9.2.custom\ 2/js/jquery-ui-1.9.2.custom.js
Downloads/jquery-ui-1.9.2.custom 2/js/jquery-ui-1.9.2.custom.js: line 186, col 9, Expected an assignment or function call and instead saw an expression.
Downloads/jquery-ui-1.9.2.custom 2/js/jquery-ui-1.9.2.custom.js: line 358, col 46, Use '!==' to compare with 'null'.
Downloads/jquery-ui-1.9.2.custom 2/js/jquery-ui-1.9.2.custom.js: line 918, col 52, Expected an assignment or function call and instead saw an expression.
Downloads/jquery-ui-1.9.2.custom 2/js/jquery-ui-1.9.2.custom.js: line 970, col 24, Confusing use of '!'.
Downloads/jquery-ui-1.9.2.custom 2/js/jquery-ui-1.9.2.custom.js: line 982, col 80, Expected an assignment or function call and instead saw an expression.
Downloads/jquery-ui-1.9.2.custom 2/js/jquery-ui-1.9.2.custom.js: line 1581, col 82, Use '===' to compare with 'null'.
Downloads/jquery-ui-1.9.2.custom 2/js/jquery-ui-1.9.2.custom.js: line 2621, col 23, Use '!==' to compare with 'null'.
Downloads/jquery-ui-1.9.2.cust