Skip to content

Instantly share code, notes, and snippets.

View lelandbatey's full-sized avatar

Leland Batey lelandbatey

View GitHub Profile
@lelandbatey
lelandbatey / completed.csv
Last active December 14, 2021 02:24
Playlist called slow-dance by Ana Sofia
Song Title Artist
I Don't Wanna See You with Her Maria Mena
Don't Forget About Me CLOVES
You & Me (feat. G-Eazy) Marc E. Bassy
Miss You James Hersey
Let It Go James Bay
How to Save a Life The Fray
Remedy Adele
When We Were Young Adele
Million Reasons Lady Gaga
@lelandbatey
lelandbatey / cookie_clicker_stock_market_info.js
Last active November 27, 2021 21:13
Cookie Clicker stock market info; copy paste script into console
@lelandbatey
lelandbatey / cookie_clicker_stock_market_info.js
Created November 27, 2021 20:45
Cookie Clicker stock market info; copy paste script into console
@lelandbatey
lelandbatey / 2021-11-10-how-I-ended-liking-gnome.md
Last active November 15, 2021 20:29
I ended liking GNOME with the loss of one hand (mirror)
@lelandbatey
lelandbatey / parse_athena_format.py
Created November 8, 2021 23:48
Parse Athena-formatted data into JSON
#!/usr/bin/env python3
# A script which will parse athena-formatted lines to be json. Assumes all
# fields and values are strings.
import json
import sys
import re
def parseathena(line):
@lelandbatey
lelandbatey / python_packaging_vs_golang_packaging_2021.md
Last active January 20, 2024 11:27
Python Packaging vs Golang Packaging: Breaking down the differences in terminology and what it means for you

Python Packaging vs Golang Packaging

The original question was:

But I'm not sure that the library name = "cp-compat-logs-logger" defined in pyproject.toml would work. I tried importing that in my httpclient library and it complained. Also, I see in the log_bridge library the logger is imported as from cp_compat_logs_logger.logger import Logger, but cp_compat_logs_logger is not the library name, so how is that working?

I think you've asked a totally valid question about "what's up with the names here?" The short answer is "Python has messy conventions, so the name you use to poetry install is different than the name you use in code when import name." It's conventional to have the poetry install (let's call this the "distribution name") use dashes as a delimiter. However, actual module names in Python cannot have dashes, so the name used in code during import name (let's call this the "module name") will (usually) use underscores in place of dashes.

@lelandbatey
lelandbatey / generate_sphinx_pkgs.py
Last active October 15, 2021 23:58
Generate sphinx docs for an entire module, recursively
'''
CLI tool for generating sphinx auto-doc compatible files for all the python
modules in a directory. I'm using this to generate raw Sphinx docs for a big
disorganized, undocumented Python repo.
'''
# From here: https://stackoverflow.com/a/54323162
import sys
from setuptools import find_packages
from pkgutil import iter_modules
@lelandbatey
lelandbatey / list_all_contributors.sh
Created July 13, 2021 22:27
Record all contributors to each Git repository in a file tree
#!/bin/bash
# list_all_contributors.sh ROOT_SEARCH_PATH
#
# Usage: Finds all Git repositories in ROOT_SEARCH_PATH and records all
# contributors to each repo, each repo getting one file, with these
# contributor files saved to the current directory.
# Copyright (C) 2021 Leland Batey
#
@lelandbatey
lelandbatey / index.html
Last active January 8, 2022 21:51
Color clock - represent the hands of a clock as the "color edges" of a pie chart
<!DOCTYPE html>
<html lang="en">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!--<script src="timemachine.js"></script>-->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment-with-locales.min.js"></script>-->
<body style="margin: 0;">
<canvas id='canvas' width='1000' height='1000'></canvas>
</body>
@lelandbatey
lelandbatey / LFB_beaconed_assembly_layout.factorio
Created April 8, 2021 23:30
Factorio beaconed assembly layout
0eNqlmc2PojAUwP8V0rMYKP2g3nYOe9pkL3vbTDagHW0GgdCyGWPmf9+io+M6IO1rYmJUeL/33ffkiMqql22naoNWR7SRet2p1qimRiv0a6d0ZF9mJ6Oy0GodGVXJoqxkVBWHpjdR8xIVWst9WR2ifbHeqVrqqNenS16aLiqqKnpV9UYPV1oRMlp3shjEL9ECqXVTa7T6fURabeuiGjQwh1ZatDJyb6+oi/3wqZSFvRS921vqjXxDq/R9MXvTh2Kq3sYfqsXZjQj8/rxAsjbKKHlW4vTh8Kfu96XsLOMqSb61ndQ67u2d3bZr7HtcyspYVttodfbWEVmhhC3pAh3QKs5SvKSWtlGdXJ+vIIuronXbGzTYcMfEEGYexswATJqEMcl9aL9aRa6EJD8Rhujq4VfdSrmJ982mr4aQ2kiOEOg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