Skip to content

Instantly share code, notes, and snippets.

View AntoineToubhans's full-sized avatar

Toubi AntoineToubhans

View GitHub Profile
def _log(message):
print('[SimpleTimeTracker] {function_name} {total_time:.3f}'.format(**message))
@simple_time_tracker(_log)
def load():
df = pd.read_csv('/home/toubi/Works/sicara/h3/HyperCube/App/Demo/Demo/Titanic.csv', delimiter=';')
return df
@simple_time_tracker(_log)
import time
from functools import wraps
_total_time_call_stack = [0]
def better_time_tracker(log_fun):
def _better_time_tracker(fn):
@wraps(fn)
def wrapped_fn(*args, **kwargs):
global _total_time_call_stack
def _log(message):
print('[BetterTimeTracker] {function_name} {total_time:.3f} {partial_time:.3f}'.format(**message))
@better_time_tracker(_log)
def load():
df = pd.read_csv('/home/toubi/Works/sicara/h3/HyperCube/App/Demo/Demo/Titanic.csv', delimiter=';')
return df
@better_time_tracker(_log)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
```
| datetime | city | temperature |
|---------------------|-------|-------------|
| 1996-07-01 02:00:00 | paris | 15.0 |
| | | |
| | | |
```
import mongots
from datetime import datetime
from csv import DictReader
temperature_collection = mongots.MongoTSClient().ClimaticDataDb.temperatures
with open('./weather_data.csv') as file:
reader = DictReader(file, delimiter=';')
failed = 0
@AntoineToubhans
AntoineToubhans / check-git-branch-before-deploy.js
Created May 31, 2018 07:26
A tiny serverless plugin to check the current branch before deploy
const exec = require('child_process').exec;
class CheckGitBranchBeforeDeploy {
constructor (serverless, options) {
this.commands = {
deploy: {
lifecycleEvents: [
'resources',
]
stages:
download_dataset:
cmd: (
wget https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip
-O cats_and_dogs_filtered.zip &&
unzip cats_and_dogs_filtered.zip -d data/raw &&
rm cats_and_dogs_filtered.zip
)
outs:
- data/raw
stages:
download_dataset: ...
split_dataset:
cmd: python scripts/split_dataset.py
deps:
- scripts/split_dataset.py
- data/raw
outs:
- data/dataset/train
stages:
download_dataset: ...
split_dataset: ...
train:
cmd: python scripts/train.py
deps:
- scripts/train.py
- data/dataset/train
- data/dataset/val