Convert table t1 of this form:
id | p50 | p75 | p95
---------------------
1 | 10 | 11 | 12
2 | 13 | 14 | 15
into this form:
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 "console.log(require('v8').getHeapStatistics())" | node - | grep heap_size_limit | |
| # both max-old-space-size and max_old_space_size work | |
| export NODE_OPTIONS="--max-old-space-size=16384" | |
| export NODE_OPTIONS="--max_old_space_size=16384" | |
| # alternatively, "node --max-old-space-size=16384 ..." |
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
| # note: run as root | |
| devicemount=/mnt | |
| logicalname=/dev/md0 | |
| # get instance storage block devices | |
| devices=( $(lsblk -o name,type,size,model,mountpoint | grep -i "NVMe Instance Storage" | awk '{print "/dev/"$1}') ) | |
| if [[ "${#devices[@]}" -gt 0 ]] ; then | |
| mkdir -p "$devicemount" |
cheat sheet for https://tldp.org/LDP/abs/html/parameter-substitution.html
Variable existence checking
${var:?} # returns exit-code 1 if var not defined or null
${var:?err_msg} # prints err_msg and returns exit-code 1 if var not defined or null
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
| # run a command inside a docker container | |
| docker run --rm node ls | |
| # run multiple commands inside a docker container | |
| docker run --rm node bash -c "ls && pwd" | |
| # pipe commands from stdin | |
| echo "ls && pwd" | docker run --rm -i node bash | |
| # pipe commands from script |
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
| package main | |
| import ( | |
| "bytes" | |
| "fmt" | |
| "os" | |
| "os/exec" | |
| "strings" | |
| ) |
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
| #!/bin/bash | |
| # reproduces this failure locally: https://buildkite.com/uber/web-code-runner/builds/3499312#49338f5b-c4e8-4d4b-8b60-c2961f22657f | |
| function docker_login_ecr { | |
| local DOCKER_CREDENTIAL_UBER_REGISTRY="027047743804.dkr.ecr.us-west-1.amazonaws.com" | |
| aws --region=us-west-1 ecr get-login-password | docker login --username AWS --password-stdin $DOCKER_CREDENTIAL_UBER_REGISTRY | |
| } | |
| docker_login_ecr # so we can pull down image from buildkite |
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
| #!/bin/sh | |
| # Called by "git push" after it has checked the remote status, | |
| # but before anything has been pushed. | |
| # If this script exits with a non-zero status nothing will be pushed. | |
| # | |
| # This hook is called with the following parameters: | |
| # | |
| # $1 -- Name of the remote to which the push is being 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
| #!/usr/bin/env bash | |
| # --- NORMAL-MODE BENCHMARKS --- | |
| echo "--- web-code-base normal ---" | |
| docker system prune --all --force | |
| docker pull 027047743804.dkr.ecr.us-west-1.amazonaws.com/web-code-base@sha256:ddfb3a6aecf3fa9fbafceb600f5d670efed472196b0dc405fc23b897a2a100d1 | |
| time IMAGE="web-code-base:normal-build" docker-compose --file tools/ci/scripts/docker/docker-compose-base.yml build web-code-base | |
| echo "--- web-code normal ---" | |
| docker system prune --all --force |
/**
* Encodes a tree to a single string.
*
* @param {TreeNode} root
* @return {string}
*/
var serialize = function(root) {
let result = []