Skip to content

Instantly share code, notes, and snippets.

Avatar

Alan Orth alanorth

View GitHub Profile
View convert-av1.sh
#!/usr/bin/env bash
#
# v2021-04-29
#
# I run it like this (using zsh syntax):
#
# $ for video (~/Pictures/2021/**/*.mp4(ND.)); do ~/Downloads/av1-tests/convert-av1.sh "$video"; done
#
# Reference:
# - https://ffmpeg.org/ffmpeg-codecs.html#libaom_002dav1
@alanorth
alanorth / doi-to-handle.py
Created Jan 5, 2021
DOI to Handle script so we can Tweet some Handles without Altmetric scores and have Altmetric notice them
View doi-to-handle.py
#!/usr/bin/env python3
#
# doi-to-handle.py 0.0.1
#
# Copyright 2021 Alan Orth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@alanorth
alanorth / dspace6-post-item-rest.md
Last active Oct 7, 2020
POSTing items to the DSpace 6 REST API
View dspace6-post-item-rest.md

POSTing an item to /collections

First log in to get the JSESSIONID cookie and then post the item (I'm using httpie instead of curl):

$ http -f POST https://dspacetest.cgiar.org/rest/login email=aorth@mjanja.ch password=fuuuu
$ http https://dspacetest.cgiar.org/rest/status Cookie:JSESSIONID=EABAC9EFF942028AA52DFDA16DBCAFDE
$ http POST https://dspacetest.cgiar.org/rest/collections/f10ad667-2746-4705-8b16-4439abe61d22/items Cookie:JSESSIONID=EABAC9EFF942028AA52DFDA16DBCAFDE < item-object.json
HTTP/1.1 200 OK
Connection: keep-alive
Content-Encoding: gzip
@alanorth
alanorth / request.json
Created Sep 25, 2020
DSpace Statistics API with POST to /items
View request.json
{
"limit": 10,
"page": 0,
"dateFrom": "2020-01-01T00:00:00Z",
"dateTo": "2020-09-09T00:00:00Z",
"items": ["f44cf173-2344-4eb2-8f00-ee55df32c76f", "2324aa41-e9de-4a2b-bc36-16241464683e", "8542f9da-9ce1-4614-abf4-f2e3fdb4b305", "0fe573e7-042a-4240-a4d9-753b61233908", "b2c1bbfd-65b0-438c-9e49-d271c49b2696", "000dc7cd-9485-424b-8ecf-78002613cc87", "000e1616-3901-4431-80b1-c6bc67312d8c", "000e61ca-695d-43e5-9ab8-1f3fd7a67a32", "000ea897-5557-49c7-9f54-9fa192c0f83b", "000ec427-97e5-4766-85a5-e8dd62199ab5", "000f60f1-19d6-436a-b607-1573901fbfe4", "0010511b-a15f-496a-93b4-1885e6cf9ad8", "00115034-8e0f-4665-b589-e30ed01378ed", "001289a1-260c-466c-8def-5a786cf06ca7", "0012c0d0-6224-4f8a-84a6-0a4281bd8837", "0013519c-6753-4fe1-afff-22e0060140c7", "00135d25-b5f8-4bea-92ae-9bbecb2b441f", "0013f7e9-8def-45e0-aaf2-16cbc09d3d34", "0014d899-a29e-4472-84aa-e8b42ccaa687", "0015da03-c836-4e58-bfd7-d5bac17f8c3e", "0015e295-18a9-4bd2-ab44-99cf0a5cd4ee", "0016716f-e980-4aa7-b196-13bb9f69215a", "00193a18-dba5-43b
@alanorth
alanorth / direct-query-views.py
Last active Sep 23, 2020
Direct Solr query for items in a specific date range
View direct-query-views.py
#!/usr/bin/env python3
import re
import requests
# Enumerate the cores in Solr to determine if statistics have been sharded into
# yearly shards by DSpace's stats-util or not (for example: statistics-2018).
def get_statistics_shards():
@alanorth
alanorth / monster-software.md
Last active Aug 27, 2020
Software installed for Abdulfatai on Monster server in Addis in 2020-08
View monster-software.md

Software Installation Notes

A list of software installed on the Monster server in Addis in 2020-08:

  • AdapterRemoval/2.3.1
  • AdmixTools/7.0.1
  • bamstats/1.25
  • bcftools/1.10.2
  • bowtie2/2.4.1
  • fastq_screen/0.14.1
  • fastqc/0.11.9
@alanorth
alanorth / iso3166-1.json
Created Jul 31, 2020
ISO 3166-1 JSON from iso-codes
View iso3166-1.json
{
"3166-1": [
{
"alpha_2": "AW",
"alpha_3": "ABW",
"name": "Aruba",
"numeric": "533"
},
{
"alpha_2": "AF",
@alanorth
alanorth / mytask.py
Created Jul 29, 2020
Jython-based curation task to update countryCodes based on countries
View mytask.py
import json
from org.dspace.core import ConfigurationManager
from org.dspace.curate import ScriptedTask
class MyTask(ScriptedTask):
def init(self, curator, taskName):
print "Initializing MyTask with Jython"
@alanorth
alanorth / list.txt
Created Jul 19, 2020
BTRFS subvolume list
View list.txt
ID gen top level path
-- --- --------- ----
256 3176 5 @
257 3186 5 @home
491 3152 257 @home/.snapshots
543 1679 491 @home/.snapshots/1/snapshot
560 2108 491 @home/.snapshots/10/snapshot
562 2130 491 @home/.snapshots/11/snapshot
564 2161 491 @home/.snapshots/12/snapshot
566 2224 491 @home/.snapshots/13/snapshot
@alanorth
alanorth / PKGBUILD
Created Jun 9, 2020
OTPClient 2.3.1 PKGBUILD for Arch Linux AUR
View PKGBUILD
# Maintainer: Stephen Gregoratto <dev@sgregoratto.me>
pkgname=otpclient
_pkgname=OTPClient
pkgver=2.3.1
pkgrel=1
pkgdesc="A simple GTK+ v3 TOTP/HOTP client"
url="https://github.com/paolostivanin/OTPClient"
license=('GPL3')
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
depends=('gtk3>=3.22' 'jansson' 'libzip' 'libcotp' 'zbar>=0.20')