Skip to content

Instantly share code, notes, and snippets.

View santiagobasulto's full-sized avatar

Santiago Basulto santiagobasulto

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# This is a proof of concept of a wait function that preserves
# the order of the futures.
#
# I'm working on a library on top of concurrent.futures
# and I needed a `wait` function that would preserve the order of the futures passed
# so I wrote a simple `wait_in_order` function.
# Using this also makes `ThreadPoolExecutor.map`'s implemenation simpler
@santiagobasulto
santiagobasulto / server.py
Created April 4, 2021 13:21
A Python 3 debugging server based on http.server that logs every request. Use it to inspect incoming connections.
import time
from functools import partialmethod
from http.server import BaseHTTPRequestHandler, HTTPServer
import utils
class Request:
def __init__(self, method, path, headers, stream):
self.path = path
self.method = method.upper()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@santiagobasulto
santiagobasulto / relative_to_absolute.py
Last active November 20, 2021 19:09
A quick script to transform a Markdown file's relative images to absolute by uploading them to a plugin-based service (S3, Imgur)
import re
import mimetypes
from pathlib import Path
import requests
import boto3
from botocore.exceptions import ClientError
{
"a": 4,
"b": 5
}
{
"a": 4,
"b": 5,
}
@santiagobasulto
santiagobasulto / README.md
Last active July 7, 2020 12:54
A simple calculator from file inputs

Example Gist as exercise.

This is the description, and THIS FILE IS MANDATORY.

You can include your markdown description here.