<commit_before>#!/bin/bash
set -e

# Usage $ rmsafe [whatever]
#
# TODO: support multiple files later

target=$1
backupdir=$HOME/.rmsafe
mkdir -p $backupdir
tmpname=$backupdir/$(date +%Y%m%d%H%M%S)-$(basename $target)
mv $target $tmpname
RMSAFE_LAST=$tmpname
echo "Backup is kept at "$tmpname
export RMSAFE_LAST<commit_msg>Fix bug: garbage collection fail because of read-only assets<commit_after>#!/bin/bash
set -e

# Usage $ rmsafe [whatever]
#
# TODO: support multiple files later

target=$1
backupdir=$HOME/.rmsafe
mkdir -p $backupdir
tmpname=$backupdir/$(date +%Y%m%d%H%M%S)-$(basename $target)
# read-only files would `mv` for now but would cause trouble later when we `rm` for gc.
chmod -R u+w $target
mv $target $tmpname
RMSAFE_LAST=$tmpname
echo "Backup is kept at "$tmpname
export RMSAFE_LAST
{'fraction_non_alphanumeric': 0.13466334164588528, 'fraction_numerical': 0.0024937655860349127, 'mean_word_length': 5.581967213114754, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '6999815', 'n_tokens_mistral': 308, 'n_tokens_neox': 293, 'n_words': 89}