Skip to content

Instantly share code, notes, and snippets.

@mihow
mihow / parallel_download.sh
Last active February 4, 2023 00:08
Bash Parallel File Download
#!/bin/bash
# USAGE
# bash ./parallel_download.sh url_list.txt
set -o nounset
set -o errexit
FILELIST=$1
@mihow
mihow / send_get_as_post.py
Created March 14, 2023 01:16
Send a GET request as a POST to overcome 414 Request-URI Too Large
# Submit a "GET" request via POST so we can send
# more data than fits in a URL
resp = requests.post(
url,
headers = {'X-HTTP-Method-Override': 'GET'},
data=params)
@mihow
mihow / image_from_url.py
Created September 11, 2023 23:10
Load image into PIL object from URL with streaming request, one line
import requests
from PIL import Image
image = Image.open(requests.get(url, stream=True).raw)
@mihow
mihow / example_matching_rows.sql
Created January 25, 2024 01:24
5 example matching rows for each category in a joined table (PostgreSQL)
SELECT c.category_name, i.image_id FROM categories c
CROSS JOIN LATERAL (
SELECT image_id
FROM image_hashes v
WHERE v.category_id = c.category_id
LIMIT 5
) i;
@mihow
mihow / find_unique_commits.sh
Last active August 6, 2025 23:18
Find the goods in old branches
#!/bin/bash
# Tool to find which commits are unique to a given branch using patch-id comparison.
# This is helpful for finding good stuff & new contributions in old branches when they have become out of sync with main.
# Assumes the trip branch is called main.
set -o nounset
set -o errexit
set -o pipefail
@mihow
mihow / list-aws-resource.py
Created November 14, 2025 21:14 — forked from GitToby/list-aws-resource.py
Using Boto, list all resources in an AWS account
# /// script
# https://peps.python.org/pep-0723/
# dependencies = [
# "boto3"
# ]
# ///
import boto3
from botocore.exceptions import ClientError