Skip to content

Instantly share code, notes, and snippets.

View isaiahtaylor's full-sized avatar

Isaiah Taylor isaiahtaylor

View GitHub Profile
@isaiahtaylor
isaiahtaylor / unhacked.md
Created September 2, 2022 20:18
Get unhacked SurfingKeys

Here's how to get SurfingKeys back, unhacked

  • Clone:
git clone https://github.com/brookhong/Surfingkeys.git
cd Surfingkeys
git checkout 83721a81a21fe1527d269c91b93ca28c42598e69 # last known safe commit
git branch SAFE # make a new branch at this point
git checkout SAFE
@isaiahtaylor
isaiahtaylor / archive_example.tf
Created July 8, 2021 18:43
Watch a directory with archive_file (don't do this)
data "archive_file" "lambda_source" {
type = "zip"
source_dir = "${path.module}/lambdas/mylambda/"
output_path = "lambda_source.zip"
}
resource "null_resource" "lambda_deploy" {
triggers = {
lambda_hash = "${data.archive_file.lambda_source.output_sha}"
}
@isaiahtaylor
isaiahtaylor / gethash.sh
Created July 8, 2021 18:34
Hash a directory for Terraform external data source
#!/usr/bin/env bash
set -e
eval "$(jq -r '@sh "DIRECTORY=\(.directory)"')"
HASH=$(git ls-files --exclude-standard -os ${DIRECTORY} | git hash-object --stdin)
echo "{\"checksum\": \"${HASH}\"}"
@isaiahtaylor
isaiahtaylor / lambda.tf
Created July 8, 2021 18:31
Depend on a source directory for terraform deployments
data "external" "lambda_source_trigger" {
program = ["${path.module}/gethash.sh"]
query = {
directory = "${path.module}/lambdas/mylambda"
}
}
resource "null_resource" "deploy_lambda" {
triggers = {
@isaiahtaylor
isaiahtaylor / gitportant.sh
Last active July 8, 2021 18:51
Hash a directory while respecting .gitignore
git ls-files --exclude-standard -os $SRC | git hash-object --stdin
# Outputs: 6c385b1a8e5438bb756bac652d0cd6be9d555dbe (or similar)
@isaiahtaylor
isaiahtaylor / code
Last active November 2, 2023 20:40
VS Code's "code" command for code-server
#!/bin/bash
set -e
function cleanup {
echo ""
echo "Cleaning up processes"
kill -SIGINT -$GID
}
trap cleanup EXIT
if [ "$1" ]; then