Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
beep boop

Daniel Douglas ormaaj

🤖
beep boop
View GitHub Profile
@ormaaj
ormaaj / stdin
Last active Aug 29, 2015 — forked from anonymous/stdin
View stdin
_jshon() {
shopt -s lastpipe
typeset input status
{ tee /dev/fd/3 | jshon "$@" >&4; } 3>&1
input=$(</dev/fd/0)
((PIPESTATUS[0])) && printf %s "$input" >&2
return "${PIPESTATUS[0]}"
} 4>&1
@ormaaj
ormaaj / stdin
Last active Aug 29, 2015 — forked from anonymous/stdin
View stdin
_jshon() {
shopt -s lastpipe
{ tee /dev/fd/3 | jshon "$@" >&4; } 3>&1 |
input=$(</dev/fd/0)
((PIPESTATUS)) || echo "$input"
} 4>&1
@ormaaj
ormaaj / gist:5927201
Last active Dec 19, 2015 — forked from anonymous/gist:5926435
modified for sw
View gist:5927201
#!/bin/bash
${BASH_VERSION+shopt -s extglob lastpipe} 2>/dev/null
# Full path to a file to store our date offset data. Will be overwritten.
datefile=./datefile
# Assign your vars or insert whatever code does so here.
user=foouser password=mypassword db=mydbname
function doit {