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 | |
input="$1" | |
shift | |
files_dir="$HOME/files" | |
mkdir -p "$files_dir" | |
# Delete old files | |
rm -f "$files_dir"/* |
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 | |
# Transcodes input video file to use the h265/HEVC codec. | |
# Outputs the same filename but with x264/h264/xvid/etc. replaced with HEVC. | |
sed=sed | |
if type gsed >/dev/null 2>&1; then | |
sed=gsed | |
fi | |
get_streams() { |
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
$ time node slow-windows-error.js | |
Error: connect ECONNREFUSED 127.0.0.1:4 | |
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1134:16) { | |
errno: 'ECONNREFUSED', | |
code: 'ECONNREFUSED', | |
syscall: 'connect', | |
address: '127.0.0.1', | |
port: 4 | |
} |
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
add() { | |
expr "$1" + "$2" | |
} |
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 | |
eval "`curl -sfLS import.pw`" | |
import "import.pw/robwhitby/shakedown" # load the framework | |
shakedown GET /foo # make a GET request | |
status 404 # assert on http status code | |
content_type 'text/html' # assert Content-Type header contains string | |
contains 'Not found' # assert body contains string | |
matches 'No.*' # assert body matches regex |
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 | |
testEquality() { | |
assertEquals 1 2 | |
} | |
# Load shUnit2. | |
eval "`curl -sfLS import.pw`" | |
import "import.pw/kward/shunit2" |
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
# This is the "base image" which contains Alpine Linux and Node.js v10.x.x preinstalled | |
FROM mhart/alpine-node:10 | |
# Use the `NPM_TOKEN` build arg to create the `~/.npmrc` file | |
ARG NPM_TOKEN | |
RUN echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc | |
# Set the working direcrory to `/usr/src` | |
WORKDIR /usr/src |
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
add() { | |
echo "$(( $1 + $2 ))" | |
} |
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 | |
jsfunc() { | |
local code="$(cat)" | |
local fn="$(cat <<EOFF | |
$1() { | |
node <(cat <<EOF | |
require('stream').Readable.prototype.then = function (...args) { return new Promise((res, rej) => { const bufs = []; this.on('error', rej).on('data', buf => bufs.push(buf)).on('end', () => res(Buffer.concat(bufs))); }).then(...args) }; | |
(async () => { | |
${code} | |
})().then(val => typeof val !== 'undefined' && console.log(typeof val === 'string' ? val : JSON.stringify(val, null, 2))).catch(err => console.error(err.stack) || process.exit(1)); |
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
// # Ghost Configuration | |
// Setup your Ghost install for deployment to Zeit Now.sh. | |
// This is a stripped down version of the default `config-example.js` | |
// file with only a single ("production") environment for simplicity. | |
// Full documentation can be found at http://support.ghost.org/config/ | |
var path = require('path'); |
NewerOlder