Skip to content

Instantly share code, notes, and snippets.

View bukzor's full-sized avatar
🌥️
learning google cloud

Buck Evan bukzor

🌥️
learning google cloud
  • google.com
  • Appleton, WI
  • 20:23 (UTC -05:00)
View GitHub Profile
[
{
"name": "metadata",
"description": "test metadata, from test_metadata.py",
"fields": [
{
"name": "cwd",
"description": "current working directory",
"type": "STRING",
"mode": "REQUIRED"
#!/bin/env python3
# -*- coding: utf-8 -*-
import json
import os
import subprocess
import time
DD_API_BASE = "https://api.datadoghq.com"
DEFAULT_DATADOG_API_KEY = "f964b6d704a81c65acad65ba5c554c9d"
DATADOG_API_KEY = os.getenv("DATADOG_API_KEY") or os.getenv("DD_API_KEY") or DEFAULT_DATADOG_API_KEY
#!/bin/bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#
@bukzor
bukzor / capfd_combined.py
Last active January 28, 2024 18:24
Define a 'cap1fd' pytest fixture which captures stdout/stderr combined.
"""Define a 'cap1fd' pytest fixture which captures stdout/stderr combined."""
from __future__ import annotations
import contextlib
from io import FileIO
# from typing import ContextManager
from typing import Generator
from typing import NamedTuple
from typing import Self
@bukzor
bukzor / log.txt
Created January 25, 2024 15:37
using gh cli to find appoval state of PR
$ # stealing the command used for is_closed
$ gh pr view https://github.com/getsentry/tacos-gha/pull/77 --json state
{
"state": "OPEN"
}
$ gh pr view https://github.com/getsentry/tacos-gha/pull/77 --json
Specify one or more comma-separated fields for `--json`:
additions
assignees
@bukzor
bukzor / test.py
Last active January 18, 2024 21:57
Why is there a random unexpected chdir on ctrl+c??
"""this test passes if you let it run, but fails assert_pwd if you ctrl-c"""
from __future__ import annotations
import contextlib
import typing
from os import chdir, environ, getcwd
from pathlib import Path
from time import sleep
from pytest import fixture
$ pyright mycode_test.py
pyright 1.1.261
./mycode_test.py
  ./mycode_test.py:42:16 - error: Cannot assign member "slow_method" for type "Gizmo"
    Expression of type "() -> Literal[3]" cannot be assigned to member "slow_method" of class "Gizmo"
      Type "() -> Literal[3]" cannot be assigned to type "() -> Frob"
        Function return type "Literal[3]" is incompatible with type "Frob"
          "Literal[3]" is incompatible with "Frob" (reportGeneralTypeIssues)
1 error, 0 warnings, 0 informations 
>>> i = 0x12000
>>> while True:
... i, c, name = i + 1, chr(i), unicodedata.name(chr(i))
... print(i, c, name)
...
73729 𒀀 CUNEIFORM SIGN A
73730 𒀁 CUNEIFORM SIGN A TIMES A
73731 𒀂 CUNEIFORM SIGN A TIMES BAD
73732 𒀃 CUNEIFORM SIGN A TIMES GAN2 TENU
73733 𒀄 CUNEIFORM SIGN A TIMES HA
@bukzor
bukzor / gist:21ea47b35ca6c4f36a211edc9b15be25
Created September 14, 2020 20:02
__file__ is always realpath?
$ cd "$(mktemp -d)"
$ ln -sf realpath symlink
$ mkdir realpath
$ cd symlink
$ touch foo.py

This kinda-sorta works:

$ cd share/Formality/

$ git diff
diff --git a/javascript/FormalityToJS.js b/javascript/FormalityToJS.js
index c2dc6a1..2089d39 100644
--- a/javascript/FormalityToJS.js
+++ b/javascript/FormalityToJS.js