Skip to content

Instantly share code, notes, and snippets.


Antoine Delia antoinedelia

View GitHub Profile
antoinedelia /
Last active January 5, 2023 21:29
Things I learned during Advent of Code 2022
antoinedelia /
Last active March 15, 2022 22:05
How to time multiple functions
from timeit import repeat
setup = 'x = ("a", "b", "c", "d"); idx = 2'
stmt_range = """
[x[i] for i in range(len(x)) if i != 2]
stmt_slice = """
list(x[:2] + x[3:])
antoinedelia / postman_pre_request.js
Created September 20, 2021 13:46
Postman pre-request script to get Cognito access token
View postman_pre_request.js
url: "",
method: 'POST',
header: {
'Content-Type': 'application/x-www-form-urlencoded'
body: {
mode: 'urlencoded',
urlencoded: [
antoinedelia /
Last active November 9, 2021 08:24
Basic logger class with color and log to file
import logging
import os
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")
LOG_FILE_NAME = os.getenv("LOG_FILE_NAME", "log.txt")
class Color:
"""An enum for the different colors available for printing
antoinedelia /
Last active April 28, 2023 18:23
How to make a Python pandas Layer for AWS Lambda

How to make pandas as an AWS layer

  1. Install pandas to local directory with pip: pip install -t . pandas

  2. Remove pandas and numpy directories rm -r pandas numpy

  3. Download the Linux distribution for pandas (choose the Python version that you want to use):

  4. Download the Linux distribution for numpy (must be the same as the pandas one):

antoinedelia / aws_logs_query.txt
Last active September 30, 2022 09:55
Query to filter CloudWatch Logs Insights
View aws_logs_query.txt
fields @timestamp, @message, @logStream
| parse @message "[*][*] *" as loggingTime, loggingType, loggingMessage
| filter loggingType in ["ERROR", "WARNING", "DEBUG", "INFO"]
| display loggingTime, loggingType, loggingMessage
| filter loggingMessage like "my search criteria"
| sort @timestamp desc
| limit 1000
antoinedelia / serverless.yml
Last active August 26, 2022 15:02
Template for a basic serverless file
View serverless.yml
service: service-name
name: aws
stage: ${opt:stage, 'prod'}
runtime: ${opt:runtime, 'python3.8'}
region: ${opt:region, 'eu-west-1'}
name: deployment_bucket_name
View Dev tips & tricks.txt
# Open the current cmd path to the current VS Code window
code . -r
# Print the result of a command in bash
echo $(operation)
# Pretty print json output in bash
echo '{"first_name":"Antoine","last_name":"Delia"}' | python -m json.tool
antoinedelia / settings.json
Last active August 16, 2021 09:51
Settings for Python VsCode
View settings.json
"python.pythonPath": "/Users/antoine.delia/.pyenv/versions/3.9.0/bin/python",
"python.formatting.autopep8Args": ["--max-line-length", "100"],
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.linting.flake8Args": [
"--max-line-length", "200"
"autoDocstring.docstringFormat": "sphinx",