Skip to content

Instantly share code, notes, and snippets.

View ormaaj's full-sized avatar

Daniel Douglas ormaaj

View GitHub Profile
{ time dash /dev/fd/9; } 9<<\EOF
#set -x
n=0 max=2000
case $(command -v let) in let) ;; *) let() { while ${2+\:} return "$((! ( ${1:-0} )))"; do shift; done; }; esac
case $(command -v printf) in printf) ;; *) alias printf="echo -n "; esac
alias \
@eval=eval @eval2='eval ' \
@alias=alias @alias2='alias ' \
@echo='echo ' @printf='printf ';
unset -v aliasRestore
if ${BASH_VERSION+\:} false; then
shopt -s extglob lastpipe
if shopt -q expand_aliases; then
shopt -u expand_aliases
aliasRestore='shopt -s expand_aliases; unset -v aliasRestore'
fi
else
aliasRestore="$(alias) ; unset -v aliasRestore"
unalias -a
Verifying my Blockstack ID is secured with the address 1JGNdApmYocuG1HTmDdhvhSQ78UizP4R3Z https://explorer.blockstack.org/address/1JGNdApmYocuG1HTmDdhvhSQ78UizP4R3Z
@ormaaj
ormaaj / output
Last active April 9, 2021 10:21
C# plinq factorial
1
1
2
6
24
120
720
5040
#!/bin/bash
shopt -s expand_aliases extglob
alias \[='x=${BASH_COMMAND#"${BASH_ALIASES[\[]} "} command eval eval \"[[ \$x]\" \#'
set -x
[ ormaaj == or+([ma])j ]
echo "$?"
@ormaaj
ormaaj / tcpcap.ksh
Last active October 11, 2021 21:27
ksh93 remote pcap stream
#!/bin/ksh
typeset -T PollEvent=(
_Bool poll{in,out,pri,err,hup,nval,{rd,wr}{norm,band}}=false
)
typeset -T PollFD=(
integer fd
PollEvent events revents
)
@ormaaj
ormaaj / .bashrc
Last active June 25, 2021 13:16
bashrc alias setup
#!/bin/bash
# Dan Douglas <ormaaj@gmail.com>
#set -x
unalias -a
shopt -s extglob lastpipe expand_aliases
function libinit {
alias libinit='\unalias -a
\shopt -s extglob lastpipe expand_aliases; \libinit'
#!/usr/bin/env bash
# Debugging function for colored display of argv.
function args {
{ BASH_XTRACEFD=3 command eval "$(</dev/fd/0)"; } <<-'EOF' 3>/dev/null
case $- in *x*)
typeset +x BASH_XTRACEFD
set +x
trap 'trap RETURN; set -x' RETURN
esac
bash -o monitor -O lastpipe /dev/fd/3 3<<\EOF
typeset -A j jobs
n=0
while ((n++ < 3)); do
{ set -m; trap "exit \$n" exit; suspend; } &
jobs+=([$!]=)
done
{ for x in "${!jobs[@]}"; do sleep .2; kill -CONT "$x"; done; } &
until wait -fnp jid "${!jobs[@]}"
(( (${jobs[$jid]+j[\$jid] = }$?) == 0)); do
@ormaaj
ormaaj / Version ABIJM 93v- 2014-12-24
Last active September 8, 2021 15:30
ksh93v- vs. debian's 2020.0.0+really93u+20120801-9
(ins)root@ormaaj-laptop (162321) ~ # /mnt/ormaaj-laptop/ksh93 -c 'typeset -p .sh; print -v .sh; builtin -l'
namespace sh
{
typeset -l -i lineno=0
math=''
op_astbin=/opt/ast/bin
typeset -i pwdfd=10
typeset -C sig=()
typeset -C stats=()
typeset -s -i subshell=0