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
/* | |
Parses the long_abstracts format: | |
<http://dbpedia.org/resource/Anarchism> <http://dbpedia.org/ontology/abstract> "Anarchism is a collection of movements and ideologies that ..."@en . | |
*/ | |
import org.openrdf.rio.* | |
import org.openrdf.rio.helpers.* | |
def parse(line, factory) { | |
def reader = new StringReader(line); |
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
/*! | |
* color conversion | |
* | |
* Copyright (c) 2014 Tobias Lindig, Germany | |
* http://tlindig.de | |
* License: MIT | |
*/ | |
var __rgx_strictRgbX = /^(?:rgb|rgba)\s*\(\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(?:,\s*([0|1]|0?\.\d+))?\s*\)/i; // don't accept % values | |
var __rgx_isHex = /^#/; | |
var __rgx_hex3 = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; |
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 style="margin: 0; padding: 0; border: 0; width: 100%; height: 100%;"> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<body style="margin: 0; padding: 0; border: 0; width: 100%; height: 100%;"> | |
<canvas style="display: block; width: WIDTHpx; height: HEIGHTpx;" width="WIDTH" height="HEIGHT"></canvas> | |
<script> | |
// shim... | |
var a = canvas; |
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 urllib | |
import datetime as dt | |
import pytz | |
from PIL import Image | |
import numpy as np | |
import subprocess | |
import socket | |
import os | |
dir = '/FULL/PATH/TO/SCRIPT/DIR' |
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
fractalModule =function(stdlib){ | |
"use asm"; | |
var pow = stdlib.Math.pow; | |
var abs = stdlib.Math.abs; | |
var atan2 = stdlib.Math.atan2; | |
var cos = stdlib.Math.cos; | |
var sin = stdlib.Math.sin; | |
function mandlebrot(cx, cy, maxIter) { | |
cx = +cx; | |
cy = +cy; |
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 u() { | |
requestAnimationFrame(u); | |
g = p ? | |
audio.currentTime * 60 : ( | |
audio = "RIFFdataWAVEfmt " + atob("EAAAAAEAAQAAeAAAAHgAAAEACAA") + "data", | |
b.style.background = "radial-gradient(circle,#345,#000)", | |
b.style.position = "fixed", | |
b.style.height = b.style.width = "100%", |
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
# Tests for antialiasing a high-frequency image in various ways | |
# Nathan Reed, July 2014 | |
# Written for Python 3.4; requires numpy and Pillow to be installed | |
import concurrent.futures | |
import math | |
import multiprocessing | |
import numpy as np | |
import optparse | |
import random |
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
// http://www.evanmiller.org/how-not-to-sort-by-average-rating.html | |
// http://gist.github.com/raw/63002/b53853727856bad494dcbb7ffed4fc17f289af92/gistfile1.rb | |
// $z is the pnormaldist with power = 0.05. I.e., pnormaldist(1-power/2) | |
function score($pos, $n) { | |
if ($n == 0) { return 0; } | |
$z = 1.95996397158435; | |
$phat = 1.0*$pos/$n; | |
return ($phat + $z*$z/(2*$n) - $z * sqrt(($phat*(1-$phat)+$z*$z/(4*$n))/$n))/(1+$z*$z/$n); | |
} |
OlderNewer