<commit_before>#!/bin/bash

# See: https://sipb.mit.edu/doc/safe-shell/
set -ef -o pipefail

# FIXME: Prompt user to set a good window size to begin with

# FIXME: Get these some other way on Linux?
brew install asciinema giflossy imagemagick

npm install asciicast2gif

# Make sure we have the latest build before recording
./ci.sh

# Record!
RECORDING=$(mktemp || mktemp -t ptop-ascii-recording.XXXXXXXX)
echo Recording into: "$RECORDING"...
asciinema rec --stdin --command="./px.pex --top" --overwrite "$RECORDING"
echo Recording saved into "$RECORDING"

# Convert the recording to a gif
./node_modules/.bin/asciicast2gif "$RECORDING" doc/ptop-screenshot.gif

rm "$RECORDING"

# Demo what we captured
open -a 'Google Chrome' doc/ptop-screenshot.gif<commit_msg>Tune script after testing it for realz<commit_after>#!/bin/bash

# See: https://sipb.mit.edu/doc/safe-shell/
set -eu -o pipefail

# FIXME: Prompt user to set a good window size to begin with, 90x24 for example

# FIXME: Get these some other way on Linux?
brew install asciinema giflossy imagemagick

npm install asciicast2gif

# Make sure we have the latest build before recording
./ci.sh

# Record!
RECORDING=$(mktemp || mktemp -t ptop-ascii-recording.XXXXXXXX)
echo Recording into: "$RECORDING"...
asciinema rec --stdin --command="./px.pex --top" --overwrite "$RECORDING"
echo Recording saved into "$RECORDING"

# Convert the recording to a gif
./node_modules/.bin/asciicast2gif -S1 "$RECORDING" doc/ptop-screenshot-new.gif

rm "$RECORDING"

# Demo what we captured compared to what we had
for SCREENSHOT in doc/ptop-screenshot*.gif; do
    echo
    ls -l "$SCREENSHOT"
    file "$SCREENSHOT"
    open -a 'Google Chrome' "$SCREENSHOT"
done
{'fraction_non_alphanumeric': 0.11443661971830986, 'fraction_numerical': 0.00528169014084507, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5912300', 'n_tokens_mistral': 611, 'n_tokens_neox': 601, 'n_words': 198}