Skip to content

Instantly share code, notes, and snippets.

View voronoipotato's full-sized avatar

Alan Ball voronoipotato

  • NC
View GitHub Profile
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
@voronoipotato
voronoipotato / badsql
Created May 4, 2012 04:24 — forked from thedanielmiller/badsql
horrible sql
BEGIN
IF age < 7 AND clean = 'Poor' OR 'FAIR' THEN
UPDATE flight_info SET cleaning = 'Y';
ELSE
UPDATE flight_info SET cleaning = 'N';
END IF;

The range sliders at the top change the values for the force-directed algorithm and the buttons load new graphs and apply various techniques. This will hopefully serve as a tool for teaching network analysis and visualization principles during my Gephi courses and general Networks in the Humanities presentations.

Notice this includes a pretty straightforward way to load CSV node and edge lists as exported from Gephi.

It also includes a pathfinding algorithm built for the standard data structure of force-directed networks in D3. This requires the addition of .id attributes for the nodes, however.

Now with Clustering Coefficients!

Also, it loads images for nodes but the images are not in the gist. The code also refers to different network types but the data files on Gist only refer to the transportation network.

@voronoipotato
voronoipotato / tmux-cheatsheet.markdown
Created January 14, 2016 16:19 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@voronoipotato
voronoipotato / latency.txt
Created February 16, 2016 21:22 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@voronoipotato
voronoipotato / introrx.md
Created August 18, 2016 14:31 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@voronoipotato
voronoipotato / EventStoreConnectionExtensions.cs
Created April 24, 2017 17:46 — forked from jen20/EventStoreConnectionExtensions.cs
Quick and dirty way to hook up RX to an Event Store subscription. Emphasis on "quick" and "dirty".
static class EventStoreConnectionExtensions
{
public static Task<EventStoreRxSubscription> SubscribeToAll(this EventStoreConnection connection, bool resolveLinkTos)
{
return Task<EventStoreRxSubscription>.Factory.StartNew(() => {
var subject = new Subject<ResolvedEvent>();
var subscriptionTask = connection.SubscribeToAll(resolveLinkTos, subject.OnNext, () => subject.OnError(new SubscriptionDroppedException()));
subscriptionTask.Wait();
@voronoipotato
voronoipotato / fizzbuzz_in_DBN.fsx
Created September 26, 2017 20:56 — forked from paralax/fizzbuzz_in_DBN.fsx
i ported that "fizzbuzz in tensorflow" to F# and Accord.Net's DeepBeliefNetwork
// i ported that "fizzbuzz in tensorflow" to F# and Accord.Net's DeepBeliefNetwork
// http://joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/
#r "Debug/Accord.dll"
#r "Debug/Accord.Math.dll"
#r "Debug/Accord.Neuro.dll"
#I "Debug"
open Accord.Neuro
open Accord.Neuro.Networks
@voronoipotato
voronoipotato / base64-web-safe.js
Created January 23, 2018 19:38 — forked from geraintluff/base64-web-safe.js
Convert base64 to and from web-safe variant
// Convert from normal to web-safe, strip trailing "="s
function webSafe64(base64) {
return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
}
// Convert from web-safe to normal, add trailing "="s
function normal64(base64) {
return base64.replace(/\-/g, '+').replace(/_/g, '/') + '=='.substring(0, (3*base64.length)%4);
}