Skip to content

Instantly share code, notes, and snippets.

View blakeNaccarato's full-sized avatar

Blake Naccarato blakeNaccarato

View GitHub Profile
@pawamoy
pawamoy / funding.py
Created April 3, 2024 09:59
funding urls for installed python packages, from FUNDING.yml source
import os
from importlib.metadata import distributions
import httpx
import yaml
def fetch_funding(httpx_client, owner, repo):
query = """
query($owner: String!, $repo: String!) {
@brettcannon
brettcannon / fluent.py
Created December 4, 2023 22:54
Provide a function that lets you use a fluent-style API when a method returns e.g. `None` instead of `self`
def fluent(bound_method, /, *args, **kwargs):
"""Call a bound method and return `self` from that method."""
bound_method(*args, **kwargs)
return bound_method.__self__
@lordjabez
lordjabez / generate-theme-reports.py
Last active November 12, 2023 17:14
Create theme reports from a Wordpress blog export
#!/usr/bin/env python3
import contextlib
import os
import sys
import cachier
import feedparser
import keyring
@thomasantony
thomasantony / chatgpt_parser_md.py
Last active January 11, 2024 13:21
Convert saved HTML transcripts from ChatGPT to Markdown
# Save the transcripts using the "Save Page WE" Chrome Extension
# This script was generated by ChatGPT
import sys
from bs4 import BeautifulSoup
# Check if a file was provided as a command line argument
if len(sys.argv) < 2:
print("Please provide an HTML file as a command line argument.")
sys.exit(1)
@caiofcm
caiofcm / parse_wpd_to_pandas.py
Created March 18, 2022 18:59
Web Plot Digitizer to csv and pandas
import json
import typing
from pathlib import Path
import click
import numpy as np
import pandas as pd
def get_dataset_as_dict(data_loaded: dict) -> dict:
@Xion
Xion / fluent.py
Created June 30, 2013 12:18
Fluent interface decorators
#!/usr/bin/env python
"""
Decorator for fluent interface classes.
"""
import functools
import inspect
def chained(method):
"""Method decorator to allow chaining."""