Skip to content

Instantly share code, notes, and snippets.

View thehappycheese's full-sized avatar

thehappycheese

  • Australia
View GitHub Profile
@thehappycheese
thehappycheese / pandas_aoihttp.py
Created February 19, 2024 03:50
pandas_aoihttp
import pandas as pd
import asyncio
from aiohttp import ClientSession, TCPConnector
@pd.api.extensions.register_series_accessor("aiohttp")
class AiohttpAccessor:
def __init__(self, pandas_obj):
self._obj = pandas_obj
async def _fetch_text(self, url: str, session):
# This works... but cant read the output array in the final step! :(
# Experimental!
UserLib ← &ffi ⊂□"User32.dll"
GdiLib ← &ffi ⊂□"Gdi32.dll"
KernelLib ← &ffi ⊂□"Kernel32.dll"
MessageBoxA ← UserLib {"int" "MessageBoxA" "long" "const char*" "const char*" "unsigned int"}
# MessageBoxA {0 "Yes Please" "About to Take A Screenshot" 0}
GetSystemMetrics ← UserLib {"int" "GetSystemMetrics" "int"}
GetDeviceContext ← UserLib {"long long" "GetDC" "long"}
@thehappycheese
thehappycheese / git_wrapper.py
Last active May 8, 2024 03:22
A simple python wrapper for git that helps build synthetic repos based on snapshots of some folder
from __future__ import annotations
import subprocess
from pathlib import Path
from typing import Optional
import os
from dataclasses import dataclass
from deprecated import deprecated
from pandas import Timestamp

Automates reloading a website during development; served using vanilla Deno server using a websocket.

@thehappycheese
thehappycheese / pre-commit.py
Created May 4, 2025 15:59
pre-commit hook stops .ipynb outputs
#! ./python
import json
import sys
from pathlib import Path
import subprocess
def get_staged_files():
"""Get list of files that are staged for commit."""
try:
result = subprocess.run(