This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Setup private pypi - GCP Artifact Registry | |
inputs: | |
central_project: | |
type: string | |
required: true | |
description: GCP project where the Artifact Registry is located | |
central_repo: | |
type: string | |
required: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repos: | |
- repo: https://github.com/pre-commit/pre-commit-hooks | |
rev: v4.2.0 | |
hooks: | |
- id: check-added-large-files | |
- id: end-of-file-fixer | |
- id: trailing-whitespace | |
- id: detect-private-key | |
- id: no-commit-to-branch | |
- id: check-toml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -eu | |
# shortcut for getting payload values | |
function export_payload_var() { | |
name="$1" | |
pattern="$2" | |
value=$(jq -r "$pattern" "${PAYLOAD}") | |
if [[ "$value" == "null" ]]; then | |
echo "Could not find pattern '$pattern' in payload '${PAYLOAD}'" | |
exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "tag=$tag" | |
echo "FILE_PATH=$FILE_PATH" | |
export LINE_MARK="tag:" | |
sed -i'' -e "0,/$LINE_MARK .*/s//$LINE_MARK $tag/" "$FILE_PATH" # replace first entry |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: use np.array and dtypes there | |
class _MyIndexer: | |
def __init__(self, obj) -> None: | |
self._obj = obj | |
def __getitem__(self, idx): | |
print('__getitem__', idx, type(idx), isinstance(idx, (list, tuple))) | |
if isinstance(idx, str): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
modified_dirs='["a", "a/b", "b/c/d", "c/d/e.txt"]' | |
modified_dirs=$(echo $modified_files | jq -r '[ .[] | split("/") | .[0] ] | unique') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table="..." | |
for pk in $(aws dynamodb scan --table-name ${table} | jq -r '.Items | .[].pk.S'); do | |
aws_cli dynamodb delete-item --table-name "${table}" --key '{"pk":{"S":"'$pk'"}}' & | |
sleep 0.01 | |
echo "Deleted: $table / $pk" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -c "import http.client; \ | |
c = http.client.HTTPConnection('localhost:8080'); \ | |
r = c.request('GET', '/health'); \ | |
r = c.getresponse(); \ | |
assert r.status == 200, (r.status, r.reason)" | |
python -c 'import httpx; r = httpx.get("http://localhost:8080/health"); r.raise_for_status()' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# not sure if it's best way. Maybe better just: | |
# - name: Install Python 3.8 | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: 3.8 | |
# cache: poetry | |
- name: Configure docker | |
uses: docker/login-action@v2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# $ export KEY=kek OTHER_KEYS="aa bb" OTHER_VALS="AA BB" | |
# $ echo "12 34" | python .github/workflows/helpers/construct_json_list_of_values.py | |
# [{"kek": "12", "aa": "AA", "bb": "BB"}, {"kek": "34", "aa": "AA", "bb": "BB"}] | |
import json | |
import os | |
import sys | |
KEY = os.environ["KEY"] |