Skip to content

Instantly share code, notes, and snippets.

View jurgenvinju's full-sized avatar
🚠
in the lift

Jurgen J. Vinju jurgenvinju

🚠
in the lift
View GitHub Profile
@jurgenvinju
jurgenvinju / HypothesisToReview.rsc
Last active March 16, 2022 14:30
Turn a block of hypothesis document annotations into a plaintext list of detailed comments for a peer review
module HypothesisToReview
import lang::html::IO;
import IO;
import List;
// this is a simple HTML scraper against an untyped HTML document model (`node`)
str detailedComments(loc hypothesisCards) {
content = readHTMLFile(annos);
review = "";
@jurgenvinju
jurgenvinju / Dockerfile
Created May 11, 2021 07:56
Dcokerfile for starting Rascal Jupyter notebooks
FROM usethesource/bacata:0.0.1
module analysis::learning::KMeans
import util::Math;
import List;
import Set;
import IO;
data Point = point(list[real] vec);
Point arbPoint(int d) = point([arbReal() | _ <- [0..d]]);
@jurgenvinju
jurgenvinju / Recursion.rsc
Created March 27, 2017 08:18
some functions for analyzing a grammar
module lang::rascal::grammar::analyze::Recursion
import Grammar;
import ParseTree;
import analysis::grammars::Dependency;
import Relation;
set[Symbol] reachable(type[&T] g, Symbol s) {
res = {s};
@jurgenvinju
jurgenvinju / JavaToObjectFlow2.rsc
Created March 9, 2017 11:16
A "fixed" JavaToObjectFlow algorithm which does not ignore the references to values of primitive types. For maps, this version also lets the key flow into the receiver.
@doc{
Synopsis: mapping all of Java to the object flow language
Description:
More information can be found in [ObjectFlow].
}
module lang::java::flow::JavaToObjectFlow2
import IO;
@jurgenvinju
jurgenvinju / proposal.tex
Created August 25, 2015 10:04
basic template for NWO Big Software proposal (no tables, don't blame me for errors)
\documentclass[twoside,a4]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={210mm,297mm},
left=1in,
right=1in,
top=1.2in,
bottom=20mm,
@jurgenvinju
jurgenvinju / gist:8972255
Last active February 16, 2017 06:32
Example code to compute flow graphs for Java and some basic UML diagramming for TU Eindhoven students
module FlowGraphsAndClassDiagrams
import analysis::flow::ObjectFlow;
import lang::java::flow::JavaToObjectFlow;
import List;
import Relation;
import lang::java::m3::Core;
import IO;
import vis::Figure;
@jurgenvinju
jurgenvinju / Clearness Numbered
Created May 31, 2013 05:31
CSS file with numberer headings for markdown rendering in Mou. Cloned from Clearness.css.
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote {
margin: 0;
padding: 0;
@jurgenvinju
jurgenvinju / gist:5460118
Created April 25, 2013 14:27
Shell script to migrate some SVN repository from Eclipse to github
#! /bin/sh
set -e
repo=$1
mkdir ${repo}
cd ${repo}
echo "Creating repo on github"
curl -u 'jurgenvinju' https://api.github.com/orgs/impulse-org/repos -d "{\"name\":\"${repo}\",\"has_wiki\": false,\"has_issues\": false}"
@jurgenvinju
jurgenvinju / AR.rsc
Created February 20, 2013 20:48
Rascal module demonstrating Java code visualization. Two functions implement the same functionality, one generates a visualization inside Eclipse representing the inheritance hierarchy of an Eclipse Java project, the other generates a graphviz dot file with the same information. This code is intended to be a starting point for the students of TU…
module AR
import lang::java::jdt::JDT; // this module provides the API for extracting Java models
import lang::java::jdt::Java; // this module provides the model for Java
import Relation; // a stdlib module with practical API on relations
// these modules are needed to visualize graphs in the IDE
import vis::Figure;
import vis::Render;