Skip to content

Instantly share code, notes, and snippets.

{"archived":true,"downs":0,"link_id":"t3_etyqc","score_hidden":false,"id":"c1b06fp","author_flair_css_class":null,"body":"They should add that to the instructions on the box :p","ups":1,"distinguished":null,"gilded":0,"edited":false,"retrieved_on":1426664469,"parent_id":"t1_c1azvxa","created_utc":"1293840000","subreddit":"sex","controversiality":0,"author_flair_text":null,"score":1,"name":"t1_c1b06fp","author":"SandRider","subreddit_id":"t5_2qh3p"}
{"name":"t1_c1b06fq","score":2,"author":"throwaway-o","subreddit_id":"t5_2r0cn","parent_id":"t1_c1az6tm","created_utc":"1293840001","subreddit":"relationship_advice","controversiality":0,"author_flair_text":null,"edited":false,"retrieved_on":1426664469,"distinguished":null,"gilded":0,"body":"Beta has nothing to do with lack of muscles. It has everything to do with an inability to lead and assert yourself peacefully but firmly in the relationship.","ups":2,"id":"c1b06fq","author_flair_css_class":null,"archived":true,"link_id":"t3_eu4fk","downs":0,"score_hidden":fal
@bcleenders
bcleenders / word-analogy.c
Created September 28, 2015 12:11
C code that needs a second pair of eyes for debugging
// Copyright 2013 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
-- The tables I assume you have:
CREATE TABLE articles
(
"Id" serial NOT NULL,
"Date" date,
"Article" text,
"Author" text,
"Title" text,
"Points" integer,
"NumComments" integer,
@bcleenders
bcleenders / gist:6704e98b4b03b7b01b73
Last active August 29, 2015 14:24
Generate statistics per month/year/topic include missing months with 0 values
--
-- Not optimized -> I only run it once and it's fast enough not to be worth optimizing ^.^
--
SELECT
mt.topic,
'{' ||
'"d":"' || mt.year || '-' || mt.month || '-01"' ||
',"p":' || CASE WHEN r.points is NULL THEN 0 ELSE r.points END ||
',"c":' || CASE WHEN r.comments is NULL THEN 0 ELSE r.comments END ||
{
"courseId":10,
"settings":{
"diverse":true,
"numStartPoints": 25,
"numIterations": 50
},
"students":[
{
"id":1,
{
"courseId":10,
"settings":{
"diverse":true
},
"students":[
{
"id":1,
"name":"Bram",
"groupPreferences":[
@bcleenders
bcleenders / Trends.scala
Created June 14, 2015 15:25
LDA for Hackernews
/*
To set the correct locations:
$ LD_LIBRARY_PATH=/usr/local/lib
$ export LD_LIBRARY_PATH
Example run
$ gcc mstfinder.c -lgsl -lgslcblas -lm
$./a.out -fast -v Running
75000 in fast mode; results can not be guaranteed to be correct.
Reserved space for 400000000 edges.
@bcleenders
bcleenders / gist:3748599
Created September 19, 2012 09:07
Hamming code generator
// De eisen voor de codewoorden
var codeLength = 15,
hamDist = 7;
// Creeër het eerste codewoord; 0
var firstCode = [];
for(var i = 0; i < codeLength; i++) {
firstCode[i] = 0;
}
function createResponse(name) {
this.name = name,
this.sayHi = function() {
return 'Hi!';
},
this.getName = function() {
return this.name;
},