Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Jarrod Parker adkatrit

🎯
Focusing
  • enigma.com
  • New York, New York
Block or report user

Report or block adkatrit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adkatrit
adkatrit / .block
Last active Oct 30, 2017
Histogram II
View .block
license: gpl-3.0
@adkatrit
adkatrit / genie-heartbeat.sh
Last active Aug 23, 2017
Genie Job Heartbeat
View genie-heartbeat.sh
# 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>
View 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.

View gist:a8e0324bdb8f5907e5ee
package main
import (
"fmt"
"sync"
"github.com/satori/go.uuid"
)
type PGM struct{
Vertices map[uuid.UUID]*Vertex
Edges map[uuid.UUID]*Edge
View elastic-indexing.sh
#!/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 Mar 22, 2014
Internet detection via say
View internet_alert.sh
#Usage: netz google.com
function netz(){
while :; do ping -W1 -c1 -n $1 > /dev/null && say "internet alert"; sleep 1; done
}
View sigma.min.js
/* 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
View 23096.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View 19694.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View 7619.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.