Skip to content

Instantly share code, notes, and snippets.

View evanscottgray's full-sized avatar
🤠
herding cats

Evan Gray evanscottgray

🤠
herding cats
View GitHub Profile
@evanscottgray
evanscottgray / client.js
Last active August 29, 2015 14:19 — forked from mklabs/client.js
var nopt = require('nopt'),
parse = require('url').parse,
WebSocket = require('faye-websocket');
//
// All based and derived on: http://www.igvita.com/2012/04/09/driving-google-chrome-via-websocket-api
//
// The remote debugging protocol is... I don't have words right now.
// Other than thanks thanks thanks thanks x10e901920
var Chrome = require('chrome-remote-interface');
Chrome(function (chrome) {
with
(chrome) {
var url = 'http://example.com';
var params = {
'expression': 'for (var i = 0; i < 10; i++)' +
'window.open("' + url + '", "_blank");'
};
Runtime.evaluate(params, function (error, response) {
---
- name: Stop all running logspout containers
shell: "docker ps | sed -e '1d' | grep logspout | awk {'print $1'} | xargs docker stop || :"
ignore_errors: yes
when: force_pull
- name: delete all Logspout containers
shell: "docker ps -a | grep logspout | awk '{print $1}' | xargs docker rm -f || :"
ignore_errors: yes
when: force_pull
@evanscottgray
evanscottgray / wow.txt
Created March 9, 2015 21:53
many terabytes
[root@shinystorage tank]# zpool iostat tank
capacity operations bandwidth
pool alloc free read write read write
---------- ----- ----- ----- ----- ----- -----
tank 14.2G 18.1T 0 126 0 15.4M
[root@shinystorage tank]# zpool status tank -v
pool: tank
body {
background: black !important;
color: white !important;
}
span {
background: black;
color: white !important;
}
@evanscottgray
evanscottgray / short.rb
Created February 21, 2015 01:16
link short
require 'sinatra'
require 'redis'
require 'json'
require 'securerandom'
get '/l/:token' do
redis = Redis.new
token_contents = redis.get(params[:token])
if token_contents
redirect token_contents
@evanscottgray
evanscottgray / so_much_dict.py
Created February 18, 2015 20:54
subclass dict
class FileCache(dict):
def __init__(self, *args, **kwargs):
self._filename = kwargs.pop('filename', None)
dict.__init__(self, *args, **kwargs)
def __missing__(self, key):
if self._filename:
with open(self._filename, 'r') as f:
self.update(json.load(f))
@evanscottgray
evanscottgray / portfinders.zsh
Created January 14, 2015 00:52
put this in your $shellrc and enjoy
# Find ALL the port users. _o/
findbyport() {
lsof -nP | grep ":$@" | awk '{print "Program: " $1 "\n" "PID: "$2 "\n" "User: " $3 "\n" "Address: "$9 "\n" "Action: " $10}'
}
portsinuse() {
lsof -nP | grep "IPv" | while read line; do echo $line | awk '{print "Program: " $1 "\n" "PID: "$2 "\n" "User: " $3 "\n" "Address: "$9 "\n" "Action: " $10}'; echo; done;
}
function getProgress() {
$.ajax({
dataType: "json",
url: '/progress'
})
.done(function (data) {
var total = data.total;
var current = data.current;
var percentage = (current / total * 100);
$('.progress .progress-bar').width(percentage + '%');
@evanscottgray
evanscottgray / rackspace_config.rb
Created December 28, 2014 00:19
fog paperclip wow rackspace cloud files
RACKSPACE_CONFIG = {
'production' => {
path: '',
storage: :fog,
fog_credentials: {
provider: 'Rackspace',
rackspace_username: ENV['RACKSPACE_USERNAME'],
rackspace_api_key: ENV['RACKSPACE_API_KEY'],
persistent: false
},