Skip to content

Instantly share code, notes, and snippets.

View bwbohl's full-sized avatar

Benjamin W. Bohl bwbohl

  • BAZ-GA, Music Encoding Initiative
View GitHub Profile
<!--
XSLT for removing unused namespaces from an XML file.
Author: Dimitre Novatchev
Source: https://stackoverflow.com/a/4594626
License: CC BY-SA, https://creativecommons.org/licenses/by-sa/2.5/
Usage:
xmlstarlet tr remove-unused-namespaces.xslt -
@azinneera
azinneera / uuid-gen.xslt
Last active February 12, 2024 10:17
XSLT generate unique UUID
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:math="http://exslt.org/math" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:uuid="http://www.uuid.org" version="2.0">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:template match="/">
<Payment xmlns="http://ws.apache.org/ns/synapse">
<xsl:for-each select="//Order/lunch">
<discount>
<li>
<xsl:attribute name="uid" select="uuid:get-uuid(drinkName)"/>
<xsl:value-of select="drinkName"/>
<span>
@eneko
eneko / list-of-curl-options.txt
Last active July 22, 2024 16:16
List of `curl` options
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
@joewiz
joewiz / web-scraping-with-xquery.md
Last active March 9, 2023 07:18
Web Scraping with XQuery

Web Scraping with XQuery

Overview

Learning how to web scrape empowers you to apply your XQuery skills to any data residing on the web. You can fetch data from remote sites and services—for example, entire web pages or just the pieces of a page that matter to you. Once fetched, you can perform further analysis on the data, clean it up, mash it up with other data, transform it into different formats, etc.

Built-in functions for making HTTP requests

XPath-based languages like XQuery offer an standard function for accessing remote documents, the fn:doc() function. However, a limitation of this function is that it only works if the URI returns a well-formed XML document.

@welblaud
welblaud / dtp-utils.xqm
Last active October 14, 2022 06:18
A module for preparing TEI Simple XML files stored in eXist-db for latter usage in InDesign
xquery version "3.0";
module namespace dtp-utils = 'http://46.28.111.241:8081/exist/db/apps/karolinum-x/modules/dtp-utils';
import module namespace cust-utils = 'http://46.28.111.241:8081/exist/db/apps/karolinum-x/modules/cust-utils' at 'cust-utils.xqm';
declare namespace tei = 'http://www.tei-c.org/ns/1.0';
(:~ This module is useful for in-memory converting of TEI Simpe XML into XML suitable
: for importing into InDesign. It is not a silver bullet, it was tested and developed
: for a very specific scenario. However, it should be useful for anyone who uses TEI
: Simple XML (possibly with minor modifications of replacing strings and so on) and
@grantmacken
grantmacken / muURL.xqm
Last active June 5, 2024 22:33
xQuery helper functions for dealing with URLs
xquery version "3.0";
(:~
This module contains helper functions for dealing with URLs.
When receiving webmention the post parameter 'source' is a URL pointing to the
origin of the mention.
Before we get and store a sanitized version of an HTML document the url links to
we want to able to
@koseki
koseki / ISO639-1.txt
Last active February 1, 2022 21:41
ISO 639-1 Code => English Name text list / http://www.loc.gov/standards/iso639-2/ascii_8bits.html
aa Afar
ab Abkhazian
af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
an Aragonese
hy Armenian
as Assamese
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 22, 2024 02:29
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@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.
@nicktoumpelis
nicktoumpelis / repo-rinse.sh
Created April 23, 2014 13:00
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive