This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Script Python per il calcolo della giacenza media di un conto Revolut. | |
- scaricare la lista movimenti dell'anno da calcolare in CSV | |
- mettere il file nella stessa cartella di questo script python | |
- lanciare il comando (default anno precedente): | |
python revolut.py -d nomefile.csv | |
NB. Serve Pandas. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A very basic statistics module. | |
This is a summary of statistics module from Python 3 for Python 2.6+ development. | |
================== ============================================= | |
Function Description | |
================== ============================================= | |
mean Arithmetic mean (average) of data. | |
variance Sample variance of data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, jsonify, abort, request | |
from flask_login import LoginManager, current_user | |
import json | |
from flask_sqlalchemy import SQLAlchemy | |
from flask_sqlalchemy import orm | |
db = SQLAlchemy() | |
class Record(db.Model): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
CODEMOTION 2016, Milan (IT) | |
Challenge: | |
- Write a chatbot | |
- Must provide REST API | |
- Write the smallest source code possible | |
- In Python | |
Required libs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pandas.io.parsers import read_csv | |
""" | |
Esempio base di utilizzo della libreria Pandas per maneggiare file csv Senza | |
diventare scemi. | |
Tutta la documentazione è presente a questo indirizzo: | |
http://pandas.pydata.org/pandas-docs/stable/index.html | |
""" | |
# Importo un csv separato da virgole, creando di fatto un DataFrame |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import types | |
if sys.version_info[0] > 2: # Python 3+ | |
create_bound_method = types.MethodType | |
else: | |
def create_bound_method(func, obj): | |
return types.MethodType(func, obj, obj.__class__) | |
class StrategyExample: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Esempio banale di Factory Pattern. | |
Valido solo in Python 2.x | |
""" | |
from abc import ABCMeta, abstractmethod | |
class AnimaleBase(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Script per misurare il tempo di esecuzione di una funzione | |
""" | |
import time | |
def timeit(method): | |
def timed(*args, **kw): | |
ts = time.time() | |
result = method(*args, **kw) | |
te = time.time() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'Alessandro Cucci' | |
__email__ = '[email protected]' | |
__date__ = '26/05/15' | |
import urllib2 | |
import base64 | |
from xml.dom.minidom import parse | |
# Valid commands to display author and subject for incoming mails | |
INPUT = ['yes', 'YES', 'yep', 'YEP', 'y', 'Y'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
__author__ = "Alessandro Cucci" | |
__license__ = "MIT" | |
__version__ = "0.0.1" | |
__email__ = "[email protected]" | |
__status__ = "Development" | |
import urllib, json | |
from datetime import datetime |
NewerOlder