Skip to content

Instantly share code, notes, and snippets.

View tdsmith's full-sized avatar

Tim D. Smith tdsmith

View GitHub Profile
from typing import Annotated
import svcs
with svcs.Registry() as reg:
reg.register_value(Annotated[int, "my_int"], 42)
reg.register_value(float, 3.14)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tdsmith
tdsmith / # coot - 2023-12-25_09-28-06.txt
Created December 25, 2023 14:28
coot (coot) on macOS 14.1 - Homebrew build logs
Homebrew build logs for coot on macOS 14.1
Build date: 2023-12-25 09:28:06
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import sys
print(__name__)
main = sys.modules["__main__"]
x = dir(main)
print(x)
print(f"the secret is {getattr(main, 'MY_SECRET')}")
Plant Value Note CalculatedDate DailyLoad
Iona Island WWTP (Vancouver) 7704.0 2020-09-27 3126500000000.0
Iona Island WWTP (Vancouver) 5606.0 2020-10-04 2023470000000.0
Iona Island WWTP (Vancouver) 3723.0 2020-10-11 2646630000000.0
Iona Island WWTP (Vancouver) 3576.0 2020-10-18 1700610000000.0
Iona Island WWTP (Vancouver) 5086.0 2020-10-25 2130910000000.0
Iona Island WWTP (Vancouver) 4555.0 2020-11-01 1716210000000.0
Iona Island WWTP (Vancouver) 5157.0 2020-11-08 2396850000000.0
Iona Island WWTP (Vancouver) 2360.0 2020-11-15 1979470000000.0
Iona Island WWTP (Vancouver) 8797.0 2020-11-22 7581310000000.0
library(readr)
library(dplyr)
n = 1000
set.seed(42)
uuid_like = function() {
# Pretend to construct a UUID using the R PRNG.
s = paste0(sample(strsplit("0123456789abcdef", "")[[1]], 32, replace=TRUE), collapse="")
sprintf("%s-%s-%s-%s-%s", substr(s, 1, 8), substr(s, 9, 12), substr(s, 13, 16), substr(s, 17, 20), substr(s, 20, 32))
client_id branches active_hours n_urls n_searches
b5349010-7e61-53cb-3bdd-d53274143d7c3 branch_b 0.295429602208199 535 992
e000c09e-2038-a69f-62eb-b14c9ca4fc327 branch_a 0.5293216624590977 16 932
f62c4a70-a397-92c4-faae-e1ba23e4a3b51 branch_b 0.8578968008700077 2 1072
9b873cf7-d1ae-8c0e-e4a5-5dbe8ae1f8f63 branch_a 0.3176133420928714 105 979
e692f88c-44ab-0d84-8400-0728b10bad19d branch_b 1.469027017869156 10 976
87e820a1-d29d-d06b-a580-05da712906cf3 branch_b 0.9167210917141692 9 1011
5d42f440-659f-eaab-f689-9fdb9741f8d3c branch_c 0.4519555371857764 28 978
eb183c7d-bcd0-6e66-81b5-514a8c3cb5096 branch_a 0.44215610604333694 0 1020
89e90ab1-5a1a-1379-4f21-1429b4c2fb83f branch_a 0.8568919052699107 69 980
@tdsmith
tdsmith / gist:5768065
Created June 12, 2013 18:54
ctypes.macholib.dyld.dyld_default_search
def dyld_default_search(name, env=None):
yield name
framework = framework_info(name)
if framework is not None:
fallback_framework_path = dyld_fallback_framework_path(env)
for path in fallback_framework_path:
yield os.path.join(path, framework['name'])
-- bq --format csv query -n 999999999 < query_event.sql > events_hdd.csv
DECLARE slugs ARRAY<STRUCT<slug STRING, name STRING>> DEFAULT [
("bug-1685741-pref-unenrollment-normandy-test-with-no-op-pref-in-fi-nightly-86-100", "string"),
("bug-1685740-pref-unenrollment-normandy-test-with-no-op-pref-in-fi-nightly-86-100", "boolean"),
("bug-1685742-pref-unenrollment-normandy-test-with-no-op-pref-in-fi-nightly-86-100", "integer")
];
DECLARE start_date DATE DEFAULT "2021-01-12";
WITH events AS (