Skip to content

Instantly share code, notes, and snippets.

View mhausenblas's full-sized avatar
🤷‍♂️
weeks of coding can save you hours of planning!

Michael Hausenblas mhausenblas

🤷‍♂️
weeks of coding can save you hours of planning!
View GitHub Profile
CmdUtils.CreateCommand({
name: "lookupNdbpedia",
takes: {"term": noun_arb_text},
homepage: "http://di2.deri.org/",
author: { name: "Michael Hausenblas", email: "michael.hausenblas@deri.org"},
license: "MPL",
description: "performs a lookup on DBpedia (http://dbpedia.org)",
preview: function(previewBlock, term) {
previewBlock.innerHTML = "looking up " + term.text + " at DBpedia ... ";
npm info it worked if it ends with ok
npm info using npm@0.2.17
npm info using node@v0.2.6
npm ERR! Error connecting to server http://registry.npmjs.org/npm
npm ERR! Error: ETIMEOUT, Timeout while contacting DNS servers
npm ERR! at Timer.callback (dns:15:13)
npm ERR! at node.js:773:9
npm ERR! Report this *entire* log at <http://github.com/isaacs/npm/issues>
npm ERR! or email it to <npm-@googlegroups.com>
npm ERR! Just tweeting a tiny part of the error will not be helpful.
@mhausenblas
mhausenblas / google_apps_bqe_wrapper.js
Created June 19, 2011 05:28
Google Apps script - BigQuery Endpoint wrapper
function onOpen() {
execQuery();
}
function bqeApp() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var app = UiApp.createApplication().setTitle("Execute Query against BQE API");
app.setStyleAttribute("padding", "10px");
var button = app.createButton('Execute!');
@mhausenblas
mhausenblas / bqe-apps-script-integration.js
Created March 2, 2012 05:49
Allows to call the BigQuery Endpoint from Google Apps Script (GDocs spread sheets)
// BigQuery Endpoint Wrapper for Apps Script
// see http://code.google.com/p/bigquery-linkeddata/
// Michael Hausenblas
// http://sw-app.org/mic.xhtml#i
function onOpen() {
execQuery();
}
@mhausenblas
mhausenblas / sparql-query-google-apps-script.js
Created March 2, 2012 08:38
Provides a gateway to execute SPARQL queries against public SPARQL endpoints.
function onOpen() {
var s = SpreadsheetApp.getActiveSpreadsheet();
var menu = [ {name: "Execute SPARQL", functionName: "execQuery"}];
s.addMenu("Query", menu);
}
function execQuery() {
var sheet = SpreadsheetApp.getActiveSheet();
var querystring = sheet.getRange("A1").getValue();
var url = sheet.getRange("A2").getValue() + "?output=json&query=" + escape(querystring);
@mhausenblas
mhausenblas / simple-rdf-store.py
Created March 30, 2012 13:52
Simple RDF store in ZooKeeper
import zookeeper, threading, sys
ZOO_OPEN_ACL_UNSAFE = {"perms":0x1f, "scheme":"world", "id" :"anyone"};
class ZKSimpleRDFStore(object):
SERVER_PORT = 2181
def __init__(self):
self.host = "localhost:%d" % self.SERVER_PORT
self.connected = False
@mhausenblas
mhausenblas / gist:3905608
Created October 17, 2012 13:47
How to link language variants of pages
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix : <http://example.org/#> .
:a_page a schema:WebPage ;
rdfs:label "the cool page" ;
schema:relatedLink :the_other_page ;
.
@mhausenblas
mhausenblas / textmate-file-pattern
Created October 31, 2012 08:22
My Textmate file pattern (hides tmp and some config files in the project drawer)
!(/\.(?!.)[^/]*|\.(tmproj|o|pyc|gitignore|DS_Store)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$
Paste into TextMate -> Preferences -> Advanced in the 'File Pattern:' text input field.
@mhausenblas
mhausenblas / SparkGrep.scala
Created February 8, 2015 16:07
Scala Spark skeleton implementing grep
package spark.example
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.SparkConf
object SparkGrep {
def main(args: Array[String]) {
if (args.length < 3) {
System.err.println("Usage: SparkGrep <host> <input_file> <match_term>")
@mhausenblas
mhausenblas / stackedit-test.md
Last active August 29, 2015 14:18
Testdriving StackEdit

Test-driving StackEdit

This seems like a decent new env.

enter image description here

There's some seriously crazy $hit possible with this software: