Skip to content

Instantly share code, notes, and snippets.

<!doctype html>
<html lang="en">
<head>
<title>#YesAllWomen tweetmap</title>
<link rel="stylesheet" href="css/theme.css" />
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
@sallain
sallain / removespaces.sh
Last active August 29, 2015 14:02
Remove spaces from filenames!
#!/bin/bash
find . -depth -name '* *' \
| while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done
@sallain
sallain / split-vertical.md
Last active August 29, 2015 14:02 — forked from pbinkley/gist:8a69805a4e50ff823630
Split image files vertically down the centre and rename to filename-01.tif, filename-02.tif, etc.

Dependencies

Steps

  1. Create a test directory containing a few of the pages
  2. Run the following command on the test directory:
convert -crop 50%x100% +repage *.tif desiredfilename-%d.tif
  1. Check your files. If they look nice, run the command on all the files!
  2. If the crop is slightly off, you might need to adjust the -crop percentage - test out 51%x100%, 52%x100%, etc. Play around until ImageMagick is producing the output you expect
@sallain
sallain / pdf2tifconvert.md
Created June 6, 2014 18:20
ImageMagick command for converting PDFs to TIFFs.

Dependencies

Steps

  1. First, extract individual PDF pages from the document using Acrobat
  2. Create a test directory containing a few of the pages
  3. Run the following command on the test directory:
mogrify -density 300 -format tif *.pdf
  1. Check your files. If they look nice, run the command on all the files!
#!/usr/bin/env ruby
dir = ARGV[0]
batch_size = ARGV[1] || 100
all_files = Dir.glob("#{dir}/*")
num = 0
all_files.each_slice(batch_size) do |files|
cmd = "zip zip-#{num}.zip #{files.join(" ")}"
`#{cmd}`
@sallain
sallain / dublin_core_template.xml
Created December 10, 2013 14:42
Simple Dublin Core template
<!DOCTYPE rdf:RDF SYSTEM "http://dublincore.org/documents/2001/04/11/dcmes-xml/dcmes-xml-dtd.dtd">
<oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title></dc:title>
<dc:creator></dc:creator>
<dc:subject></dc:subject>
<dc:description></dc:description>
<dc:publisher></dc:publisher>
<dc:contributor></dc:contributor>
<dc:date></dc:date>
<dc:type></dc:type>
<?xml version='1.0' encoding='UTF-8'?>
<mets:mets xmlns:mets="http://www.loc.gov/METS/" 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/version18/mets.xsd">
<mets:metsHdr CREATEDATE="2017-10-05T20:36:33"/>
<mets:dmdSec ID="dmdSec_1">
<mets:mdWrap MDTYPE="DC">
<mets:xmlData>
<dcterms:dublincore xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xsi:schemaLocation="http://purl.org/dc/terms/ http://dublincore.org/schemas/xmls/qdc/2008/02/11/dcterms.xsd">
<dc:identifier>2429/36421</dc:identifier>
</dcterms:dublincore>
</mets:xmlData>
<?xml version="1.0" encoding="UTF-8"?>
<mets:mets xmlns:mods="http://www.loc.gov/mods/v3" xmlns:premis="info:lc/xmlns/premis-v2"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ead="urn:isbn:1-931666-22-9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xip="http://www.tessella.com/XIP/v4"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:mets="http://www.loc.gov/METS/"
upload-qubit_v0.0: ERROR 2018-10-11 16:14:28,372 archivematica.upload.qubit.log:64 [uploadDIP] Target:
upload-qubit_v0.0: ERROR 2018-10-11 16:14:28,373 archivematica.upload.qubit.log:64 [uploadDIP] rsync --protect-args -rltz -P --chmod=ugo=rwX /var/archivematica/sharedDirectory/watchedDirectories/uploadDIP/dip-upload-d1241cac-7f0b-48e5-b14b-ac0ce8168916 158.69.72.17:/tmp
upload-qubit_v0.0: ERROR 2018-10-11 16:14:28,375 archivematica.upload.qubit.log:64 [uploadDIP] Rsync output is being saved in /tmp/tmp4Ecz3F
upload-qubit_v0.0: ERROR 2018-10-11 16:14:30,389 archivematica.upload.qubit.log:64 [uploadDIP] Sending... 100 (ETA: 0:00:00)
upload-qubit_v0.0: ERROR 2018-10-11 16:14:31,392 archivematica.upload.qubit.log:64 [uploadDIP] Sending... 100 (ETA: 0:00:00)
upload-qubit_v0.0: ERROR 2018-10-11 16:14:31,394 archivematica.upload.qubit.log:64 [uploadDIP] About to deposit to: http://atom-24rc3-test.accesstomemory.org/sword/deposit/
upload-qubit_v0.0: ERROR 2018-10-11 16:14:31,
@sallain
sallain / 1-AIP-level.json
Created October 15, 2018 23:44
JSON files for DemoTransfer materials
{
"_id": "AWZ5BcUhAljsbiCApEBD",
"_index": "aips",
"_source": {
"AICID": null,
"countAIPsinAIC": null,
"created": 1539628675,
"encrypted": false,
"filePath": "/var/archivematica/sharedDirectory/www/AIPsStore/1670/575b/650e/461a/9496/f2d4/57b4/41ad/test2-1670575b-650e-461a-9496-f2d457b441ad.7z",
"identifiers": [],