Advent of Code 2022
Things I learned while doingitertools.accumulate
string.ascii_letters
complex
typemax
functionlocals
- Modular arithmetics
- Basic regex to find numbers
itertools.accumulate
string.ascii_letters
complex
typemax
functionlocals
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:]) |
pm.sendRequest({ | |
url: "https://YOUR_COGNITO_DOMAIN_NAME_HERE.auth.eu-west-1.amazoncognito.com/oauth2/token", | |
method: 'POST', | |
header: { | |
'Content-Type': 'application/x-www-form-urlencoded' | |
}, | |
body: { | |
mode: 'urlencoded', | |
urlencoded: [ | |
{ |
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 | |
""" |
Install pandas to local directory with pip: pip install -t . pandas
Remove pandas and numpy directories rm -r pandas numpy
Download the Linux distribution for pandas (choose the Python version that you want to use): https://pypi.org/project/pandas/#files
Download the Linux distribution for numpy (must be the same as the pandas one): https://pypi.org/project/numpy/#files
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 |
service: service-name | |
provider: | |
name: aws | |
stage: ${opt:stage, 'prod'} | |
runtime: ${opt:runtime, 'python3.8'} | |
region: ${opt:region, 'eu-west-1'} | |
deploymentBucket: | |
name: deployment_bucket_name | |
iamRoleStatements: |
# 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 |
{ | |
"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", |