Skip to content

Instantly share code, notes, and snippets.

View vlandeiro's full-sized avatar
🐈

Virgile Landeiro vlandeiro

🐈
View GitHub Profile
@vlandeiro
vlandeiro / AoC.org
Created December 2, 2020 15:33
Advent of Code 2020

Advent of code

2020

Day 1

1st problem

import numpy as np
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vlandeiro
vlandeiro / dann_keras.py
Last active October 18, 2018 20:04
Implementation of Domain Adversarial Network in Keras using the Tensorflow back-end
import numpy as np
import tensorflow as tf
import keras.backend as K
from keras.layers import Dense, Input, Dropout
from keras.models import Model
from keras.engine import Layer
# Reverse gradient layer from https://github.com/michetonu/gradient_reversal_keras_tf/blob/master/flipGradientTF.py
# - Added compute_output_shape for Keras 2 compatibility
# - Fixed bug where RegisterGradient was raising a KeyError
@vlandeiro
vlandeiro / middle_part.svg
Created April 22, 2018 23:23
Iris optimized middle parts
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vlandeiro
vlandeiro / python_workflow_intro.ipynb
Last active March 27, 2018 15:49
Introduction to Python workflow
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vlandeiro
vlandeiro / md_colors.py
Last active March 14, 2017 22:16
List of material design colors
class Map(dict):
"""
Example:
m = Map({'first_name': 'Eduardo'}, last_name='Pool', age=24, sports=['Soccer'])
"""
def __init__(self, *args, **kwargs):
super(Map, self).__init__(*args, **kwargs)
for arg in args:
if isinstance(arg, dict):
for k, v in arg.items():
@vlandeiro
vlandeiro / nbextensions_jupyterhub_instructions.md
Last active May 18, 2017 05:35
Install notebook extensions for Jupyterhub

Install Jupyter extensions

  • SSH to the server where jupyterhub is installed.
  • Copy the notebook extensions to your local nbextensions folder.
# code folding: https://github.com/ipython-contrib/IPython-notebook-extensions/wiki
jupyter nbextension install https://github.com/ipython-contrib/IPython-notebook-extensions/archive/master.zip --user

# cells vertical split, table of contents: https://github.com/Calysto/notebook-extensions
@vlandeiro
vlandeiro / ipynb_toc.py
Last active April 6, 2016 22:10
Create a Table of Contents for an iPython Notebook.
import json
import re
import string
from IPython.display import display_markdown
class TOC:
def __init__(self, notebook_path):
"""
Class that builds a table of content for a given notebook. For now, it
only accepts markdown headers using the '#' format (e.g.: ## This is a