Skip to content

Instantly share code, notes, and snippets.

View jdkirkwood's full-sized avatar

John Kirkwood (kij) jdkirkwood

  • Kirkwood Communications
  • Aberfeldy, Scotland
View GitHub Profile
@jdkirkwood
jdkirkwood / sort-xml.xsl
Created September 17, 2021 14:45
XML sort template
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://stackoverflow.com/a/16305113/7643972 -->
<!-- <?xml-stylesheet type="text/xsl" href="../../../sort-xml.xsl"?> -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" />
<xsl:strip-space elements="*"/>
<xsl:template match="text()[not(string-length(normalize-space()))]"/>
<xsl:template match="/*">
<xsl:copy>
@jdkirkwood
jdkirkwood / sort-xml.py
Last active October 6, 2021 17:20
XML sort script
#!python3
# https://stackoverflow.com/a/66596507/7643972
import os
import sys
from lxml import etree
if len(sys.argv) < 2:
print("usage : sort_xml.py file_in.xml [file_in_sorted.xml]")
@jdkirkwood
jdkirkwood / complete_odev.sh
Last active March 16, 2022 12:24
odev bash completion script
# odev tab completion script
# Version: 0.2
# Install: Add a call to this script in ~/.bash_completion or copy the script into /etc/bash_completion.d/
# 'source' the file to use the features in the current session.
# Call function 'odev_cache' to rebuild the cached list of databases.
# clear global cache
_odev_complete_list=""
odev_cache ()