This file contains 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
require "CSV" | |
items = [] | |
# The ips.csv data comes from copying the HTML table of IP ranges | |
# from the Salesforce profile in the UI from the org you want to copy. | |
# Workaround when you don't have metadata api access to the org to copy from. | |
CSV.foreach("ips.csv") do |row| | |
items << <<~XML | |
<loginIpRanges> |
This file contains 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 | |
# For when you have a train of pull requests lined up like A -> B -> C -> D | |
# and you make a change to base D that you now want backmerged to C then B then A. | |
set -e | |
# ---------------------------------------------------------------------------- | |
# List the pull request number (e.g. 42) in order that the backmerges |
This file contains 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 | |
# https://unix.stackexchange.com/questions/103920/parallelize-a-bash-for-loop | |
NAMES=($(cat names.csv)) | |
BATCH_SIZE=4 | |
for NAME in ${NAMES[@]}; do | |
# Increment or reset our counter |
This file contains 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
export HEAD=$(git branch --show-current) && \ | |
git checkout -B staging origin/staging && \ | |
git merge --no-ff $HEAD && \ | |
git push && \ | |
git checkout $HEAD |
This file contains 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 | |
set -e | |
if [ -z "${CIRCLECI_API_TOKEN}" ]; then | |
echo "Missing required environment variable: CIRCLECI_API_TOKEN" | |
echo "You can create one at https://app.circleci.com/settings/user/tokens" | |
fi | |
ORG_NAME="your-gh-org" |
This file contains 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
# Workaround to force the GitHub Pull Requests and Issues extension | |
# to associate to the most recent, open pull request for the checked out branch. | |
# https://github.com/microsoft/vscode-pull-request-github/issues/3798#issuecomment-1259003851 | |
function vspr() { | |
local branch=$(git branch --show-current) | |
local repo_json=$(gh repo view --json name,owner,parent,isFork) | |
local is_fork=$(jq -r '.isFork' <<< $repo_json) | |
local fork_owner=$(jq -r '.owner.login' <<< $repo_json) | |
local fork_repo=$(jq -r '.name' <<< $repo_json) |
This file contains 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 | |
# Export `CIRCLECI_API_TOKEN` env var by creating your own api token | |
# https://app.circleci.com/settings/user/tokens | |
ORG_NAME="changeme" | |
REPO_NAME="changeme" | |
PROJECT_SLUG="github/${ORG_NAME}/${REPO_NAME}" | |
ENV_KEY="FOO" |
This file contains 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 zsh | |
# Exit when any command fails | |
set -e | |
# https://docs.docker.com/engine/reference/commandline | |
SCRIPT_NAME=$(basename ${0}) | |
DELETE_BUILDER_CACHE=0 |
This file contains 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
# Opens in a browser the git remote url | |
# specified by the given remote. | |
# | |
# Arguments: | |
# $1 = git remote name (default is 'origin') | |
# | |
# Usage: | |
# $ openg [remote] | |
# | |
# Examples: |
This file contains 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
/** | |
* References: | |
* https://adelachao.medium.com/graph-topological-sort-javascript-implementation-1cc04e10f181 | |
* http://peterknolle.com/page/51/ | |
* https://en.wikipedia.org/wiki/Topological_sorting#Depth-first_search | |
*/ | |
class Graph { | |
private vertices: Record<string, Array<string>>; |