-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathz
executable file
·40 lines (31 loc) · 2.2 KB
/
z
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
# for when you want to take a quick note
if [ $# -ne 0 ]; then
printf 'Usage: z\n take a quick note\n' >&2
exit 1
fi
if [ -z "${EDITOR}" ]; then
EDITOR=$(which vim)
fi
if [ -z "${EDITOR}" ]; then
EDITOR=vi
fi
LOG=${HOME}/.z
cat - >>${LOG} <<EOT
╔══════════════════════════════════════════════════════════════════════════════╗
║ captain’s log, $(date '+%Y-%m-%d %H:%M:%S') ║
╚══════════════════════════════════════════════════════════════════════════════╝
Hostname: $(hostname --fqdn)
Username: $(whoami)
uptime: $(uptime)
uname -rms: $(uname -rms)
┌────────────────────────────────────────────────────────────────────────────┐
│ ps aux │
└─┬──────────────────────────────────────────────────────────────────────────┘
$(ps aux | sed 's/^/ │ /')
┌────────────────────────────────────────────────────────────────────────────┐
│ tmux capture-pane │
└─┬──────────────────────────────────────────────────────────────────────────┘
$(((which tmux &>/dev/null || (echo '<tmux unavailable>' && exit 1)) && tmux capture-pane -pS -) | sed 's/^/ │ /')
EOT
${EDITOR} + ${LOG}