Skip to content

Instantly share code, notes, and snippets.

View binarymax's full-sized avatar
👻
for(;1;){work();eat();rest();}

Max Irwin binarymax

👻
for(;1;){work();eat();rest();}
View GitHub Profile
@mikedias
mikedias / script-input-format-wikipedia-rdf.groovy
Created March 11, 2016 13:53
ScritpInputFormat for wikipedia RDF format
/*
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);
@tlindig
tlindig / colorConversion.js
Last active November 21, 2016 16:24
Functions to convert color values. rgb/rgba, hex and hsv/hsva programmatic. Color keyword, hsl/hsla and rgb with percentage values with help of browser.
/*!
* 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;
@pvdz
pvdz / gist:3cccc4f36c8319e09bb7
Created January 29, 2015 20:18
JS1k 2015 bare shim. This is loaded in an iframe dynamically. You can opt for an empty DOM during submit, a 2d canvas, or a webgl canvas. You can also specify max canvas width/height during submit, defaults to 100%. If empty, `a`, `c`, and `g` will obviously not exist. `top.reload()` replaces the iframe containing your demo with a new instance, …
<!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;
@prestonparris
prestonparris / reactjs-conf-2015-notes.md
Last active April 6, 2017 21:32
Notes from the 2015 React.js Conference

Reactjs conf 2015 Notes

  • react native announced

    • Allows you to use react style javascript to target native ios and android, native views, live reloading
    • intro pt1
    • intro pt2
    • facebook groups app uses react native with graphql and relay
  • realtime page tweaking

    • rethink best practices and workflows
  • inmutability is a good idea

@jarmitage
jarmitage / himawari-8.py
Last active March 5, 2018 09:21
Himawari-8 Wallpaper Bot: Fresh images of the whole Earth from space, every 10 minutes
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'
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;
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%",
@Reedbeta
Reedbeta / antialias-test.py
Created July 25, 2014 06:03
Antialiasing test program
# 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
@peterc
peterc / domainavailable
Created February 13, 2009 13:30
Check if a domain is available to register (uses DNS before WHOIS to be fast) - supports .com,.net,.org,.co.uk - inspired by foca/giles http://gilesbowkett.blogspot.com/2009/02/simple-bash-domain-availability.html
#!/bin/bash
# domainavailable
# Fast, domain name checker to use from the shell
# Use globs for real fun:
# domainavailable blah{1..3}.{com,net,org,co.uk}
# Inspired by foca / giles:
# http://gilesbowkett.blogspot.com/2009/02/simple-bash-domain-availability.html
trap 'exit 1' INT TERM EXIT
// 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);
}