Skip to content

Instantly share code, notes, and snippets.

View boutros's full-sized avatar

Petter Goksøyr Åsen boutros

  • Oslo Public Library
  • Oslo
View GitHub Profile
@boutros
boutros / queue.go
Created March 22, 2014 19:12 — forked from scttnlsn/queue.go
package main
import (
"bufio"
"flag"
"fmt"
"net"
"strconv"
"strings"
"time"
(ns example.errors)
(defn clean-address [params]
"Ensure (params :address) is present"
(if (empty? (params :address))
[nil "Please enter your address"]
[params nil]))
(defn clean-email [params]
"Ensure (params :email) matches *@*.*"
@boutros
boutros / gist:832520c7f3623993d30a
Created June 17, 2014 09:01
generate displayLabel
CONSTRUCT {
?person <armillaria://internal/displayLabel> ?label
}
WHERE {
?person a foaf:Person ;
foaf:name ?name .
OPTIONAL { ?person <http://data.deichman.no/lifespan> ?lifespan }
BIND( IF(bound(?lifespan), concat(?name, " (", ?lifespan, ")"), ?name) AS ?label)
} LIMIT 100
@boutros
boutros / gist:0c01debdd59a6331023c
Created June 30, 2014 07:34
SPARQL construct with aggregate in where clause (not working)
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2008/05/skos#>
PREFIX lvont: <http://lexvo.org/ontology#>
PREFIX armillaria: <armillaria://internal/>
CONSTRUCT {
?script a lvont:Script ;
rdfs:label ?nb ;
rdfs:label ?en ;
armillaria:displayLabel ?dLabel ;
@boutros
boutros / gist:27fcb9fcca27b330cc45
Last active August 29, 2015 14:07
Docker data volumes - viser hvordan flere kontainere får tilgang på samme data
echo "FROM busybox" > Dockerfile
echo 'VOLUME ["/data"]' >> Dockerfile
docker build -t data_image .
docker run --name data_volume data_image
docker run -d --name k1 --volumes-from=data_volume busybox sh -c 'echo "hei" > /data/hilsen.txt; sleep 60'
docker run -d --name k2 --volumes-from=data_volume busybox sh -c 'echo "yo!" >> /data/hilsen.txt; sleep 60'
docker run --rm --volumes-from=data_volume busybox cat /data/hilsen.txt
> hei
> yo!
@boutros
boutros / Makefile
Last active August 29, 2015 14:09
wp-review-publish development setup
all: start
git:
if [ ! -d "wp-review-publish" ]; then \
git clone https://github.com/digibib/wp-review-publish ;\
fi
build: git
docker inspect wp-mysql > /dev/null 2>&1;\
if [ $$? -eq 1 ] ; then \
#!/bin/bash
# This scripts scans the elasticsearch source code for all the registered REST endpoints
# It will put the formatted output in $DEFINITIONOUTPUTFILE
# [MethodName] [HttpVerb] [Route]
ESFOLDER="../elasticsearch"
DEFINITIONOUTPUTFILE="src/Generated/rest-actions.txt"
# Find all the lines that registerHandlers
@boutros
boutros / bench-committed
Last active August 29, 2015 14:14
Go benchmark helper scripts
#!/usr/bin/env bash
num=$1
if [[ -z $num ]] ; then
num=1
fi
benchmarks=$2
if [[ -z $benchmarks ]] ; then
benchmarks="."
fi
git checkout "HEAD~${num}" > /dev/null 2>&1
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Domenico Carbotta</string>
<key>name</key>
<string>IDLE</string>
<key>semanticClass</key>
<string>theme.light.idle</string>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>hei</title>
<style type="text/css">
body { margin: 40px auto; max-width: 650px; line-height: 1.6; font-size: 18px; color: #222; padding: 0 10px }
h1, h2, h3 { line-height: 1.2}
</style>