Skip to content

Instantly share code, notes, and snippets.

View michimau's full-sized avatar

Mauro Michielon michimau

  • European Food Safety Authority
  • Parma
View GitHub Profile
@michimau
michimau / bash.bashrc
Last active February 19, 2023 17:48
customize /etc/bash.bashrc
clear
if (( $EUID == 0 )); then
{ printf "Remember while being root: \n\"with great power comes great responsibility!\"\n\n";} | /usr/games/cowthink
else
if [ $RANDOM -le 1000 ]; then
/usr/games/sl -ale
else
{ /usr/games/fortune; printf "\nWelcome back, "; whoami; } | /usr/games/cowthink
fi
fi
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX euniss: <http://eunis.eea.europa.eu/rdf/species-schema.rdf#>
PREFIX eunist: <http://eunis.eea.europa.eu/rdf/taxonomies-schema.rdf#>
PREFIX dwcterms: <http://rs.tdwg.org/dwc/terms/>
SELECT DISTINCT
?speciesURI
?species
?photo
@michimau
michimau / gist:7e62328aedebcc6829c547b7b8461b76
Last active October 7, 2022 08:10
PHP memory nexcloud occ
apt-get -y update
apt-get -y install sudo
sudo -u www-data PHP_MEMORY_LIMIT=512M php ./occ
@michimau
michimau / gist:f49078322452fdb9acc44dcacd632c7d
Last active July 22, 2022 07:37
downloads files from the cms to the filesystem of sdi
#!/bin/bash
scriptdir=/opt/cms2sdi
basedir=/var/local/gis_sdi/continental/tabular
excelfile=https://shareit.eea.europa.eu/s/BMDXbQHMt7wwxfW/download
wget -l --content-disposition -nc $excelfile
xlsx2csv -s 3 -d='tab' -q='all' download | awk 'BEGIN { FS = "[\t]+" } ; { print $5,$24 }' > $scriptdir/cms2sdi.txt
mkdir -p $basedir
PREFIX DataFileLink: <http://www.eea.europa.eu/portal_types/DataFileLink#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX data: <http://www.eea.europa.eu/portal_types/Data#>
SELECT
?data
?id
?remoteUrl
min(xsd:integer(?temporalCoverage)) AS ?minYear
max(xsd:integer(?temporalCoverage)) AS ?maxYear
@michimau
michimau / gist:710ce77403b8ff849701838b4fe3a818
Created June 1, 2022 19:41
nodejs example for openid integration
const express = require('express');
const { auth, requiresAuth } = require('express-openid-connect');
process.env.SECRET = 'verysecretcode'
process.env.BASE_URL = 'http://localhost:8080'
process.env.CLIENT_ID = 'client_id'
process.env.ISSUER_BASE_URL = 'https://login.eea.europa.eu/realms/login-eea'
const app = express();
app.use(
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX cr: <http://cr.eionet.europa.eu/ontologies/contreg.rdf#>
PREFIX aqd: <http://rdfdata.eionet.europa.eu/airquality/ontology/>
PREFIX aq: <http://reference.eionet.europa.eu/aq/ontology/>
PREFIX AirQualityReporting: <http://dd.eionet.europa.eu/schemas/id2011850eu-1.0/AirQualityReporting.xsd>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rod: <http://rod.eionet.europa.eu/schema.rdf#>
PREFIX obligations: <http://rod.eionet.europa.eu/obligations/>
SELECT DISTINCT ?inspireLabel ?pollutant ?objectiveType ?reportingMetric ?protectionTarget
@michimau
michimau / gist:e0cb78e1e856fb406c3a04ba840ffcec
Last active May 3, 2022 11:52
create tabular data folder from cms to sdi
#!/bin/bash
TARGETDIRECTORY=/home/lubuntu/docker_work/tabular2sdi/tabular/
curl -q 'https://semantic.eea.europa.eu/sparql?selectedBookmarkName=&query=PREFIX+DataFileLink%3A+%3Chttp%3A%2F%2Fwww.eea.europa.eu%2Fportal_types%2FDataFileLink%23%3E%0D%0APREFIX+dcterms%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%0D%0APREFIX+data%3A+%3Chttp%3A%2F%2Fwww.eea.europa.eu%2Fportal_types%2FData%23%3E%0D%0A%0D%0ASELECT+%0D%0A%3Fdata%0D%0A%3Fid%0D%0A%3FremoteUrl%0D%0Amin%28xsd%3Ainteger%28%3FtemporalCoverage%29%29+AS+%3FminYear%0D%0Amax%28xsd%3Ainteger%28%3FtemporalCoverage%29%29+AS+%3FmaxYear%0D%0A%0D%0AWHERE+%7B%0D%0A++%3FDataFileLink+a+DataFileLink%3ADataFileLink+.%0D%0A++%3FDataFileLink+dcterms%3Atitle+%3Ftitle+.+%0D%0A++%3FDataFileLink+DataFileLink%3AremoteUrl+%3FremoteUrl+.%0D%0A++%3FdataTable+dcterms%3AhasPart+%3FDataFileLink+.%0D%0A++%3Fdata+dcterms%3AhasPart+%3FdataTable+.%0D%0A++%3Fdata+data%3Aid+%3Fid+.%0D%0A++%3Fdata+data%3AtemporalCoverage+%3FtemporalCoverage+.%0D%0A%7D&format=text%2Fcsv&nrOfHits=999&execute=
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX data: <http://www.eea.europa.eu/portal_types/Data#>
PREFIX schema: <http://schema.org/>
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT DISTINCT
?data
#count(?themes) AS ?count_themes
?productID
?identifier
@michimau
michimau / demo-login-plone6.json
Created March 18, 2022 15:23
demo-login-plone6
{
"clientId": "demo-login-plone6",
"name": "demo-login-plone6",
"rootUrl": "",
"adminUrl": "https://demo-login-plone6.whatever.com",
"baseUrl": "https://demo-login-plone6..whatever.com/",
"surrogateAuthRequired": false,
"enabled": true,
"alwaysDisplayInConsole": false,
"clientAuthenticatorType": "client-secret",