Skip to content

Instantly share code, notes, and snippets.

View louisguitton's full-sized avatar
Focusing

Louis Guitton louisguitton

Focusing
View GitHub Profile
@louisguitton
louisguitton / docker-compose.yml
Created September 22, 2019 15:21
Nginx + HTTPS + Docker
version: '3'
services:
nginx:
image: nginx:1.15-alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx:/etc/nginx/conf.d
## install homebrew
echo "Installing Homebrew.."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "Homebrew successfully installed"
## install brew cask
echo "Installing brew cask.."
brew tap homebrew/cask
echo "Homebrew cask successfully installed"
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators import GoogleApiToS3Transfer
default_args = {
'owner': 'airflow',
'start_date': datetime(2019, 6, 1),
import pandas as pd
# in the end, I went for a recursive function because tags can be arbitrarily nested
def extract_from_dict(var, key):
if isinstance(var, dict):
for k, v in var.items():
if k == key:
yield v
if isinstance(v, (dict, list)):
yield from gen_dict_extract(v, key)
@louisguitton
louisguitton / fermat-spirale.py
Created March 1, 2019 07:34
Sunflower patterns are obtained using a Fermat spiral with a golden angle spacing
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
n = range(1, 100)
phi = (3 - np.sqrt(5)) * np.pi
for a in [0.98, 0.985, 0.99, 0.995, 1, 1.005, 1.01, 1.015, 1.02]:
fig = plt.figure()
r = np.sqrt(n)
@louisguitton
louisguitton / financial_functions.py
Created November 9, 2016 20:17
These are python financial functions to generate the table for a loan
# Fomule du pret pour obtenir la mensualite
def pmt(C, n, t):
if t:
return (C * t/12)/(1-(1 + t/12)**-n)
else:
return C/n
# Formule pour obtenir la part d'interets de la mensualite
def impt(period, C, n, t):
t_per = t/12