Skip to content

Instantly share code, notes, and snippets.

@shellac
shellac / script.sh
Created October 3, 2011 14:51
Eulergui went bang
$ java -jar eulergui-1.9-SNAPSHOT-jar-with-dependencies.jar
Oct 03, 2011 3:49:35 PM eulergui.project.ProjectFactory restoreXMLFile
INFO: opening Project from "/home/pldms/Downloads/euler_project.xml.n3p" ( file:/home/pldms/Downloads/euler_project.xml.n3p )
Oct 03, 2011 3:49:35 PM eulergui.project.ProjectFactory restoreXMLFile
INFO: Blank Project created: /home/pldms/Downloads/euler_project.xml.n3p
Oct 03, 2011 3:49:35 PM eulergui.project.ProjectChangeSupport addProjectListener
INFO: ProjectChangeSupport.addProjectListener(): added listener eulergui.project.ProjectState@1f488344
Oct 03, 2011 3:49:35 PM eulergui.project.ProjectChangeSupport addProjectListener
INFO: ProjectChangeSupport.addProjectListener(): added listener eulergui.project.ProjectState@1f488344
Oct 03, 2011 3:49:35 PM eulergui.project.ProjectChangeSupport addProjectListener
@shellac
shellac / BackwardForwardDescribeFactory.java
Created October 25, 2011 19:21
A symmetric describe handler with some hardening. For quad stores.
package org.ilrt.researchrevealed.describehandler;
import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.rdf.model.impl.StmtIteratorImpl;
@shellac
shellac / validation-for-ya.rq
Created November 2, 2011 19:49
Validate complete absence of bios
# Explanation:
# ASK returns 'true' if there are any results
# The inner query says:
# Get agents and (if there) bio:event
# Count agents and bios, and check if there are agents present, but no bios
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX bio: <http://purl.org/vocab/bio/0.1/>
ASK {
SELECT (count(?x) as ?agents) (count(?y) as ?bios)
@shellac
shellac / branch_predict.rb
Created June 28, 2012 17:24
Branch prediction is detectable on jruby
require 'benchmark'
array_size = 32768
data = Array.new(array_size)
array_size.times { |c| data[c] = rand(256)}
data_sorted = data.sort
def sum(array)
@shellac
shellac / result.sh
Created July 5, 2012 09:38
Checking Larryzhao script on jruby master
$ jruby -v
jruby 1.7.0.preview2.dev (ruby-1.9.3-p203) (2012-07-03 a364a87) (OpenJDK 64-Bit Server VM 1.7.0_03) [linux-amd64-java]
$ jruby test.rb
==== Text in English ====
#<MatchData "@chichi dog dog" 1:"@" 2:"chichi" 3:" dog dog">
1. 11
2. 12
3. 18
==== Text in Chinese ====
#<MatchData "@chichi 狗狗" 1:"@" 2:"chichi" 3:" 狗狗">
<div vocab="http://example.com/eg/elements/1.1/">
<h3 property="title">5 Centimeters Per Second</h3>
<h4 property="maker">Makoto Shinkai</h4>
</div>
@shellac
shellac / Jsoup.java
Last active December 17, 2015 15:59
Issue with jsoup addClass -- leading empty class.
import java.util.Set;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
public class Jsoup {
public static void main(String... args) throws Exception {
Document html = Jsoup.parse("<html><body><p>Bye</p><p class=\"baz\">Hi</p></body></html>");
SELECT DISTINCT ?Sensor0 ?LeftBoundary1 ?RightBoundary2 ?TopBoundary3 ?BottomBoundary4
WHERE {
{
?PathRow5 <http://toto/#bottomBoundary> ?BottomBoundary4 .
?PathRow5 <http://toto/#topBoundary> ?TopBoundary3 .
?PathRow5 <http://toto/#leftBoundary> ?LeftBoundary1 .
?PathRow5 <http://toto/#rightBoundary> ?RightBoundary2 .
?PathRow5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://toto/#PathRow> .
@shellac
shellac / annotation.html
Last active December 26, 2015 03:19
Attempt to explain how to fix RDFa example
<!DOCTYPE html>
<html version="HTML+RDFa 1.1"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:aa="http://activearchives.org/terms/">
# On the pi
$ raspivid -t 999999 -o - | nc 192.168.1.87 5001
# On the mac
$ nc -l 5001 | mplayer -fps 31 -cache 1024 -vf halfpack -