Skip to content

Instantly share code, notes, and snippets.

View faustomilletari's full-sized avatar

Fausto Milletari faustomilletari

View GitHub Profile
@faustomilletari
faustomilletari / covid19challenge_Eisen_starter_kit.py
Created June 9, 2020 08:14
Covid19Challenge.eu Eisen starter kit
"""
Eisen EU COVID-19 challenge starter kit
NOTE: you need to register to the challenge, download and unpack the data in
order to be able to run the following example.
Find more info here: https://www.covid19challenge.eu
Information about Eisen can be found at http://eisen.ai -- Join the community on Slack https://bit.ly/2L7i6OL
@faustomilletari
faustomilletari / brats_challenge_starterkit.py
Last active March 2, 2021 18:15
BraTS 2020 challenge Eisen starter kit
"""
Eisen BraTS2020 challenge starter kit
NOTE: you need to register to the challenge, download and unpack the data in
order to be able to run the following example.
Find more info here: https://www.med.upenn.edu/cbica/brats2020/data.html
Information about Eisen can be found at http://eisen.ai -- Join the community on Slack https://bit.ly/2L7i6OL
"""
Eisen EMIDEC Challenge starter kit
NOTE: you need to register to the challenge, download and unpack the data in
order to be able to run the following example.
Find more info here: http://emidec.com/
This is released under MIT license. Do what you want with this code.
"""
"""
Eisen EMIDEC Challenge starter kit
NOTE: you need to register to the challenge, download and unpack the data in
order to be able to run the following example.
Find more info here: http://emidec.com/
This is released under MIT license. Do what you want with this code.
"""
"""
Eisen EMIDEC Challenge starter kit
NOTE: you need to register to the challenge, download and unpack the data in
order to be able to run the following example.
Find more info here: http://emidec.com/
This is released under MIT license. Do what you want with this code.
"""
@faustomilletari
faustomilletari / ABC_Eisen_starterkit.py
Created May 6, 2020 19:49
ABC challenge starter kit with Eisen
"""
Eisen ABC Challenge starter kit
NOTE: you need to register to the challenge, download and unpack the data in
order to be able to run the following example.
Find more info here: https://abcs.mgh.harvard.edu
This is released under MIT license. Do what you want with this code.
"""
# You will need to download this data. Exec on your terminal
# wget "https://www.dropbox.com/s/duja4l7ce4ka720/tr_im.nii.gz"
# wget "https://www.dropbox.com/s/0uq78sh2iqzjofv/tr_mask.nii.gz"
# wget "https://www.dropbox.com/s/5amzci0b2sodhpn/val_im.nii.gz"
# IMPORTANT!!!
# You need to have eisen installed from git via pip install --upgrade git+https://github.com/eisen-ai/eisen-core.git
import matplotlib.pyplot as plt
from eisen.datasets import MedSegCovid19
@faustomilletari
faustomilletari / jwt_tokens.py
Created April 26, 2020 17:31
Issue and verify JWT tokens (Medium post)
import jwt
from datetime import datetime, timedelta
JWT_SECRET = '****CHANGE_THIS_TO_KICKASS_SECRET_$#($#@(&$(_CHANGE_THIS_TO_KICKASS_SECRET_#*@#*(@_CHANGE_THIS_TO_KICKASS_SECRET****'
JWT_ALGORITHM = 'HS256'
JWT_EXP_DELTA_SECONDS = 900
@faustomilletari
faustomilletari / database.py
Created April 26, 2020 17:15
Database class for Lambda function (Medium post)
import hashlib, binascii, os
from sqlalchemy import create_engine
from sqlalchemy import Table, Column, String, MetaData, select, and_
def hash_passwd(passwd):
"""Hash a password for storing."""
salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii')
@faustomilletari
faustomilletari / lambda_function.py
Created April 26, 2020 17:01
Lambda function for database table creation (Medium post)
import json
from sqlalchemy import create_engine
from sqlalchemy import Table, Column, String, MetaData
class DB:
def __init__(self, user, password, host, port):
self.user = user
self.password = password