Skip to content

Instantly share code, notes, and snippets.

Avatar

Alan Orth alanorth

View GitHub Profile
@alanorth
alanorth / purge_haplotigs.log
Created Jun 21, 2021
purge_haplotigs test log on HPC
View purge_haplotigs.log
[aorth@hpc: ~]$ module load purge_haplotigs/1.1.1
[aorth@hpc: ~]$ purge_haplotigs test
purge_haplotigs readhist -b aligned.bam -g contigs.fa
[21-06-2021 12:25:50] bedtools OK!
[21-06-2021 12:25:50] Rscript OK!
[21-06-2021 12:25:50] samtools OK!
[21-06-2021 12:25:50] ALL DEPENDENCIES OK
[21-06-2021 12:25:51] Beginning read-depth histogram generation
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 / move_collections.sh
Last active Apr 28, 2021
Move DSpace collection(s) from one community to another. DSpace doesn't have a built-in tool to do this, so you have to use raw SQL commands.
View move_collections.sh
#!/usr/bin/env bash
#
# Moves DSpace collections from one community to another. Takes a list of
# handles, then resolves their internal resource_id's and reassigns the
# community relationship. Assumed to be running as `postgres` Linux user.
#
# I don't think reindexing is required, because no metadata has changed,
# and therefore no search or browse indexes need to be updated. You might
# need to clear the Cocoon cache to see the updated breadcrumb trails.
#
@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 / gist:2257946
Created Mar 30, 2012
Fix melfas touch screen on ICS
View gist:2257946
diff --git a/drivers/input/touchscreen/melfas_ts.c b/drivers/input/touchscreen/melfas_ts.c
index 2bb5b95..3b6e9c1 100755
--- a/drivers/input/touchscreen/melfas_ts.c
+++ b/drivers/input/touchscreen/melfas_ts.c
@@ -144,7 +144,8 @@
input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); \
input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); \
input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, amplitude); \
- input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, width); \
+ input_report_abs(ts->input_dev, ABS_MT_PRESSURE, amplitude); \
@alanorth
alanorth / arch-install-encrypted.md
Last active Oct 11, 2020
Installing Arch Linux on an SSD with plain boot but encrypted /, /home, etc.
View arch-install-encrypted.md
@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 / check-clear-version.sh
Last active Sep 27, 2020
Script to help with updating the Arch Linux PKGBUILDs for Clear Linux
View check-clear-version.sh
#!/usr/bin/env bash
#
# check-clear-version.sh v2020-09-27.0
#
# Script to check for the latest Clear Linux version, download the native and
# dev manifests, extract the kernel version and config hash, and finally upd-
# the PKGBUILD variables for linux-clear-bin and linux-clear-headers-bin.
#
# Based on the logic first implemented by yw662 on the Arch Linux AUR packages
# for linux-clear-bin and linux-clear-headers-bin.
@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():