Skip to content

Instantly share code, notes, and snippets.

View bitsgalore's full-sized avatar

Johan van der Knijff bitsgalore

View GitHub Profile
@bitsgalore
bitsgalore / apache-default.png
Last active April 11, 2018 03:32
Serving a static website with the Apache web server
apache-default.png

Debian packaging cheat sheet

(From old notes, circa 2013)

List contents

dpkg --contents PACKAGENAME

Remove package

@bitsgalore
bitsgalore / epub-CB.csv
Last active March 13, 2018 17:31
Plot CSV data as histogram in GNUPlot using log transform
fileName wordCount
/media/johan/Elements/epub-CB/20150505/20150505123129_9789074622745.epub 100352
/media/johan/Elements/epub-CB/20150505/20150505123129_9789074622752.epub 141269
/media/johan/Elements/epub-CB/20150505/20150505123129_9789074622769.epub 189752
/media/johan/Elements/epub-CB/20150505/20150505123129_9789074622776.epub 77115
/media/johan/Elements/epub-CB/20150505/20150505123129_9789074622783.epub 385038
/media/johan/Elements/epub-CB/20150505/20150505123129_9789074622790.epub 153177
/media/johan/Elements/epub-CB/20150505/20150505123129_9789074622806.epub 294620
/media/johan/Elements/epub-CB/20150505/20150505123129_9789074622813.epub 282505
/media/johan/Elements/epub-CB/20150505/20150505123129_9789074622868.epub 247334
@bitsgalore
bitsgalore / epubwc.sh
Last active March 13, 2018 15:00
Compute word count on EPUB files in a directory tree
#!/bin/bash
# Perform word count on each EPUB file in directory tree; report result as CSV
#
# Dependencies:
#
# - java
# - tika-server (see link here: https://tika.apache.org/download.html)
# - curl (installed by default on most Unix systems)
# - wc (installed by default on most Unix systems)
@bitsgalore
bitsgalore / epubcheck.sh
Created March 7, 2018 13:12
Epubcheck launcher
#!/bin/bash
# Infer location of JAR from script location (source: https://stackoverflow.com/a/246128)
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
#!/bin/bash
# Convert directory with JP2 images to TIFF
# Requires Kakadu (kdu_expand) and ExifTool
# Display usage message if command line does not contain expected
# number of arguments
if [ "$#" -ne 2 ] ; then
echo "Usage: JP2ToTiff.sh dirIn dirOut" >&2
exit 1
#!/bin/bash
# Convert directory with JP2 images to TIFF
# Requires Kakadu (kdu_expand) and ExifTool
# Display usage message if command line does not contain expected
# number of arguments
if [ "$#" -ne 2 ] ; then
echo "Usage: JP2ToTiff.sh dirIn dirOut" >&2
exit 1
<mets:mets xmlns:cd-info="https://www.gnu.org/software/libcdio/libcdio.html#cd_002dinfo" xmlns:dfxml="http://www.forensicswiki.org/wiki/Category:Digital_Forensics_XML" xmlns:ebucore="urn:ebu:metadata-schema:ebucore" xmlns:isolyzer="https://github.com/KBNLresearch/isolyzer" xmlns:mets="http://www.loc.gov/METS/" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:premis="http://www.loc.gov/premis/v3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/mets.xsd http://www.loc.gov/mods/v3 https://www.loc.gov/standards/mods/v3/mods-3-4.xsd http://www.loc.gov/premis/v3 https://www.loc.gov/standards/premis/premis.xsd" TYPE="SIP">
<mets:dmdSec ID="dmdSec_1">
<mets:mdWrap MDTYPE="MODS" MDTYPEVERSION="3.4">
<mets:xmlData>
<mods:mods>
<mods:titleInfo>
<mods:title>Marjan Berk</mods:title>
</mods:titleInfo>
<mods:name>
<mods:namePart
@bitsgalore
bitsgalore / mets-cdinfo-dfxml.xml
Created February 8, 2018 17:10
Example METS file for "enhanced" audio CD
This file has been truncated, but you can view the full file.
<mets:mets xmlns:cd-info="cd-info" xmlns:dfxml="http://www.forensicswiki.org/wiki/Category:Digital_Forensics_XML" xmlns:ebucore="urn:ebu:metadata-schema:ebuCore_2017" xmlns:isolyzer="https://github.com/KBNLresearch/isolyzer" xmlns:mets="http://www.loc.gov/METS/" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:premis="http://www.loc.gov/premis/v3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/mets.xsd http://www.loc.gov/mods/v3 https://www.loc.gov/standards/mods/v3/mods-3-4.xsd http://www.loc.gov/premis/v3 https://www.loc.gov/standards/premis/premis.xsd">
<mets:dmdSec ID="dmdSec_1">
<mets:mdWrap MDTYPE="MODS" MDTYPEVERSION="3.4">
<mets:xmlData>
<mods:mods>
<mods:titleInfo>
<mods:title>Thea Beckman</mods:title>
</mods:titleInfo>
<mods:name>
<mods:namePart>Binnendijk, Dik</mods:namePart>
@bitsgalore
bitsgalore / cd-info.xml
Created February 7, 2018 16:58
First stab at XML serialization of cd-info output
<cd-info:cd-info xmlns:cd-info="https://www.gnu.org/software/libcdio" xmlns:ebucore="urn:ebu:metadata-schema:ebuCore_2017" xmlns:isolyzer="https://github.com/KBNLresearch/isolyzer" xmlns:mets="http://www.loc.gov/METS/" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:premis="http://www.loc.gov/premis/v3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<cd-info:trackList>
<cd-info:track>
<cd-info:trackNumber>1</cd-info:trackNumber>
<cd-info:MSF>00:02:00</cd-info:MSF>
<cd-info:LSN>000000</cd-info:LSN>
<cd-info:Type>audio</cd-info:Type>
</cd-info:track>
<cd-info:track>
<cd-info:trackNumber>2</cd-info:trackNumber>