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
$ echo -en "data \"null_data_source\" \"this\" {}\n" > data.tf | |
$ echo -en "resource \"null_resource\" \"this\" {}\n" > resources.tf | |
$ echo -en "terraform {\n cloud {}\n}\n" > versions.tf | |
$ tail *.tf | |
==> data.tf <== | |
data "null_data_source" "this" {} |
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/sh | |
# Given a terraform plan at plan.json... | |
is_refactor=$(jq --exit-status -null-input '[inputs | .resource_changes[].change.actions[] | test("^(read|no-op)$")] | all' plan.json) | |
# If it's a refactor, do something - e.g. auto-approve a pull request. |
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
# In CloudShell... | |
# Checkout custom provider Git repo | |
CUSTOM_PROVIDER_PATH=... # repo-org/repo-path | |
CLONE_DIR=custom-provider | |
BRANCH_NAME=... | |
git clone https://github.com/$CUSTOM_PROVIDER_PATH.git --branch $BRANCH_NAME $CLONE_DIR | |
cd $CLONE_DIR | |
# Build custom provider from the directory containing the crossplane.yaml file |
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/sh | |
# Example of how to import Flyway migration scripts sourced in a separate repo | |
git fetch $(cat path/to/repo/url) refs/tags/<tag>:refs/tags/<tag> | |
git read-tree --prefix=db -u refs/tags/<tag> | |
git rm -r src/main/resources/db | |
git mv db/ src/main/resources/ | |
git commit | |
git tag -d <tag> |
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/sh | |
# Despite the [official line](https://github.com/microsoft/WSL/issues/5324) reporting that the issue is fixed... it isn't. | |
# Fortunately, the solution documented at https://1kko.com/2460635 works, and is nicer than alternatives because it doesn't | |
# involve fiddling with the host. Here is that solution scripted up. | |
test "$(id -u)" != 0 && echo "Please run as root/sudo." && exit 1 | |
sed --follow-symlinks -i.bak "s/^ConditionVirtualization=\!container/#\0/" /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service | |
systemctl daemon-reload |
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
const downloadPlaylist = async (playlistUrl) => { | |
const playlist = await (await fetch(playlistUrl)).text(); | |
const segmentUrls = playlist.split(/\r?\n/) | |
.map((line, index, lines) => /^#EXTINF: *([0-9]+(\.[0-9]+)?)(,.*)?/.test(line) && lines[index + 1]) | |
.filter(segment => segment != false) | |
.map(segment => new URL(segment, playlistUrl).href); | |
const sleep = sec => new Promise(res => setTimeout(res, sec * 1000)); | |
const segmentBlobs = []; | |
const now = Date.now(); |
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.sh | |
DOCKER_COMPOSE_VERSION=1.20.1 | |
# Download docker-compose to the permanent storage | |
echo 'Downloading docker-compose to the permanent VM storage...' | |
sudo mkdir -p /var/lib/boot2docker/bin | |
sudo curl -sL https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` -o /var/lib/boot2docker/bin/docker-compose | |
sudo chmod +x /var/lib/boot2docker/bin/docker-compose | |
sudo ln -sf /var/lib/boot2docker/bin/docker-compose /usr/local/bin/docker-compose |