Skip to content

Instantly share code, notes, and snippets.

# See https://pre-commit.com/ for usage and config
files: '^(src|tests|scripts)\/\S*'
repos:
- repo: local
hooks:
- id: trailing-whitespace
name: trailing whitespace
stages: [commit]
language: system
entry: trailing-whitespace-fixer
@thinhha
thinhha / install-clouddq-env-ubuntu.sh
Created July 13, 2021 10:21
install-clouddq-env-ubuntu.sh
# Install sandboxfs
sudo apt install libfuse2
curl -Lo /tmp/sandboxfs-0.2.0.tgz https://github.com/bazelbuild/sandboxfs/releases/download/sandboxfs-0.2.0/sandboxfs-0.2.0-20200420-linux-x86_64.tgz
sudo tar xzv -C /usr/local -f /tmp/sandboxfs-0.2.0.tgz
rm /tmp/sandboxfs-0.2.0.tgz
sandboxfs
# Install Python dependencies
sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
CREATE OR REPLACE FUNCTION udf_sql.uint64be(x INT64) RETURNS BYTES AS (
CAST((SELECT STRING_AGG(FORMAT("%x",x >> bit & 0x1), "" ORDER BY bit DESC)
FROM UNNEST(GENERATE_ARRAY(0, 63)) AS bit) AS BYTES)
)
;
CREATE OR REPLACE FUNCTION udf_sql.custom_hash(input BYTES, is_leaf BOOLEAN, depth INT64) RETURNS BYTES AS (
SHA256( CASE WHEN is_leaf THEN b'0x00' ELSE b'0x01' END || udf_sql.uint64be(depth) || input )
)
;
@thinhha
thinhha / get_pubsub_sd_metrics.ipynb
Last active June 28, 2019 13:57
Colab Notebook/Python code to get PubSub Stackdriver Metric
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thinhha
thinhha / bq-gis-demo
Last active June 28, 2019 13:00
BQ-GIS-LondonCycle-Demo
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",

Keybase proof

I hereby claim:

  • I am thinhha on github.
  • I am ttha (https://keybase.io/ttha) on keybase.
  • I have a public key ASBqxBdGll1GQg5uJY5Wh1Zqw1b74Zg1-z30lfUi4Vcp9Qo

To claim this, I am signing this object: