Skip to content

Instantly share code, notes, and snippets.

View test_tensorflow.cpp
/*
Test for successful dynamic linkage with Tensorflow, either as an API, or as a 'main' exec
*/
#include <vector>
#include <tensorflow/core/public/session.h>
View code.ts
const toChunks = (input: string, chunkSize) => {
const i = Math.ceil(Math.random() * Math.min(chunkSize, input.length))
if (!input.length) {
return []
}
const head = input.slice(0, i)
const tail = input.slice(i, input.length)
View dummy_data.jl
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
View cheapest_combo.js
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
View remove_likes_from_fb.user.js
// ==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/*
View museum-dvlp.ino
#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
View __init__.py
import json
def flatten(n):
if isinstance(n, bool):
return
while True:
changed = False
for k, v in n.iteritems():
if isinstance(v, bool):
View __init__.py
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]
View main.go
package main
// basically just reimplemented (paritally) the TimeSpanSemaphore
// as specified here http://joelfillmore.com/throttling-web-api-calls/
import (
"container/heap"
"fmt"
"sync"
"time"
View jsonschema_form_generator.js
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",