Skip to content

Instantly share code, notes, and snippets.

🐍

Loreto Parisi loretoparisi

🐍
Block or report user

Report or block loretoparisi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@loretoparisi
loretoparisi / sanremo_music_festival_dataset_1951-2019.csv
Created Jan 21, 2020
Sanremo Music Festival Dataset Tracks 1951 - 2019
View sanremo_music_festival_dataset_1951-2019.csv
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 3.
track_year track_id track_pos artist_name track_name track_writers track_votes
1951 1 Nilla Pizzi Grazie dei Fiori G. C. Testoni, M. Panzeri,S. Seracini 50
1951 1 2 Nilla Pizzi,Achille Togliani "La luna si veste d'argento" V. Mascheroni,Biri 30
1951 2 3 Achille Togliani Serenata a nessuno W. Colì 20
1951 3 F Achille Togliani,Duo Fasano Al mercato di Pizzighettone N. Ravasini,A. Locatelli
1951 4 F Nilla Pizzi,Achille Togliani Eco tra gli abeti E. Bonagura,C. A. Rossi
1951 5 F Achille Togliani,Duo Fasano Famme durmì V. Panzuti,Danpa
1951 6 F Duo Fasano La cicogna distratta Da Rovere, A. Valleroni,Carrel
1951 7 F Nilla Pizzi,Duo Fasano La margherita E. B. Valdes
1951 8 F Achille Togliani Sedici anni L. Gambetti, M. Mariotti,A. Mari
@loretoparisi
loretoparisi / sanremo_music_festival_tracks_dataset.js
Last active Jan 20, 2020
Sanremo Music Festival Tracks Dataset
View sanremo_music_festival_tracks_dataset.js
script = document.createElement('script');script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script);
function download(name,jsonObject) {
var fileContents = JSON.stringify(jsonObject, null, 2);
var pp = document.createElement('a');
pp.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(fileContents));
pp.setAttribute('download', name+'.json');
pp.click();
}
const title = $('.firstHeading').text().replace(/[aA-zZ]/g,'').trim();
const table = $('.wikitable').length - 1;
@loretoparisi
loretoparisi / mixout.py
Created Jan 10, 2020 — forked from stephenroller/mixout.py
Example of mixout on generic modules.
View mixout.py
#!/usr/bin/env python3
"""
Example of a generic Mixout implementation. (Lee et al., 2019).
https://arxiv.org/abs/1909.11299
Implementation by Stephen Roller (https://stephenroller.com).
Example output:
@loretoparisi
loretoparisi / mixout.py
Created Jan 10, 2020 — forked from stephenroller/mixout.py
Example of mixout on generic modules.
View mixout.py
#!/usr/bin/env python3
"""
Example of a generic Mixout implementation. (Lee et al., 2019).
https://arxiv.org/abs/1909.11299
Implementation by Stephen Roller (https://stephenroller.com).
Example output:
View threadpool.py
#!/usr/bin/env python3
from typing import Any, Callable, Dict, Iterable, Union
import multiprocessing
import queue
import sys
import threading
import time
class ThreadPool:
View memory-test.py
#! /usr/bin/python
import ctypes
import sys
size = int(sys.argv[1])
class MemoryTest(ctypes.Structure):
_fields_ = [ ('chars' , ctypes.c_char*size * 1024*1024 ) ]
try:
test = MemoryTest()
@loretoparisi
loretoparisi / increase_swap.h
Created Nov 26, 2019
Ubuntu increase swap space
View increase_swap.h
sudo swapoff -a
sudo dd if=/dev/zero of=/swapfile bs=1G count=16
sudo mkswap /swapfile
sudo swapon /swapfile
grep SwapTotal /proc/meminfo
View stdc++.h
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
@loretoparisi
loretoparisi / basehandler.py
Created Oct 25, 2019
Tornado BaseHandler for IOLoop run in executor and error handling
View basehandler.py
class BaseHandler(tornado.web.RequestHandler):
@tornado.gen.coroutine
def post_async(self, *args):
resp_dict = yield ioloop.IOLoop.current().run_in_executor(None, self.post_handler, args)
return resp_dict
@tornado.web.asynchronous
@tornado.gen.coroutine
def post(self, *args):
@loretoparisi
loretoparisi / tornado_webapp.py
Created Oct 24, 2019
Tornado Catch allError Handler example
View tornado_webapp.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import handlers as th
from tornado import web
class ErrorHandler(web.RequestHandler):
"""Generates an error response with status_code for all requests."""
You can’t perform that action at this time.