Skip to content

Instantly share code, notes, and snippets.

View santiagobasulto's full-sized avatar

Santiago Basulto santiagobasulto

View GitHub Profile
{
"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.

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
# !pip install python-hn
import itertools
from hn import search_by_date
results = search_by_date('Who is hiring?', ask_hn=True, author='whoishiring', hits_per_page=1000)
who_is_hiring = (r for r in results if 'ask hn: who is hiring?' in r['title'].lower())
for elem in itertools.islice(who_is_hiring, 10):
print(elem['title'])
# !pip install python-hn
import itertools
from hn import search_by_date
results = search_by_date('Who is hiring?', ask_hn=True, author='whoishiring', hits_per_page=1000)
who_is_hiring = (r for r in results if 'ask hn: who is hiring?' in r['title'].lower())
for elem in itertools.islice(who_is_hiring, 10):
print(elem['title'])
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"category_name": "General",
"todos": [
{
"task": "My TODO Task",
"due_on": null,
"status": "pending",
"description": null
},
{
@santiagobasulto
santiagobasulto / README.md
Last active February 17, 2025 16:05
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)

@santiagobasulto
santiagobasulto / failure.py
Created August 11, 2018 20:05
Pickle limitations for class based decorators.
from concurrent.futures import ProcessPoolExecutor
class CheckOnlyIntegers:
def __init__(self, fn):
self.fn = fn
def __call__(self, *args):
if not all([type(arg) == int for arg in args]):
raise ValueError("Invalid param is not an integer")