Skip to content

Instantly share code, notes, and snippets.

@peterVG
peterVG / METS.248772ca-9f53-4972-bcd7-f77afb1fae4f.xml
Created August 26, 2021 16:48
Archivematica 1.12 METS sample file
<?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/version1121/mets.xsd">
<mets:metsHdr CREATEDATE="2020-06-11T23:05:01"/>
<mets:dmdSec ID="dmdSec_1">
<mets:mdWrap MDTYPE="PREMIS:OBJECT">
<mets:xmlData>
<premis:object xmlns:premis="http://www.loc.gov/premis/v3" xsi:type="premis:intellectualEntity" xsi:schemaLocation="http://www.loc.gov/premis/v3 http://www.loc.gov/standards/premis/v3/premis.xsd" version="3.0">
<premis:objectIdentifier>
<premis:objectIdentifierType>UUID</premis:objectIdentifierType>
<premis:objectIdentifierValue>248772ca-9f53-4972-bcd7-f77afb1fae4f</premis:objectIdentifierValue>
@peterVG
peterVG / decode_base64.py
Last active October 4, 2020 15:08
Attempt to decode Md5 hashes in base64 format
import base64
sample_string_bytes = base64.b64decode("KFukvivpCM5QXl5SqKe41g==")
print(f"Bytes: {sample_string_bytes}")
try:
sample_string = sample_string_bytes.decode("utf-8")
print(f"Decoded string: {sample_string}")
except Exception as e:
@peterVG
peterVG / ipfs-on-raspberry-pi.md
Last active April 28, 2024 22:34
Put IPFS decentralized storage on your Raspberry Pi with USB storage

I put IPFS on a Raspberry Pi and so should you!

Total cost of joining the decentralized storage revolution with your own lo-fi node: $124 USD

raspberry-ipfs

@peterVG
peterVG / mysql_aipfiles.py
Last active May 26, 2020 20:31
Populate MySQL database with AIPscan data for use as Grafana datasource
import pymysql.cursors
import sqlite3
mysqlConnection = pymysql.connect(
host="localhost",
user="grafana",
password="grafana",
db="grafana",
charset="utf8mb4",
cursorclass=pymysql.cursors.DictCursor,
@peterVG
peterVG / atom-sql-insert.py
Last active May 2, 2020 21:54
Insert Archivematica AIP file metadata into AtoM MySQL database
# pip install pymysql
import pymysql.cursors
import sqlite3
import datetime
sqliteDbName = "am_es_cdd02460-c432-4bdc-bca3-34ae3fb006a6.db"
atomSiteURL = "http://10.10.10.10/"
# Connect to the am-2-atom-metadata-migrator Sqlite database
sqliteDb = sqlite3.connect(sqliteDbName)
@peterVG
peterVG / es-am-query.py
Last active May 2, 2020 20:26
Archivematica Elasticsearch query client
import datetime
import sys
import json
import os.path
import sqlite3
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import RequestError, NotFoundError
# Connect to Elasticsearch
@peterVG
peterVG / es_curl_requests.txt
Last active April 30, 2020 15:06
Elasticsearch request
curl -H 'Content-Type: application/json' -X GET 'http://localhost:9200/_search' -d'
{
"query": {
"match_all": {}
}
}' > es.json
curl -s -XGET http://localhost:9200/aipfiles/_doc/_count?q=fileExtension:jpg | jq '.count'

Keybase proof

I hereby claim:

  • I am peterVG on github.
  • I am petervg (https://keybase.io/petervg) on keybase.
  • I have a public key whose fingerprint is B34F 3BC2 BFFF 47F3 ADAC 388F 2C3E 1014 E2C7 0910

To claim this, I am signing this object: