Skip to content

Instantly share code, notes, and snippets.

View santiagobasulto's full-sized avatar

Santiago Basulto santiagobasulto

View GitHub Profile
@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
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 / README.md
Last active May 16, 2021 10:13
Download HumbleBundle books in batch with a simple Python script.

Download HumbleBundle books

This is a quick Python script I wrote to download HumbleBundle books in batch. I bought the amazing Machine Learning by O'Reilly bundle. There were 15 books to download, with 3 different file formats per book. So I scratched a quick script to download all of them in batch.

(Final Result: books downloaded)

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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.

{
"a": 4,
"b": 5
}
{
"a": 4,
"b": 5,
}

In this exercise you will read in a delimited data file as a list of records. Each record will be an instance of InventoryItem. The format of the delimited file is unusual, but can be handled by the Python csv module with appropriate configuration.

For example, the first few lines of data/Inventory.txt contain:

Name|Price|Quantity
/Wankle rotary engine/|555.55|527
/Sousaphone w%/ stand/|333.33|123

Feather Duster|22.22|900