Skip to content

Instantly share code, notes, and snippets.

View ioggstream's full-sized avatar

Roberto Polli ioggstream

View GitHub Profile
@ioggstream
ioggstream / simple.yaml
Last active April 24, 2020 15:57
simple.yaml
openapi: 3.0.0
info:
version: 0.0.1
title: verifica codice fiscale
description: |
pip install connexion connexion[swagger-ui] --user
connexion run openapi.yaml --debug --mock=all
connexion run openapi.yaml --debug --mock=notimplemented
Questo servizio verifica il
send: b'GET /SDMXWS/rest/data/115_333/..N+Y..IND_PROD2?startPeriod=2000-01 HTTP/1.1\r\nHost: sdmx.istat.it\r\nUser-Agent: python-requests/2.23.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Tue, 21 Apr 2020 12:53:33 GMT
header: Server: Microsoft-IIS/7.5
header: Cache-Control: private
header: Content-Type: application/vnd.sdmx.genericdata+xml; version=2.1; charset=utf-8
header: Accept-Ranges: values
header: Vary: Accept,Accept-Encoding
header: X-AspNet-Version: 4.0.30319
header: X-Powered-By: ASP.NET
@ioggstream
ioggstream / istat_sdmx.py
Last active April 17, 2020 09:26
Simple istat query via sdmx
from pandasdmx import Request
# Show http traces.
import http.client as http_client
http_client.HTTPConnection.debuglevel = 2
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
# Load istat configuration from config.json
@ioggstream
ioggstream / test.wadl
Created April 16, 2020 11:14
test.wadl
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<application xmlns="http://wadl.dev.java.net/2009/02">
<grammars/>
<resources base="http://sdmxb.istat.it/sdmxws/rest/">
<resource path="/{structure:datastructure|metadatastructure|categoryscheme|conceptscheme|codelist|hierarchicalcodelist|organisationscheme|agencyscheme|dataproviderscheme|dataconsumerscheme|organisationunitscheme|dataflow|metadataflow|reportingtaxonomy|provisionagreement|structureset|process|categorisation|contentconstraint|attachmentconstraint|structure}">
<param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" style="template" name="structure"/>
<method name="GET" id="getStructureAll">
<request>
<param xmlns:xs="http://www.w3.org/2001/XMLSchema" default="full" type="xs:string" style="query" name="detail"/>
<param xmlns:xs="http://www.w3.org/2001/XMLSchema" default="none" type="xs:string" style="query" name="references"/>
@ioggstream
ioggstream / ruleset.yml
Created February 20, 2020 15:54
spectral ruleset
extends: spectral:oas
rules:
servers-description:
description: Servers must have a description.
given: $.servers[*]
then:
field: description
function: truthy
@ioggstream
ioggstream / bad-oas.yaml
Last active February 28, 2020 13:10
a bad oas
responses:
'200':
description: ''
schema:
$ref: '#/definitions/error-response'
schemas:
Missing:
type: number
@ioggstream
ioggstream / render_calendar.py
Last active August 21, 2023 04:00
Render a simple calendar with python.
from datetime import datetime, timedelta, timezone
from requests import get
import icalendar
from dateutil.rrule import *
import pytz
import locale
locale.setlocale(locale.LC_TIME, "it_IT")
import time
@ioggstream
ioggstream / io-server-api-resolved.yaml
Created October 23, 2019 18:32
Resolved references in io-onboarding-pa-api
openapi: 3.0.0
info:
contact:
email: teamdigitale@governo.it
url: https://io.italia.it
description: |-
The backend used by the onboarding portal for public administrations of the IO project.
The website for the project is [io-website].
Privacy Policy is [privacy].
@ioggstream
ioggstream / person_ontology_to_schema.py
Created October 18, 2019 00:18
Renderizza i campi di un json-ld
import yaml
from os.path import basename
from pyld import jsonld
import logging
log = logging.getLogger()
logging.basicConfig(level=logging.INFO)
url = "https://ontopia-lodview.prod.pdnd.italia.it/onto/CPV/Person"
@ioggstream
ioggstream / circleci-gh-deploy-keys.md
Last active February 18, 2020 18:09
Create an ecdsa keypair and configure circleci+github for deploying on gh-pages.

Deploy to github pages with circleci

To deploy on github pages via CircleCI you need a brand new keypair.

Follow these steps.

Create a keypair.

The private key goes into this circleci page: