Skip to content

Instantly share code, notes, and snippets.

View joewiz's full-sized avatar

Joe Wicentowski joewiz

  • Arlington, Virginia
View GitHub Profile
@tmuth
tmuth / pandoc-ant.xml
Created November 10, 2014 19:14
Pandoc Ant Task to Convert github README.md to local readme.html
<macrodef name="pandoc-convert">
<attribute name="input" />
<attribute name="output" />
<sequential>
<exec executable="pandoc" dir=".">
<arg line="--from=markdown_github " />
<arg line="--standalone" />
<arg line="-o @{output}" />
<arg line="@{input}" />
</exec>
@wsalesky
wsalesky / git-sync.xql
Last active August 19, 2019 08:58
Sync remote eXistdb with github repository automatically using github webhooks.
xquery version "3.0";
(:module namespace gitsync = "http://syriaca.org/ns/gitsync";:)
(:~
: XQuery endpoint to respond to Github webhook requests. Query responds only to push requests.

: The EXPath Crypto library supplies the HMAC-SHA1 algorithm for matching Github secret. 

:
: Secret can be stored as environmental variable.
: Will need to be run with administrative privileges, suggest creating a git user with privileges only to relevant app.
@CliffordAnderson
CliffordAnderson / example-hof.md
Last active January 3, 2024 15:40
Simple examples of higher-order functions and partial function application in XQuery

##Examples of Higher-Order Functions in XQuery

Here are a few examples of higher-order functions in XQuery. For more examples, see the very nice discussion of higher-order functions in XQuery 3.0 at the BaseX website.

N.B. In some implementations, these functions may not be implemented or may have different names/function signatures. The first four functions have been tested using Saxon PE and the second four using Zorba.

@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active April 22, 2025 16:56
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
# Thanks to this post:
# http://blog.ikato.com/post/15675823000/how-to-install-consolas-font-on-mac-os-x
$ brew install cabextract
$ cd ~/Downloads
$ mkdir consolas
$ cd consolas
$ curl -O http://download.microsoft.com/download/f/5/a/f5a3df76-d856-4a61-a6bd-722f52a5be26/PowerPointViewer.exe
$ cabextract PowerPointViewer.exe
$ cabextract ppviewer.cab
@lisamelton
lisamelton / transcode-video.sh
Last active April 29, 2025 20:17
Transcode video file (works best with Blu-ray or DVD rip) into MP4 (or optionally Matroska) format, with configuration and at bitrate similar to popular online downloads.
#!/bin/bash
#
# transcode-video.sh
#
# Copyright (c) 2013-2015 Don Melton
#
about() {
cat <<EOF
$program 5.13 of April 8, 2015
@grantmacken
grantmacken / gist:6528369
Created September 11, 2013 19:12
My ant build target for building and uploading xar from project folder.
<target name="xar-build-upload" >
<buildnumber file="build.version"/>
<property name="project.version" value="${version.major}.${build.number}"/>
<property name="xar-location" value="${dir.project}/${dir.build}/${project.abbrev}-${project.version}.xar"/>
<property name="repo.url" value="http://${host.local}:8080/exist/apps/public-repo/public/"/>
<property name="repo.update" value="http://${host.local}:8080/exist/apps/public-repo/modules/update.xql"/>
<property name="xar-file" value="${project.abbrev}-${project.version}.xar"/>
<echo>project.version: ${project.version}</echo>
<antcall target="deployment-folder"/>
@wolfgangmm
wolfgangmm / gist:5880377
Last active July 16, 2020 12:59
eXist-db: reinstall dashboard and shared-resources if broken. Run the following query through eXide - or if this fails: the Java admin client.
repo:remove("http://exist-db.org/apps/shared"),
repo:remove("http://exist-db.org/apps/dashboard"),
repo:install-and-deploy("http://exist-db.org/apps/shared", "http://exist-db.org/exist/apps/public-repo/find"),
repo:install-and-deploy("http://exist-db.org/apps/dashboard", "http://exist-db.org/exist/apps/public-repo/find")
@CliffordAnderson
CliffordAnderson / luhn-3.1.xqy
Last active December 3, 2016 22:08
An attempt at the Luhn algorithm in XQuery
(: Signature of the fold function changed :)
xquery version "3.1";
(: Implements the Luhn Algorithm (http://en.wikipedia.org/wiki/Luhn_algorithm) in XQuery :)
declare function local:check-luhn($num as xs:integer) as xs:boolean
{
let $seq := fn:reverse(local:number-to-seq(($num)))
let $even-seq := $seq[position() mod 2 = 0]
@wolfgangmm
wolfgangmm / gist:5871157
Created June 26, 2013 20:09
Change group on all resources/collections in eXist-db root collection.
xquery version "3.0";
import module namespace dbutil="http://exist-db.org/xquery/dbutil" at "/db/apps/shared-resources/content/dbutils.xql";
let $root := "/db"
return
dbutil:scan(xs:anyURI($root), function($collection, $resource) {
if ($resource) then
sm:chgrp($resource, "biblio.users")
else