Skip to content

Instantly share code, notes, and snippets.

View Natim's full-sized avatar
🏠
Working from home

Rémy HUBSCHER Natim

🏠
Working from home
  • Silvr
  • Rennes
  • 11:46 (UTC +02:00)
  • X @Natim
View GitHub Profile
@Natim
Natim / README.md
Last active January 15, 2024 21:35
From TAEG to Commission

From TAEG to Commission

Understanding TAEG

TAEG is the Taux Annuel Effectif Global, it is the cost of money for a year with the current fees on the loan.

From an amortization table, you can compute it like that:

+------------+--------------+
@Natim
Natim / models.py
Created April 13, 2020 07:17
Register m2m changed event.
# Voir https://docs.djangoproject.com/fr/3.0/ref/signals/#m2m-changed pour plus d'infos
@receiver(m2m_changed, sender = VisiteMedicale.animaux.through)
def visite_medicale_save_action(sender, instance, **kwargs):
if reverse:
# Cas de popi.visite_medicale_set.remove(sterilisation_20200413)
animaux = [instance]
visite_medicale = model.objects.get(pk__in=pk_set)
else:
# Cas de sterilisation_20200413.animaux.add(Popi)
@Natim
Natim / Square.elm
Last active July 25, 2018 16:08
From bottom to top, floating animation showcase
module Square exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Animation exposing (px, percent)
import Time exposing (second)
import Ease exposing (..)
type alias Page =
{ name : String
, url : String
, created_at : Date
, title : String
, description : String
, url : String
}
from functools import partial
RULES = {
'six_h': {'high': 390, 'low': 330},
'twelve_h': {'high': 750, 'low': 690},
'twentyfour_h': {'high': 1490, 'low': 1410},
'seven_d': {'high': 169, 'low': 168}
}
@Natim
Natim / get_anchors.py
Last active March 8, 2017 12:51
Get anchors from Woleet
import aiohttp
import asyncio
import os
WOLEET_SERVER = 'https://api.woleet.io/v1'
WOLEET_HEADERS = {
'Authorization': 'Bearer {}'.format(os.getenv('WOLEET_BEARER_TOKEN')),
'Content-Type': 'application/json'
}
@Natim
Natim / README.md
Created May 25, 2016 14:42
A first kinto_bootstrap PoC

To use it:

python kinto_bootstrap.py -s http://localhost:8888 -a token:my-token -v
$ python kinto_bootstrap.py --help
usage: kinto_bootstrap.py [-h] [-s SERVER] [-a AUTH] [-b BUCKET] [-v] [-q]
                          [-D]

Bootstrap bucket
@Natim
Natim / scrap_amo_throttle.py
Created March 9, 2016 14:29
Scrap AMO with Python3 and asyncio
# -*- coding: utf-8 -*-
# This is PY3 only code using asyncIO
import asyncio
import aiohttp
import base64
import json
from random import randint
from kinto_client import Client, Endpoints
from pyquery import PyQuery as pyquery
@Natim
Natim / scrap_amo.py
Created March 9, 2016 12:30
For each addons, scrap AMO to get the who and why information.
# -*- coding: utf-8 -*-
# This is PY3 only code using asyncIO
import asyncio
import aiohttp
from pyquery import PyQuery as pyquery
async def fetch_info(session, record):
if 'blockID' not in record:
print("{} doesn't have a blockID".format(record['id']))
@Natim
Natim / hello.rst
Created December 21, 2015 14:59
How to connect to Firefox Hello with Firefox Account

First ask for Firefox Account OAuth params

http POST https://loop.services.mozilla.com/v0/fxa-oauth/params

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Hawk-Session-Token
Connection: keep-alive