Skip to content

Instantly share code, notes, and snippets.

using JSON
function create_data(n::Int)
r = fill([], n, n)
for i in eachindex(r)
r[i] = rand(1000:5000, rand(0:3))
end
return r
const _ = require('lodash')
const Graph = require('node-dijkstra')
/*
problem:
we want to paint a series of buildings
each building can be one of 3 colors (red, green, blue)
each building has its own cost per color
// ==UserScript==
// @name Facebook Remove Like
// @namespace http://edisdead.com
// @author quatrix
// @description removes like buttons and indicators from facebook, sick.
// @version 0.1
// @run-at document-start
// @include htt*://*.facebook.com/*
// @exclude htt*://apps.facebook.com/*
// @exclude htt*://www.facebook.com/checkpoint/*
#include <ShiftRegister74HC595.h>
#define LATCH_PIN 3
#define CLOCK_PIN 4
#define DATA_PIN 2
#define OE_PIN 5
#define RESET_PIN 6
#define NUMBER_OF_SHIFTERS 30
import json
def flatten(n):
if isinstance(n, bool):
return
while True:
changed = False
for k, v in n.iteritems():
if isinstance(v, bool):
import json
def flatten(n):
while True:
changed = False
for k, v in n.iteritems():
if len(v.keys()) == 1:
del n[k]
vk = v.keys()[0]
n[k + '/' + vk] = v[vk]
@quatrix
quatrix / main.go
Last active August 29, 2015 14:19
package main
// basically just reimplemented (paritally) the TimeSpanSemaphore
// as specified here http://joelfillmore.com/throttling-web-api-calls/
import (
"container/heap"
"fmt"
"sync"
"time"
var React = require('react');
var forms = require('newforms');
var _ = require('underscore');
var RegexValidator = forms.validators.RegexValidator
var $ = require('jquery');
var schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "/",
"type": "object",
@quatrix
quatrix / heya.py
Last active August 29, 2015 14:10
__author__ = 'quatrix'
import re
import unittest
def _get_lowest_version(s):
"""
Takes a string of the following format:
from itertools import product
def my_product(head, *tail):
if not tail:
return ((h,) for h in head)
return ((h,) + t for h in head for t in my_product(*tail))