replaces lines with a substring match of that line (capture groups)
sed -E 's/regex/string/'
echo "a secret: 12345" | sed -E 's/a secret: (.*)/\1/'
(outputs 12345)
| # filter rows in a file by line number / position | |
| awk | |
| # filter rows in a file by regex | |
| grep | |
| # filter cols in a file | |
| awk | |
| # transform rows by regex |
read plist -> xml file
defaults read -app Terminal | plutil -convert xml1 -o plist.xml -r -- -
| /** | |
| * @param {number[][]} matrix | |
| * @param {number} target | |
| * @return {boolean} | |
| */ | |
| var searchMatrix = function(matrix, target) { | |
| if (matrix.length === 0) return false | |
| let filteredRows = getFilteredRows(matrix, target) | |
| let filteredCols = getFilteredCols(matrix, target) |
/**
* Encodes a tree to a single string.
*
* @param {TreeNode} root
* @return {string}
*/
var serialize = function(root) {
let result = []
| #!/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 |
| #!/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 |
| #!/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 |
| package main | |
| import ( | |
| "bytes" | |
| "fmt" | |
| "os" | |
| "os/exec" | |
| "strings" | |
| ) |
| # 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 |