Skip to content

Instantly share code, notes, and snippets.

@odellt
odellt / bq-last-value.sql
Last active May 30, 2022 15:44
BQ - Last Value
-- Demonstrates using `LAST_VALUE` to replace null values with the last defined value
-- Simulated data is for 2 applications following the happy path
-- It might make sense to separate the `overall_status` value from the `SCREENING_CHECK` status record
WITH application_status AS (
SELECT
'abc' as application_status_id,
'xyz' as customer_id,
'123' as application_submission_id,
null as cpf_check_status,
null as selfie_check_status,
@odellt
odellt / bq-queries.md
Last active May 30, 2022 14:10
BQ Queries

Get Latest application_status's, with backfill

SELECT * EXCEPT (last)
FROM (
    SELECT application_status_id,
    customer_id,
    application_submission_id,
    LAST_VALUE(cpf_check_status IGNORE NULLS) OVER (
        PARTITION BY application_submission_id
@odellt
odellt / dev-cdd-admin-port-forward.sh
Last active March 31, 2022 15:14
Sets kubectl context to dev and port forwards to deploy/cdd-grpc on port 9000:9000
#! sh
kubectl config set-context gke_development-dbe50c4d_europe-west2_development
kubectl port-forward deploy/cdd-grpc 9000:9000 --namespace=development
@odellt
odellt / user-story-snippets.jsonc
Last active February 10, 2022 17:26
User story snippets
{
// Place your snippets for markdown here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@odellt
odellt / loop.sh
Last active November 23, 2021 10:52
Shell Infinite Loop
# Print the date every second, forever
while true; do date; sleep 1; done
@odellt
odellt / handy-commands.md
Last active September 25, 2024 12:21
GCP: Handy commands

Helpful GCP and Kubectl commands

Login to GCP

gcloud auth login

Check configured project

@odellt
odellt / gmail-github-filters.md
Created September 28, 2021 09:35 — forked from ldez/gmail-github-filters.md
Gmail and GitHub - Filters

Gmail and GitHub

Create new filters and create new labels.

Pull Request

from:([email protected]) AND {"Patch Links" "approved this pull request." "requested changes on this pull request." "commented on this pull request." "pushed 1 commit." "pushed 2 commits." "pushed 3 commits."}

label: gh-pull-request

@odellt
odellt / manual-certificate-checking.md
Last active November 23, 2021 10:57
Steps using openssl to check a certificates signature and revocation status

Manual Certificate Checking

Verify Signature

  1. Grab certificate content
  2. Enter content on the site: https://certlogik.com/decoder/
  3. This will convert it to PEM encoding, save as cert.pem
  4. Get the issuer and root certificates in PEM format and save as issuer.pem and root.pem
  5. Create a chain.pem file, adding the issuer.pem content followed by the root.pem content
  6. Verify the issuer.pem signature:
#! /bin/bash
echo "Cleaning Docker images"
# Stops all docker containers
docker stop $(docker ps -aq)
# Remove all containers
docker rm $(docker ps -aq)
# Remove all images
docker rmi $(docker images -q) --force
# Delete local tags that have not yete been pushed
git fetch --prune origin "+refs/tags/*:refs/tags/*"