Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ksh
typeset -T Record=(
integer uid
integer date=0
typeset description
)
typeset -T Log=(
Record -h '(internal) Array of log records.' -a records
NAME
cksum,md5sum,sum - print file checksum and block count
SYNOPSIS
cksum,md5sum,sum [ options ] [ file ... ]
DESCRIPTION
sum lists the checksum, and for most methods the block count, for each file
argument. The standard input is read if there are no file arguments. getconf
UNIVERSE determines the default sum method: att for the att universe, bsd
@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
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
#!/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
@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'
@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
)
#!/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 / output
Last active April 9, 2021 10:21
C# plinq factorial
1
1
2
6
24
120
720
5040
Verifying my Blockstack ID is secured with the address 1JGNdApmYocuG1HTmDdhvhSQ78UizP4R3Z https://explorer.blockstack.org/address/1JGNdApmYocuG1HTmDdhvhSQ78UizP4R3Z