Skip to content

Instantly share code, notes, and snippets.

View adkatrit's full-sized avatar
🎯
Focusing

Jarrod Parker adkatrit

🎯
Focusing
View GitHub Profile
/* 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
@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
}
#!/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 '{
package main
import (
"fmt"
"sync"
"github.com/satori/go.uuid"
)
type PGM struct{
Vertices map[uuid.UUID]*Vertex
Edges map[uuid.UUID]*Edge
@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.

@adkatrit
adkatrit / index.html
Created August 19, 2012 20:45
just visualizing some math. looking to add slide bars to see value changes in real time.
<html>
<head>
</head>
<body>
<canvas style="background-color: black" id="canvas" height="1000px" width="1000px" ></canvas>
<div id="controls" ></div>
</body>
</html>
@adkatrit
adkatrit / tumblr-goggles
Last active December 23, 2015 02:39
extract and view any posted images from tumblr
$("body").html("");
(function getPage(cursor){
$.get('/page/'+cursor,function(b){
imgs = $(b).find('img')
imgs.each(function(n){
$("body").append(this)
})
if(imgs.length){
getPage(++cursor)
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.