Skip to content

Instantly share code, notes, and snippets.

View adkatrit's full-sized avatar
🎯
Focusing

Jarrod Parker adkatrit

🎯
Focusing
View GitHub Profile
@adkatrit
adkatrit / .block
Last active October 30, 2017 16:35
Histogram II
license: gpl-3.0
@adkatrit
adkatrit / genie-heartbeat.sh
Last active August 23, 2017 14:57
Genie Job Heartbeat
# requires jq, curl
# genie_job_status <HOST> <JOB_ID>
genie_job_status(){
GENIE_HOST=$1;
GENIE_JOB_ID=$2;
curl --silent "$GENIE_HOST/api/v3/jobs?size=100" | jq -rc '._embedded.jobSearchResultList[] | [.id,.status]' | grep $GENIE_JOB_ID;
}
# job_heartbeat <HOST> <JOB_ID> <BEEP INTERVAL IN SECONDS>
@adkatrit
adkatrit / README.md
Last active August 29, 2015 14:20 — forked from jonhoo/README.md

Distributed Read-Write Mutex in Go

The default Go implementation of sync.RWMutex does not scale well to multiple cores, as all readers contend on the same memory location when they all try to atomically increment it. This gist explores an n-way RWMutex, also known as a "big reader" lock, which gives each CPU core its own RWMutex. Readers take only a read lock local to their core, whereas writers must take all locks in order.

package main
import (
"fmt"
"sync"
"github.com/satori/go.uuid"
)
type PGM struct{
Vertices map[uuid.UUID]*Vertex
Edges map[uuid.UUID]*Edge
#!/bin/bash
INDEX="corp-reg"
ES_SOCKET="10.0.1.109:9200"
#Create index
curl -XPUT "$ES_SOCKET/$INDEX/"
#replicas
curl -XPUT "$ES_SOCKET/$INDEX/_settings" -d '{
@adkatrit
adkatrit / internet_alert.sh
Created March 22, 2014 03:32
Internet detection via say
#Usage: netz google.com
function netz(){
while :; do ping -W1 -c1 -n $1 > /dev/null && say "internet alert"; sleep 1; done
}
/* sigmajs.org - an open-source light-weight JavaScript graph drawing library - Version: 0.1 - Author: Alexis Jacomy - License: MIT */
var sigma={tools:{},classes:{},instances:{}};
(function(){if(!Array.prototype.some)Array.prototype.some=function(i,n){var g=this.length;if("function"!=typeof i)throw new TypeError;for(var j=0;j<g;j++)if(j in this&&i.call(n,this[j],j,this))return!0;return!1};if(!Array.prototype.forEach)Array.prototype.forEach=function(i,n){var g=this.length;if("function"!=typeof i)throw new TypeError;for(var j=0;j<g;j++)j in this&&i.call(n,this[j],j,this)};if(!Array.prototype.map)Array.prototype.map=function(i,n){var g=this.length;if("function"!=typeof i)throw new TypeError;
for(var j=Array(g),m=0;m<g;m++)m in this&&(j[m]=i.call(n,this[m],m,this));return j};if(!Array.prototype.filter)Array.prototype.filter=function(i,n){var g=this.length;if("function"!=typeof i)throw new TypeError;for(var j=[],m=0;m<g;m++)if(m in this){var t=this[m];i.call(n,t,m,this)&&j.push(t)}return j};if(!Object.keys)Objec
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.