Skip to content

Instantly share code, notes, and snippets.

View apb2006's full-sized avatar

Andy Bunce apb2006

  • Quodatum
  • London, UK
View GitHub Profile
@apb2006
apb2006 / gist:2979999
Created June 23, 2012 21:11
metadata from mp3 file using tika
java -jar ~andy/tika-app-1.1.jar 12\ Time\ Of\ The\ Season.mp3
<?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="xmpDM:audioCompressor" content="MP3"/>
<meta name="xmpDM:releaseDate" content="1968"/>
<meta name="Content-Length" content="5632909"/>
<meta name="xmpDM:album" content="Odessey &amp; Oracle"/>
<meta name="xmpDM:artist" content="Zombies"/>
<meta name="Author" content="Zombies"/>
<meta name="xmpDM:genre" content=""/>
@apb2006
apb2006 / gist:3714975
Created September 13, 2012 15:11
tl-wr703n : OpenWrt boot log
Sep 12 21:04:03 OpenWrt syslog.info syslogd started: BusyBox v1.19.4
Sep 12 21:04:03 OpenWrt kern.notice kernel: klogd started: BusyBox v1.19.4 (2012-08-28 23:48:59 EDT)
Sep 12 21:04:03 OpenWrt kern.notice kernel: [ 0.000000] Linux version 3.3.8 (openwrt@callisto.lab.bufferbloat.net) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Thu Aug 30 06:36:56 EDT 2012
Sep 12 21:04:03 OpenWrt kern.debug kernel: [ 0.000000] MyLoader: sysp=3dd7cb87, boardp=f0717c55, parts=4852ecbe
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] bootconsole [early0] enabled
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] CPU revision is: 00019374 (MIPS 24Kc)
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] SoC: Atheros AR9330 rev 1
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] Determined physical RAM map:
Sep 12 21:04:03 OpenWrt kern.info kernel: [ 0.000000] memory: 020
@apb2006
apb2006 / actions.xml
Last active October 13, 2015 00:27
TXQ
<div>
<h2>{$heading} - {count($actions/generate)}</h2>
<p>Actions are processes that generate a new item from an existing item.</p>
<div>
{$partial("action1.xml","action",$actions/generate )}
</div>
</div>
@apb2006
apb2006 / nested.html
Last active December 10, 2015 21:39
angularjs nested repeats
<!DOCTYPE html>
<html ng-app><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Angular.js Nested Repeatable Objects</title>
<style>
#section-form { margin: auto; width: 960px; }
.section { border: 2px solid #999; margin: 10px 0; padding: 10px; }
.section > label { display: inline-block; padding-right: 10px; text-align: right; vertical-align:top; width: 150px; }
.question { background: #eee; border: 2px solid #aaa; margin: 5px 0; padding: 10px; }
#fader { position:fixed; top: 0px; left: 0px; width: 100%; height:100%; background-color: black; opacity: 0.8; z-index: 3; }
@apb2006
apb2006 / app-basex.js
Last active June 25, 2016 13:59
Node.js + socket.io + BaseX = Xquery chatbot
// Andy bunce jan 2013 based on http://book.mixu.net/ch13.html
var fs = require('fs'),
http = require('http'),
sio = require('socket.io');
var port=8001;
var server = http.createServer(function(req, res) {
res.writeHead(200, { 'Content-type': 'text/html'});
res.end(fs.readFileSync('./index.html'));
});
server.listen(port, function() {
@apb2006
apb2006 / bad.xqm
Created May 16, 2013 16:59
baseX 7.7 passing java objects with function reference. Requires "metadata-extractor-2.6.4.jar" "xmpcore.jar" from http://drewnoakes.com/code/exif/
xquery version "3.0" encoding "UTF-8";
(:~ return image metadata as xml using http://drewnoakes.com/code/exif/
: usage: metadata:read('C:/temp/apic.jpg')
: xml format based on xmlcalabash1
: https://github.com/ndw/xmlcalabash1/blob/master/src/com/xmlcalabash/extensions/MetadataExtractor.java
: @author andy bunce
:)
module namespace metadata = 'apb.image.metadata';
declare default function namespace 'apb.image.metadata';
@apb2006
apb2006 / simple.xq
Last active December 22, 2015 11:19
timeout test
let $s:="
import module namespace test = 'org.apb.modules.TestModule';
declare function local:prime($n){
$n = 2 or ($n > 2 and
(every $d in 2 to xs:integer(math:sqrt($n)) satisfies $n mod $d > 0))
};
let $t:=test:startTimeout(xs:int(10000))
return count((1 to 1000000)[local:prime(.)])
"
@apb2006
apb2006 / gist:10777961
Created April 15, 2014 21:32
eclipse xquery dependancy problem
Cannot complete the install because of a conflicting dependency.
Software being installed: Dynamic Languages Toolkit - Core Frameworks 4.0.0.201206120848 (org.eclipse.dltk.core.feature.group 4.0.0.201206120848)
Software currently installed: XQuery Development Tools Feature 1.0.0.201108251748 (org.eclipse.wst.xquery.feature.feature.group 1.0.0.201108251748)
Only one of the following can be installed at once:
Dynamic Languages Toolkit Core UI 4.0.0.201206120848 (org.eclipse.dltk.ui 4.0.0.201206120848)
Dynamic Languages Toolkit Core UI 3.0.1.v20110823 (org.eclipse.dltk.ui 3.0.1.v20110823)
Dynamic Languages Toolkit Core UI 3.0.0.v20110609-1525 (org.eclipse.dltk.ui 3.0.0.v20110609-1525)
Cannot satisfy dependency:
From: Dynamic Languages Toolkit - Core Frameworks 4.0.0.201206120848 (org.eclipse.dltk.core.feature.group 4.0.0.201206120848)
To: org.eclipse.dltk.ui [4.0.0.201206120848]
@apb2006
apb2006 / config.txt
Created May 1, 2014 11:11
raspberry pi config nano /boot/config.txt
pi@raspberrypi ~ $ cat /boot/config.txt
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=0
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
@apb2006
apb2006 / data.xml
Last active August 29, 2015 14:04
BaseX update query
<bar>
<crumbs type="array">
<link>
<text>Suites</text>
<href>#</href>
<title>List of suites</title>
</link>
<link>
<text>{{activesuite}}</text>
<href>#/suite/{{activesuite}}</href>