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
@filipecabaco
filipecabaco / form_from_schema.ex
Created March 31, 2023 10:41
Simple component to build forms from a given schema
defmodule AppWeb.Component.FormFromSchema do
use AppWeb, :live_component
attr :changeset, :any, required: true
attr :event_suffix, :string, default: ""
attr :schema, :any, required: true
attr :uploads, :any, default: nil
attr :visibility_rules, :any, default: %{}
attr :field_type_rules, :any, default: %{}
@miraculixx
miraculixx / README
Last active February 7, 2023 23:12
Celery worker blocks on rate limited task
Celery worker blocks on rate limited task
=========================================
by github.com/miraculixx
Problem:
If a worker has a rate_limit active on some task, and that task
arrives (is received) more often than the rate limit interval, all
worker processes will block on these task instances and stop
consuming other tasks as soon as the prefetch count has maxed out
@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)]
@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
@1RedOne
1RedOne / Lottery.Md
Last active April 25, 2024 09:16
Why you don't want to win the lottery
@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.
"""

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:

@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
@harlow
harlow / golang_job_queue.md
Last active April 24, 2024 10:21
Job queues in Golang