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 | |
set -e | |
function usage() | |
{ | |
echo "Usage: $(basename $0) PATH" | |
} | |
function to_env() |
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 node | |
function memoize(fn) { | |
const cache = {}; | |
return (...args) => { | |
const key = JSON.stringify(args); | |
cache[key] = cache[key] || fn(...args); | |
return cache[key]; | |
}; | |
} |
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 node | |
const Parser = require("junitxml-to-javascript"); | |
function countErrors(testsuites) { | |
let errors = 0; | |
for (const testsuite of testsuites) { | |
errors += testsuite.errors; | |
} | |
return errors; |
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 jq -f | |
# Flatten ./flatten.jq [FILE...] | |
# Unflatten: ./flatten.jq [FILE...] --args unflatten | |
def json_flatten: | |
[ paths(scalars) as $path | { Key: $path | join("/"), Value: getpath($path) } ] | |
; | |
def json_unflatten: |
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 jq -rf | |
# input is assumed to be an array of JSON entries [{"Key": ..., "Value": ... }, ...] | |
.[] | |
| [.Key,.Value] | |
| @tsv |
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
# Decode AWS parameter store configuration | |
get_parameters_by_path() { | |
local prefix=$1 | |
shift | |
local starting_token="$*" | |
json=$( | |
aws ssm get-parameters-by-path \ | |
--path $prefix \ | |
--max-items 30 \ |
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
const crypto = require("crypto"); | |
const assert = require("assert"); | |
const tls = require("tls"); | |
function getCertificate(url) { | |
if (url.protocol !== "https:") { | |
throw new TypeError("Expected an HTTPS URL"); | |
} | |
return new Promise((resolve, reject) => { |
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
interface Result<S> { | |
failure?: Error; | |
success?: S; | |
} | |
class Failure implements Result<never> { | |
failure: Error; | |
constructor(failure: string | Error) { | |
if (failure instanceof Error) { | |
this.failure = failure; |
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
-- You sane bro? | |
DROP SCHEMA public CASCADE; | |
CREATE SCHEMA public; | |
GRANT ALL ON SCHEMA public TO postgres; | |
GRANT ALL ON SCHEMA public TO public; | |
COMMENT ON SCHEMA public IS 'standard public schema'; |
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 node | |
const [NODE_MAJOR_VERSION] = process.versions.node.split('.'); | |
const assert = require('assert'); | |
assert(NODE_MAJOR_VERSION >= 18, 'NodeJs 18 or greater is required'); | |
function countryEmoji(code) { | |
const offset = 0x1f1a5; | |
return code | |
.toUpperCase() |