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
type Append<A extends any[], E> = [...A, E]; | |
type AsyncReturnType<F extends (...args: any[]) => Promise<any>> = | |
ReturnType<F> extends Promise<infer R> ? R : never; | |
type CallbackFn<F extends (...args: any[]) => Promise<any>> = ( | |
...args: Append< | |
Parameters<F>, | |
() => (res?: AsyncReturnType<F>, err?: Error) => void |
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 -euo pipefail | |
trap 'echo && echo "ERROR: $BASH_SOURCE:$LINENO $BASH_COMMAND" >&2' ERR | |
# Args and env | |
FILENAME="${1:?"Usage: $0 {filename}"}" | |
FILE_BASENAME=${FILENAME##*/} | |
ASSET_NAME="${2:-${ASSET_NAME:-${FILE_BASENAME%".mp4"}}}" | |
NFT_METADATA="${3:-${NFT_METADATA:-"{}"}}" |
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
import {ColossusContext} from 'colossus' | |
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
export default { | |
events: { | |
onAppsLinked: async (ctx) => { | |
const id = Math.floor(10000*Math.random()) |