Skip to content

Instantly share code, notes, and snippets.

Nathan Rajlich TooTallNate

Block or report user

Report or block TooTallNate

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
TooTallNate /
Last active Apr 16, 2020
Uploads a single file as a Now deployment
set -euo pipefail
mkdir -p "$files_dir"
# Delete old files
rm -f "$files_dir"/*
TooTallNate /
Last active Mar 24, 2020
Transcodes input video file to use the h265/HEVC codec
# Transcodes input video file to use the h265/HEVC codec.
# Outputs the same filename but with x264/h264/xvid/etc. replaced with HEVC.
if type gsed >/dev/null 2>&1; then
get_streams() {
TooTallNate / on-macos.txt
Created Feb 11, 2020
Does anyone know why this script takes >2s to receive the `error` event on Windows? On MacOS it's essentially instant…
View on-macos.txt
$ time node slow-windows-error.js
Error: connect ECONNREFUSED
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1134:16) {
syscall: 'connect',
address: '',
port: 4
add() {
expr "$1" + "$2"
TooTallNate /
Created Aug 15, 2018
Running `shakedown` HTTP unit tests through `import`
#!/usr/bin/env bash
eval "`curl -sfLS`"
import "" # 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
TooTallNate /
Created Aug 14, 2018
Running `shunit2` shell script tests through `import`
testEquality() {
assertEquals 1 2
# Load shUnit2.
eval "`curl -sfLS`"
import ""
TooTallNate / Dockerfile
Created Jul 17, 2018
Node.js + Dockerfile
View Dockerfile
# 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
RUN echo "//$NPM_TOKEN" > ~/.npmrc
# Set the working direcrory to `/usr/src`
WORKDIR /usr/src
TooTallNate /
Created Jun 23, 2018
Basic "add" function for bash, for demonstration purposes
add() {
echo "$(( $1 + $2 ))"
TooTallNate /
Created Jun 20, 2018
Write JavaScript functions - use as bash functions
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 () => {
})().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));
TooTallNate / config.js
Last active Aug 4, 2017
Ghost config.js file for the official Docker image
View config.js
// # Ghost Configuration
// Setup your Ghost install for deployment to Zeit
// 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
var path = require('path');
You can’t perform that action at this time.