Skip to content

Instantly share code, notes, and snippets.

@mikesname
mikesname / osticket.md
Last active August 2, 2021 10:59
OSTicket no thread displayed...

OSTicket Duplicate email debugging

Problem:

  • Threads not being show when opening ticket
  • No JS or other apparent UI errors

Error in Apache logs:

@mikesname
mikesname / data-from-graphql.py
Last active May 5, 2020 19:38
Processing data from GraphQL to CSV. Install the ijson module first.
#!/usr/bin/env python3
import csv, ijson, sys
items = ijson.items(sys.stdin, "data.documentaryUnits.items.item")
csvout = csv.writer(sys.stdout, quoting = csv.QUOTE_MINIMAL)
for item in items:
for description in item["descriptions"]:
row = [
@mikesname
mikesname / repository-names.gql
Last active November 1, 2016 16:15
GraphQL query for retrieving repository id and names from the EHRI GraphQL API
query exampleQuery($cursor: Cursor) {
repositories(after: $cursor) {
items {
id
description {
name
}
}
pageInfo {
nextPage
@mikesname
mikesname / history.py
Last active November 7, 2017 13:33
An example for fetching data from the EHRI GraphQL API and converting it to TSV
#!/usr/bin/env python3
# Fetch id, name, and scope-content data for documentary units
# and write as tab-separated values.
import sys, requests, csv, json
if len(sys.argv) < 1:
sys.stderr.write("usage: history.py <initial-api-url>\n")
sys.exit(1)
@mikesname
mikesname / scopecontent.py
Last active September 22, 2016 16:44
Fetch id, name, and scope-content data for documentary units # and write as tab-separated values.
#!/usr/bin/env python3
# Fetch id, name, and scope-content data for documentary units
# and write as tab-separated values.
import sys, requests, csv, urllib
if len(sys.argv) < 1:
sys.stderr.write("usage: scopecontent.py <initial-api-url>\n")
sys.exit(1)
@mikesname
mikesname / scopecontent.py
Created September 20, 2016 12:40
Fetch scope and content data for the EHRI v1 API
#!/usr/bin/env python
import sys, requests
if len(sys.argv) < 1:
print("usage: scopecontent.py <url>")
sys.exit(1)
def scope_content(url):
r = requests.get(url, headers={"Authorization": "Bearer EHRI-Dev"})
implicit def longMapReads[T](implicit r: Reads[T]): Reads[Map[Long, T]] = Reads[Map[Long, T]] { jv =>
jv.validate[Map[String, T]].flatMap { obj =>
obj.foldLeft[JsResult[Map[Long,T]]](JsSuccess(Map.empty)) {
case (JsSuccess(o, p), (k, v)) =>
try {
JsSuccess(o + (k.toLong -> v))
} catch {
case e: IllegalArgumentException =>
val e = ValidationError(s"Value: '$k' cannot be converted to a Long")
JsError(p, e)
package controllers;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import akka.actor.UntypedActor;
import com.google.inject.Inject;
# First, log into the EHRI staging server
# Actually open a bunch of shells
# In one of them, tail the following file, which will give us some information
# about what goes wrong when something inevitably goes wrong
tail -f /opt/webapps/neo4j-version/data/log/console.log
# Next, in another shell, copy the file(s) to be ingested to the server
# and place them in /opt/webapps/data/import-data/de/de-002409
# (de-002409 is ITS's EHRI ID.)
2744470 / 2053936
text/RG-50.030.0001_trs_en.txt Warsaw 0.009380871
text/RG-50.030.0001_trs_en.txt 19 0.002966492
text/RG-50.030.0001_trs_en.txt Varka 0.0020976267
text/RG-50.030.0001_trs_en.txt Gesha 0.0020976267
text/RG-50.030.0001_trs_en.txt Slovakia 0.0020976267
text/RG-50.030.0001_trs_en.txt Amy 0.0020976267
text/RG-50.030.0001_trs_en.txt wasa 0.0020976267
text/RG-50.030.0001_trs_en.txt upa 0.0020976267
text/RG-50.030.0002_trs_en.txt Lodz 0.006228336