Skip to content

Instantly share code, notes, and snippets.

Avatar

Rick Companje companje

View GitHub Profile
@companje
companje / updateRecords.py
Created Jun 2, 2021
Correcties uit spreadsheet doorvoeren in JSON bestanden Vele Handen
View updateRecords.py
#!/usr/bin/env python3
import json,csv,sys,glob
from sys import argv
# met dit script worden correcties die gemaakt zijn in een spreadsheet doorgevoerd
# in de JSON data die afkomstig is van de crowd op Vele Handen.
# input: 1 of meerdere JSON files als arguments.
# de CSV's met locaties, achternamen, voornamen en tussenvoegsels staan hardcoded in het script.
# output: 1 of meerdere JSON files in JSON-output/ map.
@companje
companje / minr-guid.py
Last active May 31, 2021
CSV with record IDs and GUIDs to RDF Turtle
View minr-guid.py
#!/usr/bin/env python
import csv
print("@prefix hua: <https://hetutrechtsarchief.nl/id/> .")
print("@prefix owl: <http://www.w3.org/2002/07/owl#> .")
print()
with open("ID-GUID.csv") as f:
reader = csv.DictReader(f, delimiter=",", fieldnames=["minr","GUID"])
@companje
companje / matchFlexveldLocatiesAanWikidata.py
Created May 27, 2021
match Flexveld Locaties aan Wikidata
View matchFlexveldLocatiesAanWikidata.py
#!/usr/bin/env python
import csv
data = []
straten = {}
# make dictionary key=straat value=Wikidata URI (3400 items)
with open("wikidata-straten-utrecht.csv") as f:
reader = csv.DictReader(f, delimiter=",")
for row in reader:
straten[row["label"]] = row["s"]
@companje
companje / Archiefeenheden met lokatie flexveld waarde.sql
Created May 27, 2021
Archiefeenheden met lokatie flexveld waarde
View Archiefeenheden met lokatie flexveld waarde.sql
SELECT guid, fvd_id, TRIM(waarde)
FROM archiefeenheden ahd
JOIN archiefeenheid_waarden aew
ON ahd.id=aew.ahd_id
WHERE TRIM(waarde) IS NOT NULL
AND fvd_id IN (3218,3010,3048,3067,3086,3101,3103,3110,3136,3165,3193,3011,3049,3068,3087,3100,3104,3111,316,3194,2953,3183,3463,3720,8461,542,2955,2967,3040,3043,3062,3081,3106,3160,3188,3239,3248,410,4541,8792,645,3674,4186,8790,8801,8904,183,458,2930,2941,3220,298,3523,647,8814,8806,88073211,2940,3219,450,656,761,8903,3149,1231,8469,4929,5081,5154,5227,263,3464,4174,8793,214,504,5127,5200,61,8685,5806,6667,7153,7337,5805,6666,7152,5807,6668,7154,8728,5808,6669,8736,592,2962,2974,3041,3044,3063,3082,3107,3161,3189,3240,566,567,5815,6676,7162,8752,7352,584,6554172,8791,4239,4240,4317,4198,4490,4492,4493,4503,4491,247,273,275,276,4495,5440,4173,541,63,8459,4642,4643,4640,4639,4638,4641)
ORDER BY TRIM(waarde)
@companje
companje / Utrechtse Straten op Wikidata.csv
Last active May 27, 2021
Utrechtse Straten op Wikidata (afkomstig uit hualab.nl/opdekaart)
View Utrechtse Straten op Wikidata.csv
Straatnaam Wikidata ID
s-Gravendamseweg http://www.wikidata.org/entity/Q19514440
s-Gravenweg http://www.wikidata.org/entity/Q2594444
t Goylaan http://www.wikidata.org/entity/Q19561981
t Hoog http://www.wikidata.org/entity/Q19562129
t Spijck http://www.wikidata.org/entity/Q19562874
t Zand http://www.wikidata.org/entity/Q19563275
1e Achterstraat http://www.wikidata.org/entity/Q18925146
1e Atjehstraat http://www.wikidata.org/entity/Q18925149
1e Brandenburgerweg http://www.wikidata.org/entity/Q18925169
@companje
companje / Unieke locaties uit Flexvelden.sql
Last active May 27, 2021
Unieke locaties uit Flexvelden
View Unieke locaties uit Flexvelden.sql
SELECT TRIM(waarde) AS waarde, COUNT(*) AS c
FROM archiefeenheden ahd
JOIN archiefeenheid_waarden aew
ON ahd.id=aew.ahd_id
WHERE TRIM(waarde) IS NOT NULL
AND fvd_id IN (3218,3010,3048,3067,3086,3101,3103,3110,3136,3165,3193,3011,3049,3068,3087,3100,3104,3111,316,3194,2953,3183,3463,3720,8461,542,2955,2967,3040,3043,3062,3081,3106,3160,3188,3239,3248,410,4541,8792,645,3674,4186,8790,8801,8904,183,458,2930,2941,3220,298,3523,647,8814,8806,88073211,2940,3219,450,656,761,8903,3149,1231,8469,4929,5081,5154,5227,263,3464,4174,8793,214,504,5127,5200,61,8685,5806,6667,7153,7337,5805,6666,7152,5807,6668,7154,8728,5808,6669,8736,592,2962,2974,3041,3044,3063,3082,3107,3161,3189,3240,566,567,5815,6676,7162,8752,7352,584,6554172,8791,4239,4240,4317,4198,4490,4492,4493,4503,4491,247,273,275,276,4495,5440,4173,541,63,8459,4642,4643,4640,4639,4638,4641)
GROUP BY TRIM(waarde)
ORDER BY c DESC
@companje
companje / HetVolk-CSV-to-JSON.php
Last active Jun 17, 2021
PHP script voor conversie van CSV vanaf HetVolk.org naar volledige JSON
View HetVolk-CSV-to-JSON.php
<?php
$rows = [];
if (($file = fopen($argv[1], "r")) !== FALSE) {
if (fgets($file, 4) !== "\xef\xbb\xbf") rewind($file); //Skip BOM if present
while (($data = fgetcsv($file, 0, ";", "\"" , "\\")) !== FALSE) {
$row = [];
$row["id"] = $data[0];
$row["title"] = $data[1];
@companje
companje / sysinfo.pde
Created Jan 26, 2021
Processing sysinfo
View sysinfo.pde
println( "__SYS INFO :");
println( "System : " + System.getProperty("os.name") + " " + System.getProperty("os.version") + " " + System.getProperty("os.arch") );
println( "JAVA : " + System.getProperty("java.home") + " rev: " +javaVersionName);
//println( System.getProperty("java.class.path") );
//println( "\n" + isGL() + "\n" );
println( "OPENGL : VENDOR " + PGraphicsOpenGL.OPENGL_VENDOR+" RENDERER " + PGraphicsOpenGL.OPENGL_RENDERER+" VERSION " + PGraphicsOpenGL.OPENGL_VERSION+" GLSL_VERSION: " + PGraphicsOpenGL.GLSL_VERSION);
println( "user.home : " + System.getProperty("user.home") );
println( "user.dir : " + System.getProperty("user.dir") );
println( "user.name : " + System.getProperty("user.name") );
println( "sketchPath : " + sketchPath() );
View removeIf.pde
lines.removeIf(o -> (((TextLine)o).cell == null)); //remove all lines that are not assigned to a cell
View 0_GraphMaker.pde
int y[];
int res=8;
int space=2;
int maxheight=170;
void setup() {
size(2000, 200);
y = new int[width/res];
for (int x=0; x<y.length; x++) {
y[x]=maxheight;