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
// NOTE: inspired by https://www.innoq.com/en/blog/structured-logging/#structuredarguments | |
import net.logstash.logback.argument.StructuredArguments.kv | |
import org.slf4j.Logger | |
const val DEFAULT_KEY = "ctx" | |
internal fun o(ctx: Any? = null) = kv( | |
DEFAULT_KEY, | |
object { |
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 bash | |
usage() { | |
cat <<EOF | |
usage: | |
$0 -p productId remappings | |
options: | |
-p,--product-id: productId The keyboard product id (from Menu Bar\\⌥\SystemInformation...\Hardware) |
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
// stolen from https://gist.github.com/mikeal/1840641#gistcomment-3126524 | |
import { createServer } from 'net' | |
export default function getPort (port = 80, maxPort = 65535) { | |
if ((maxPort = parseInt(maxPort)) < (port = parseInt(port)) || isNaN(port) || isNaN(maxPort) || port < 0 || port > 65535 || maxPort < 0 || maxPort > 65535) { | |
return Promise.reject((() => { | |
const e = new Error('EPORTSPEC') | |
e.code = e.message | |
return e |
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
'use strict' | |
/** | |
* Function that returns a `Promise` that `await`s an `async` function's completion. | |
* | |
* @param {Object} [arg={}] The argument to be destructured. | |
* @param {function} [arg.asyncFn=AwaitingPromise.DEFAULT_FN] An `async` function whose completion is to be `await`ed. | |
* Defaults to a no-op function. | |
* @param {boolean} [arg.positive=true] If truey, the returned `Promise` will resolve if `asyncFn` does not throw, and will reject with the error that `asyncFn` throws. | |
* If falsey, the returned `Promise` will reject with parameter `err`'s value if `asyncFn` does not throw, and will resolve with the error that `asyncFn` throws. |
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 bash | |
NPM_UPDATE_DEFAULT_PACKAGE_FILE=package.json | |
NPM_UPDATE_PACKAGE_FILE=$NPM_UPDATE_DEFAULT_PACKAGE_FILE | |
usage() { | |
cat<<EOF | |
Update outdated npm packages to the latest available | |
$(basename "$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
#!/usr/bin/env bash | |
# This script implements the release branch workflow for helm charts. | |
# | |
# Requirements: | |
# git | |
# docker | |
# TODO: port this from bash to plain ol' sh (regex matching needs to be ported) |
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 bash | |
# This script implements the release branch workflow for docker images built by codefresh.io. | |
# | |
# Requirements: | |
# git | |
# docker | |
# TODO: port this from bash to plain ol' sh (regex matching needs to be ported) |
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
{{- define "dockercfg" -}} | |
{{- $hostname := required "A Docker image registry hostname is required" .Values.image.registry.auth.hostname -}} | |
{{- $username := required "A Docker image registry username is required" .Values.image.registry.auth.username -}} | |
{{- $password := required "A Docker image registry password is required" .Values.image.registry.auth.password -}} | |
{{- $email := required "A Docker image registry email is required" .Values.image.registry.auth.email -}} | |
{{- $auth := printf "%s:%s" $username $password | b64enc -}} | |
{{- $cfg := printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}}" $hostname $username $password $email $auth -}} | |
{{- $cfg | b64enc -}} | |
{{- end -}} |
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
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
YELLOW='\033[0;33m' | |
BLUE='\033[1;34m' | |
CLEAR='\033[0;0m' | |
red() { | |
printf "${RED}$1${CLEAR}\n" | |
} | |
green() { |
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 bash | |
SCRUM_TIME=${SCRUM_TIME-"08:45:00"} | |
BEFORE_DAY=${BEFORE_DAY-$(date +%Y-%m-%d)} | |
BEFORE_TIME=${BEFORE_TIME-$SCRUM_TIME} | |
AFTER_DAY=${AFTER_DAY-$(python -c "from datetime import datetime, timedelta; before = datetime.strptime('$BEFORE_DAY','%Y-%m-%d').date(); monday = before.strftime('%u') == '1'; days = -3 if monday else -1; after = before + timedelta(days=days); print after;")} | |
AFTER_TIME=${AFTER_TIME-$BEFORE_TIME} | |
TZ_OFFSET=$(date +%z) | |
AFTER="${AFTER_DAY}T${AFTER_TIME}${TZ_OFFSET}" | |
BEFORE="${BEFORE_DAY}T${BEFORE_TIME}${TZ_OFFSET}" | |
DIR="${DIR-$PWD}" |
NewerOlder