Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View marciuz's full-sized avatar

Marcello Verona marciuz

View GitHub Profile
<?php
function _dkan_harvest_dcatap_cache(HarvestSource $source, $harvest_updatetime) {
// This is needed for remote uri.
$context = stream_context_create(
array(
'http' => array(
'timeout' => 1200,
),
'https' => array(
@marciuz
marciuz / harvest-cron-generator.php
Last active May 8, 2017 10:37
Generatore di cron per harvest DKAN dati.gov.it
<?php
$sources = 'http://www.dati.gov.it/admin/harvest-sources-export/harvest-sources-datigovit.csv';
$eccezioni = array(
'regione_toscana',
'dati_trentino',
'dati_lombardia',
'comune_di_firenze_annstat',
);
@marciuz
marciuz / calendar_table_ita.sql
Created December 14, 2016 23:27
Italian version. The script create a calendar table, a useful tool for many databases. It is useful and quicker then create on the fly dates.
--
-- CALENDAR TABLE - Versione Italiana dello script descritto su
-- https://www.brianshowalter.com/blog/calendar_tables
-- Marcello Verona 2016 <marcelloverona@gmail.com>
--
--
-- Set italian as language
--
field_license_value n
Creative Commons Attribution 6028
Italian Open Data License 2.0 1214
http://www.dati.gov.it/iodl/2.0/ 1167
Creative Commons Attribuzione 397
Creative Commons CCZero 396
Creative Commons Attribution - CC-BY 301
Italian Open Data License v2.0 244
Creative Commons Attribution 4.0 (CC BY 4.0) 232
notspecified 125
@marciuz
marciuz / Install-datigov.sh
Created December 13, 2016 09:08
Installazione e prime customizzazioni di DKAN - DatiGov
#!/bin/sh
# Info da http://docs.getdkan.com/dkan-documentation/dkan-developers-guide/installing-dkan
git clone --branch 7.x-1.x https://github.com/marciuz/dkan.git dkan
cd dkan
drush make --prepare-install drupal-org-core.make webroot --yes
rsync -av . webroot/profiles/dkan --exclude webroot
drush -y make --no-core --contrib-destination=./ drupal-org.make webroot/profiles/dkan --no-recursion
cd webroot
Processed 10 (10 created, 0 updated, 0 failed, 0 ignored) in 30.9 sec (19/min) - done with 'dkan_harvest_migrate_dati_veneto' [completed]
Timer Cum (sec) Count Avg (msec)
page 34.396 1 34396.19
destination import 30.762 10 3076.162
file_field_presave 8.698 51 170.558
field_attach_update 2.658 44 60.418
field_sql_storage_field_storage_write 2.214 74 29.919
search_api_entity_insert 1.373 90 15.251
MigrateFieldsEntityHandler->prepare 1.25 10 124.979
MigrateDestinationEntity->prepareFields 1.25 10 124.951
# -*- coding: utf-8 -*-
"""
***************************************************************************
QGIS Server Plugin Filters: this test filter adds a CSS to HTML
get feature info response.
---------------------
Date : April 2015
Copyright : (C) 2015 by Alessandro Pasotti
Email : apasotti at gmail dot com
#!/bin/bash
# Help menu
print_help() {
cat <<-HELP
This script is used to fix permissions of a Drupal installation
you need to provide the following arguments:
1) Path to your Drupal installation.
2) Username of the user that you want to give files/directories ownership.
@marciuz
marciuz / file-extensions.txt
Created June 21, 2016 14:49
Drupal extensions for files
txt, doc, docx, xls, xlsx, odp, odt, ods, ppt, pptx, pdf, jpg, jpeg, gif, png, csv
@marciuz
marciuz / cartodb-napoli2011.sql
Last active June 6, 2016 08:01
Esempi postgresql 3 candidati
--
-- Esempio con 3 candidati.
-- Viene codificato con (1,2,3) il candidato con la maggioranza nella sezione.
-- In caso di parità sulla percentuale (arrotondata con 0 decimali), restituisce 0.
--
SELECT
CASE
WHEN (de_magistris > lettieri AND de_magistris > morcone) THEN 1
WHEN (lettieri > de_magistris AND lettieri > morcone) THEN 2
WHEN (morcone > de_magistris AND morcone > lettieri) THEN 3