Skip to content

Instantly share code, notes, and snippets.

View AntoineAugusti's full-sized avatar
🚄
High speed, low carbon

Antoine Augusti AntoineAugusti

🚄
High speed, low carbon
View GitHub Profile
@fedeisas
fedeisas / gist:5862227
Last active December 18, 2015 23:29
Inline CSS Styles on Laravel 4
<?php
/* 1. Add the dependency to your composer.json.
// I'm using https://packagist.org/packages/tijsverkoyen/css-to-inline-styles
*/
/* 2. Extend \Illuminate\Mail\Mailer to override the getView() method
// app/libraries/MyApp/Mailer.php
*/
namespace MyApp\Mail;
@catermelon
catermelon / config.py
Created October 4, 2013 15:49
Flask-SQLAlchemy - separating reads and writes
# This is not used unless SQLALCHEMY_BINDS is not present
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{username}:{password}@{hostname}/{database}?charset=utf8'
SQLALCHEMY_BINDS = {
'master': 'mysql+pymysql://{username}:{password}@{hostname}/{database}?charset=utf8',
'slave': 'mysql+pymysql://{username}:{password}@{hostname}/{database}?charset=utf8'
}

Voilà plusieurs fois que je tombe sur des programmes C cherchant à savoir si un nombre est premier ou pas. La plupart du temps, on peut aller beaucoup plus loin que ce qui est proposé.

Petit tour d'horizon des optimisations à appliquer ; pas toujours évidentes, mais qui ont l'avantage d'être bien plus rapides que l'implémentation naïve.

Définition du cahier des charges

Que doit faire le programme ?

Dans cet article, j'examinerai différents algorithmes qui auront pour but de trouver tous les nombres premiers inférieurs à une constante, MAX_NUM et de les renvoyer à l'intérieur d'un tableau d'entiers.

Les contraintes suivantes devront être respectées :

@harlow
harlow / golang_job_queue.md
Last active April 24, 2024 10:21
Job queues in Golang
@simpsoka
simpsoka / philosophy.md
Last active February 9, 2023 19:57
simpsoka product philosophy

Product managers

  • Seek out failure, it teaches us to think like a scientist. If you start with a hypothesis, then try to prove yourself wrong, you’re bound to make much better decisions. You have to be willing to fail, and that in itself is going to help you build confidence and be more convicted about what your strategy is in the end.
  • There are hundreds of methods for building products and running teams. As a quality PM, it's important to have an open mind about all of it, but finding your own process and philosophy can be grounding. It helps you find your pillars so that you don't smash into things while you're building. Remember, however, that you can always find a budget for remodeling. 😉
  • The beauty of a good process is when it just becomes how you do your work. When you forget you're following a process at all is when you know the process is working for you, your team, your company, and your customers.
  • The advice I give new Product Managers or PMs coming onto a team for the first

Instructions: Solve the levels in ascending order, and send your code and data at guillemette@drivy.com when you’re done. We love SQL tricks, but we also value your ease to write code. You can use any langage you like (brainfuck anyone?) as long as you have a strategy to deploy and maintain this code.

Goal: Provide the BI team a report of the occupancy rate of the fleet per city.

For a certain half-day, we define the occupancy rate as the nb of rented cars / nb of available or rented cars.

For a half day T, a car is considered available by default. This default state can be changed to:

@criccomini
criccomini / test_dags.py
Created June 22, 2016 15:18
test_dags.py
import os
import unittest
from airflow.models import DagBag
class TestDags(unittest.TestCase):
"""
Generic tests that all DAGs in the repository should be able to pass.
"""
@1RedOne
1RedOne / Lottery.Md
Last active May 6, 2024 09:58
Why you don't want to win the lottery
@Vigrond
Vigrond / celery_django_redis_ratelimit.py
Last active February 12, 2024 05:42
Celery / Django / Redis Rate Limits done "as expected" - Simple SMTP Example
# Rate limiting with Celery + Django + Redis
# Multiple Fixed Windows Algorithm inspired by Figma https://www.figma.com/blog/an-alternative-approach-to-rate-limiting/
# and Celery's sometimes ambiguous, vague, and one-paragraph documentation
#
# Celery's Task is subclassed and the is_rate_okay function is added
# celery.py or however your App is implemented in Django
import os
import math
@phileas-condemine
phileas-condemine / Batch_Route_with_OSRM
Last active August 30, 2019 16:00
This script routes the 2M population squares (of 200m x 200m) with 10 nearest maternity wards (defined with flying distance w. FNN) per 50k batches
library(data.table)
prep_data=F
if(prep_data){
# https://www.insee.fr/fr/statistiques/2520034
carreaux=foreign::read.dbf("external_data/carroyage_200m.dbf")
carreaux=data.table(carreaux)
head(carreaux)
carreaux[,idINSPIRE:=as.character(idINSPIRE)]