Skip to content

Instantly share code, notes, and snippets.

View tomasklapka's full-sized avatar

Tomáš Klapka tomasklapka

View GitHub Profile
@tomasklapka
tomasklapka / Launch Control XL Launch Contro.json
Last active January 16, 2024 21:59
Launchpad Control XL BespokeSynth midicontroller layout
{
"groups": [
{
"rows": 3,
"cols": 8,
"position": [ 0, 0 ],
"dimensions": [ 28, 28 ],
"spacing": [ 30, 30 ],
"controls": [
13, 14, 15, 16, 17, 18, 19, 20,
@tomasklapka
tomasklapka / Launchpad Pro MK3.json
Last active January 15, 2024 21:12
Launchpad Pro MK3 BespokeSynth midicontroller layout
{
"groups": [
{
"rows": 8,
"cols": 8,
"position": [ 30, 30 ],
"dimensions": [ 28, 28 ],
"spacing": [ 30, 30 ],
"controls": [ 81, 82, 83, 84, 85, 86, 87, 88,
71, 72, 73, 74, 75, 76, 77, 78,
@tomasklapka
tomasklapka / Launchpad Pro Standalone Port.json
Created January 15, 2024 20:56
Launchpad Pro (MK2) BespokeSynth midicontroller layout
{
"groups": [
{
"rows": 8,
"cols": 8,
"position": [ 35, 35 ],
"dimensions": [ 28, 28 ],
"spacing": [ 30, 30 ],
"controls": [ 81, 82, 83, 84, 85, 86, 87, 88,
71, 72, 73, 74, 75, 76, 77, 78,
@tomasklapka
tomasklapka / bdd_apply_unary_op_non_recursive.js
Created February 3, 2019 08:44
BDD apply unary op non recursive
function _enum(obj) { return Object.freeze(obj); }
class bdds extends bdds_base {
static apply(b, root, r, op) {
const get = id => op.op(b, b.getnode(id)); // fn evaluates the operator
const parents = []; // path from root to the current node
let n = get(root); // current node
let nn = 0; // new node (id)
let hi = 0; // last high leaf
let lo = 0; // last low leaf
const s = _enum({ "LO": 1, "HI": 2, "OP": 3 }); // traversing states
@tomasklapka
tomasklapka / argument_predicates.pl
Last active July 23, 2018 15:47
List all fact predicates for a provided argument
%%% list all fact Predicates having an Argument as any argument.
argument_predicates(Argument, Predicates) :-
findall(Predicate, (
predicate_property(M:Clause, file(_)), % list all predicates
\+ M = system, % exclude 'system' Module, or you can constrain it to M = user
clause(Clause, true), % is Clause a fact?, ie. Body = true.
arg(_, Clause, Argument), % Clause has the Argument as an argument (change _ to 1 if Argument has to be the first argument of a predicate).
current_predicate(Predicate, Clause), % extract Predicate from Clause (another way: functor(Clause,Predicate,_))
\+ Predicate = ignore % exclude 'ignore' predicate since it succeeds for anything.
@tomasklapka
tomasklapka / webid_gen.sh
Last active October 5, 2019 12:06
WebID generation bash script (requires openssl)
#!/bin/bash
BITS=2048
DIR=./out
if grep -q 'webid_generator' /etc/ssl/openssl.cnf; then
echo "WEBID_GEN: Found webid_generator configuration section in /etc/ssl/openssl.cnf"
else
echo "WEBID_GEN: Section webid_generator is missing in /etc/ssl/openssl.cnf. Add this configuration section manually:
@tomasklapka
tomasklapka / editor_file_url_handler.py
Created November 19, 2014 02:13
Terminator Plugin to handle file paths with line number to be handled and opened in Sublime Text (or change editor_cmd to whatever you want)
import re
import terminatorlib.plugin as plugin
import subprocess
# Every plugin you want Terminator to load *must* be listed in 'AVAILABLE'
AVAILABLE = ['EditorFileURLHandler']
editor_cmd = "subl"
class EditorFileURLHandler(plugin.URLHandler):
@tomasklapka
tomasklapka / gapi-rdf.example.coffee
Last active August 29, 2015 14:09
GAPI RDF ORM example
rdf = require('../..')
ORM = rdf.ORM
ORM.waitForLoad () ->
person = ORM.newResource('http://example.com/john#me', 'foaf', 'Person')
person.foaf.name = 'John Doe'
person.foaf.homepage = 'http://example.com/john/blog'
person.rdfs.label = 'john\'s label'
otherone = ORM.newResource('http://example.com/jane#me', 'foaf', 'Person')
@tomasklapka
tomasklapka / Fetcher.litcoffee
Last active August 29, 2015 14:09
Request and parse RDF resource (RDF/XML, JSON-LD, Turtle)

Usage:

###
fetcher = new Fetcher()
fetcher.fetch 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', null, (error, graph) ->
  console.log error if error
  console.log graph.toString() if graph
###

RDF resource Fetcher class:

@tomasklapka
tomasklapka / GAPI_component_diagram.puml
Last active August 29, 2015 14:08
GAPI - component diagram
@startuml
() "GAPI client" <<browser>> as GAPIClient
package "GAPI Web" {
() "Passenger" <<node module>> as Passenger
() "Template Engine" <<node module>> as TemplateEngine
[HTTP Server] as WebServer
[REST 2 SPARQL] <<node module>> as REST2SPARQL
[SPARQL-client] <<sparql-client node module>> as WebSPARQLClient