cs50 / codespace

https://cs50.readthedocs.io/cs50/codespace
GNU General Public License v3.0
111 stars 340 forks source link

Add ministat to the base image? #147

Closed defanator closed 5 months ago

defanator commented 5 months ago

Hi. Any chance to ensure ministat is available in the base image out of the box? Upstream repositories do provide one:

speller/ $ dpkg -s ministat
Package: ministat
Status: install ok installed
Priority: extra
Section: math
Installed-Size: 39
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Version: 20150715-1build1
Depends: libc6 (>= 2.14)
Description: simple tool for statistical comparison of data sets
 The ministat command from FreeBSD.  It calculates fundamental
 statistical properties of one or two numeric data sets, and
 whether a difference can be found between two data sets at a
 given confidence level.
Original-Maintainer: Ben Hutchings <ben@decadent.org.uk>

Having it would be nice for making statistically significant measurements (and bringing more fun!) like in the example below:

speller/ $ ./compare.sh 
runs: 10
text: texts/tolstoy.txt

running ./speller:   ..........
running ./speller50: ..........

my:
x <stdin>
    N           Min           Max        Median           Avg        Stddev
x  10          0.59          0.64          0.61         0.616   0.016465452

cs50:
x <stdin>
    N           Min           Max        Median           Avg        Stddev
x  10          0.61          0.74          0.65         0.652   0.037357135

compare.sh:

#!/bin/sh -e

RUNS=10
TEXT="texts/tolstoy.txt"

rm -f _cmy _c50

printf "runs: %s\n" "${RUNS}"
printf "text: %s\n\n" "${TEXT}"

printf "running ./speller:   "
for i in $(seq ${RUNS}); do printf "."; ./speller "${TEXT}" | fgrep -- 'TIME IN TOTAL' | awk '{print $4}' >>_cmy; done
printf "\n"

printf "running ./speller50: "
for i in $(seq ${RUNS}); do printf "."; ./speller50 "${TEXT}" | fgrep -- 'TIME IN TOTAL' | awk '{print $4}' >>_c50; done
printf "\n\n"

printf "my:\n"
cat _cmy | ministat -n

printf "\ncs50:\n"
cat _c50 | ministat -n

Huge kudos for CS50x to all and everyone of you folks! @dmalan @dlloyd09 @CarterZenke

dmalan commented 5 months ago

Hi @defanator, we've avoided installing packages that the course itself doesn't use, but we'll soon have a way to automate installation of preferred packages like these!