<commit_before>#!/bin/sh
# This script does the following:
# zram start:
#  * zram doesn't natively support multiple CPU cores, so one zram device
#    is created for every CPU core minus one)
#  * Space is assigned to each zram device, then swap is initialized on
#    there

# Some defaults:
ALLOCATION=100 # ZRAM Swap you want assigned, in MiB
PRIORITY=100   # Swap priority, see swapon(2) for more details

# Get amount of available CPU cores, set to 1 if not detected correctly
if [ ! -f /proc/cpuinfo ]; then
    echo "WARNING: Can't find /proc/cpuinfo, is proc mounted?"
    echo "         Using a single core for zramswap..."
    cores=1
else
    cores=$(grep -c processor /proc/cpuinfo)
fi

# Override  above from config file, if it exists
if [ -f /etc/default/zramswap ]; then
    . /etc/default/zramswap
fi

ALLOCATION=$((ALLOCATION * 1000 * 1000)) #turn amount into MiB

# Initialize zram devices, one device per CPU core
modprobe zram num_devices=$cores

# Assign memory to zram devices, initialize swap and activate
# Decrementing $core, because cores start counting at 0
for core in $(seq 0 $(($cores - 1))); do
    echo $(($ALLOCATION / $cores)) > /sys/block/zram$core/disksize
    mkswap /dev/zram$core
    swapon -p $PRIORITY /dev/zram$core
done<commit_msg>start: calculate Mebibytes instead of MB<commit_after>#!/bin/sh
# This script does the following:
# zram start:
#  * zram doesn't natively support multiple CPU cores, so one zram device
#    is created for every CPU core minus one)
#  * Space is assigned to each zram device, then swap is initialized on
#    there

# Some defaults:
ALLOCATION=100 # ZRAM Swap you want assigned, in MiB
PRIORITY=100   # Swap priority, see swapon(2) for more details

# Get amount of available CPU cores, set to 1 if not detected correctly
if [ ! -f /proc/cpuinfo ]; then
    echo "WARNING: Can't find /proc/cpuinfo, is proc mounted?"
    echo "         Using a single core for zramswap..."
    cores=1
else
    cores=$(grep -c processor /proc/cpuinfo)
fi

# Override  above from config file, if it exists
if [ -f /etc/default/zramswap ]; then
    . /etc/default/zramswap
fi

ALLOCATION=$((ALLOCATION * 1024 * 1024)) # convert amount from MiB to bytes

# Initialize zram devices, one device per CPU core
modprobe zram num_devices=$cores

# Assign memory to zram devices, initialize swap and activate
# Decrementing $core, because cores start counting at 0
for core in $(seq 0 $(($cores - 1))); do
    echo $(($ALLOCATION / $cores)) > /sys/block/zram$core/disksize
    mkswap /dev/zram$core
    swapon -p $PRIORITY /dev/zram$core
done
{'fraction_non_alphanumeric': 0.09691119691119691, 'fraction_numerical': 0.015444015444015444, 'mean_word_length': 3.5376532399299476, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2924942', 'n_tokens_mistral': 859, 'n_tokens_neox': 809, 'n_words': 336}