Skip to content

Instantly share code, notes, and snippets.

View utaal's full-sized avatar

Andrea Lattuada utaal

View GitHub Profile
@utaal
utaal / pymdlatex.py
Last active December 30, 2015 12:19
import markdown
import sys
option_defaults = {
'html_replacement_text' : '[HTML_REMOVED]',
'tab_length' : 4,
'enable_attributes' : True,
'smart_emphasis' : True,
'lazy_ol' : True,
'doc_tag' : 'document',
@utaal
utaal / jsontable.py
Created May 19, 2014 11:35
Quick and dirty script to generate a html table from a json array
from __future__ import print_function
import json
import tempfile
import sys
import os
data = json.load(sys.stdin)
cols = []
for item in data:
@utaal
utaal / Serialization.cs
Last active August 29, 2015 14:08
Minimal code to reproduce serialization issue in Naiad
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Research.Naiad;
@utaal
utaal / Serialization.cs
Created October 29, 2014 21:02
Scheduling issues Naiad
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Research.Naiad;
@utaal
utaal / RenamedStruct.cs
Created December 10, 2014 17:14
Naiad serialization
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Research.Naiad;
namespace DCModel
{
public struct RenamedStruct : IEquatable<RenamedStruct>
00:33:08.2490351, Graph 0 failed on scheduler 0 with exception:
System.NullReferenceException: Object reference not set to an instance of an object
at DCModel.RenamedStruct.GetHashCode () [0x00064] in /Users/utaal/Src/ETH/dsl/DCModel/states/trace/RenamedStruct.cs:45
at (wrapper dynamic-method) object.lambda_method (System.Runtime.CompilerServices.Closure,DCModel.RenamedStruct) <IL 0x00008, 0x00018>
at Microsoft.Research.Naiad.Dataflow.Stage/<NewInput>c__AnonStorey0`2<DCModel.RenamedStruct, Microsoft.Research.Naiad.Dataflow.Epoch>.<>m__0 (DCModel.RenamedStruct[],int[],int) [0x00017] in /Users/utaal/Src/ETH/dsl/Naiad/Dataflow/Stage.cs:107
at Microsoft.Research.Naiad.Dataflow.Channels.BufferingPostbox`2<DCModel.RenamedStruct, Microsoft.Research.Naiad.Dataflow.Epoch>.ComputeDestinations (Microsoft.Research.Naiad.Dataflow.Message`2<DCModel.RenamedStruct, Microsoft.Research.Naiad.Dataflow.Epoch>) [0x0005f] in /Users/utaal/Src/ETH/dsl/Naiad/Channels/MessageDelivery.cs:320
at Microsoft.Research.Naiad.Dataflow.Channel
@utaal
utaal / iff.js
Created December 29, 2014 21:40
sweet.js if expression macro
macro iff {
rule {
($x:expr) {
$truebody
...
$truelast:expr
} els {
$falsebody
...
$falselast:expr
@utaal
utaal / experiment.js
Last active August 29, 2015 14:22
promise scheduler (gcanti/fetch-optimizer)
// run with: node --harmony experiment.js
var R = require('ramda');
var PromiseScheduler = (function() {
function PromiseScheduler() {
this.nodes = {};
}
PromiseScheduler.prototype.add = function(id, fetcher, dependencies) {
this.nodes[id] = {
project/target/
target/
@utaal
utaal / output
Created September 29, 2015 18:38
scalahost 0.3.0 plugin fails on non/cats
[trace] Stack trace suppressed: run last macrosJS/compile:compileIncremental for the full output.
[trace] Stack trace suppressed: run last macrosJVM/compile:compileIncremental for the full output.
[error] (macrosJS/compile:compileIncremental) scala.meta.internal.hosts.scalac.converters.ConvertException: unexpected tree during scala.reflect -> scala.meta conversion:
[error] Import(Select(Ident(scala), scala.reflect), List(ImportSelector(TermName("NameTransformer"), 50, TermName("NameTransformer"), 50)))
[error] (PackageDef) package macros { import scala.reflect.NameTransformer; o...
[error] (PackageDef) package cats { package macros { import scala.reflect.N...
[error] (macrosJVM/compile:compileIncremental) scala.meta.internal.hosts.scalac.converters.ConvertException: unexpected tree during scala.reflect -> scala.meta conversion:
[error] Import(Select(Ident(scala), scala.reflect), List(ImportSelector(TermName("NameTransformer"), 50, TermName("NameTransformer"), 50)))
[error] (PackageDef) package macro