Skip to content

Instantly share code, notes, and snippets.

View antoinedelia's full-sized avatar

Antoine Delia antoinedelia

View GitHub Profile
antoinedelia / script.js
Last active June 22, 2023 20:46
UserScript to force 1080p60 (Source) video quality on Twitch
// ==UserScript==
// @name Force 1080p60 (Source) video quality on Twitch
// @namespace
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://**
// @grant none
// @author Antoine Delia
antoinedelia /
Last active December 4, 2023 15:26
Things I learned during Advent of Code 2022
antoinedelia /
Last active February 15, 2024 11:35
MKVToolNix useful commands
$ sudo apt install mkvtoolnix
# Update the default audio track to the second one in all the files in the current directory
$ for i in *; do if [[ $i == *.mkv ]]; then mkvpropedit "$i" --edit track:a1 --set flag-default=0 --edit track:a2 --set flag-default=1; fi; done
# If you have a single subtitle, and you want it to be default, then do:
$ for i in *; do if [[ $i == *.mkv ]]; then mkvpropedit "$i" --edit track:s1 --set flag-default=1; fi; done
# Merge two files into one
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
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 2, 2024 08:29
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
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
service: service-name
name: aws
stage: ${opt:stage, 'prod'}
runtime: ${opt:runtime, 'python3.8'}
region: ${opt:region, 'eu-west-1'}
name: deployment_bucket_name
# 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