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
  • 13:48 (UTC -06:00)
View GitHub Profile
@bukzor
bukzor / README.md
Last active October 25, 2024 19:17
about github merge via rebase

merged via rebase:

https://github.com/getsentry/gha-sandbox.private/pull/5

main            87fa9c42e0a098d7783465d977ec0438bead0f8e
d3'             bbc490e3983dfba36d58a86ced39cee6a4e9ca75    PullRequest.mergeCommit merge_commit_sha
c3'             c7898f8f1b15e7b5f02d14f653b640252dd85936
b3'             30989ccb9095a639544119edeaaa00a0fa889ef1
a3' ed80389ae9d10911b81761e7fa0ab3e9ca194546
@bukzor
bukzor / view_test.py
Created October 4, 2024 17:51
Unit testing for bigquery SQL
#!/usr/bin/env py.test
from __future__ import annotations
import subprocess
from pathlib import Path
from typing import IO
from typing import Iterable
import pandas
from _pytest.python import Metafunc

Why are these wildly different?

WITH
  gocd_events as (
    SELECT * FROM `di-dev-mtr--buck-5.devinfra_metrics.gocd_events`
  )

SELECT *
FROM 
#!/usr/bin/env python3
"""
I attempt to showcase and fix a problem in `urllib.parse.urlunsplit` by fixing it and comparing it to the original.
See `DEMO`, below for results.
TL;DR: It's currently impossible to obtain relative URIs (like `file:selfie.png`) from urlunsplit, but we could fix it.
"""
from urllib.parse import urlsplit, urlunsplit
diff --git a/gcloud/lib/gcloud_logging_json_to_messages.py b/gcloud/lib/gcloud_logging_json_to_messages.py
index f873758..43d0faf 100755
--- a/gcloud/lib/gcloud_logging_json_to_messages.py
+++ b/gcloud/lib/gcloud_logging_json_to_messages.py
@@ -173,10 +173,14 @@ def get_rpc_method_names(proto: json.Object) -> str:
except KeyError:
pass
- return ".".join((
- gcp_json_get(proto, str, "serviceName").replace(".googleapis.com", ""),
#!/usr/bin/env python3
from __future__ import annotations
import re
from typing import TYPE_CHECKING
from typing import TypeVar
from lib.json import JSONArray
from lib.json import JSONObject
from lib.json import deepget as json_deepget
related docs
https://cloud.google.com/functions/docs/bestpractices/retries#configure_the_retry_policy
---
resource "google_cloudfunctions2_function" "collect_metrics" {
name = "collect_metrics"
location = var.region
[
{
"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).
#