This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TLE = | |
(function () { | |
function isCorrupted(line) { | |
var checksum = parseInt(line[line.length-1]); | |
var computedChecksum = line.slice(0,line.length-1) | |
.replace(/[\-\-]/g,"1") | |
.replace(/[a-zA-Z\.+\s]/g,"") | |
.split("") | |
.map(function(digit) { return parseInt(digit) }) | |
.reduce(function(prev, current) {return prev + current;}, 0) % 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<title>Network | Images</title> | |
<head> | |
<link href="http://visjs.org/dist/vis.css" rel="stylesheet" type="text/css" /> | |
<script src="http://visjs.org/dist/vis.js"></script> | |
<script type="text/javascript"> | |
function draw() { | |
var nodes = [ | |
{id: 1, label: 'SLR1', group: 'source', value: 10}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import uniform | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from random import sample | |
n = 200 # number of cells in row | |
num_iters = 200 # number of iterations | |
density = 0.5 # how many positives | |
# rule 184 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createField(width, height) { | |
var field = new Uint8Array(width * height); | |
var fcenterX = Math.floor(width / 2); | |
var fcenterY = Math.floor(height / 2); | |
// center occupied | |
field[fcenterX + fcenterY * width] = 1; | |
return { field: field, width:width, height:height}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import snap | |
# requires python 2.7 and 64-bit machine | |
G1 = snap.TUNGraph.New() | |
with open("data/edges.csv") as f: | |
for line in f: | |
tokens = line.split() | |
n1, n2, weight = int(tokens[0]), int(tokens[1]), int(tokens[2]) | |
if not G1.IsNode(n1): | |
G1.AddNode(n1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import uniform, shuffle | |
import matplotlib.pyplot as plt | |
import numpy as np | |
L = 500 # number of cells in row | |
num_iters = 500 # number of iterations | |
density = 0.48 # how many positives | |
vmax = 2 | |
p = 0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from skimage import io, color | |
from scipy.ndimage.measurements import label, sum | |
from skimage.morphology import convex_hull_image | |
def main(): | |
if len(sys.argv) < 4: | |
print("Input format: <filename> <minimum size of detected shape in pixels> <threshold between 0 and 1>") | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Diffusion-Limited aggregation</title> | |
<meta name="description" content="Diffusion-Limited aggregation"> | |
<meta name="author" content="Michal Drzal"> | |
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"> | |
<script src="dla.js"></script> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Data; | |
using System.Data.OleDb; | |
using System.IO; | |
namespace Importers | |
{ | |
public class DBFImporter | |
{ | |
public static DataTable ExtractDataTable(string filePath) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shuffle(o){ | |
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); | |
return o; | |
} | |
function cellular1d(width, height, density, rule) { | |
var blackPixelsCount = Math.floor(width*density), whitePixelsCount = width - blackPixelsCount; | |
var initial = []; | |
while(blackPixelsCount--) { |
OlderNewer