char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
e9b6350e6
char/aliceai-t5-moe
1#!/usr/bin/env bash 2 3function usage { 4echo "usage: <n> $ 0" 5echo "note: n is the number of essays to download" 6echo "for specific n, the resulting pg.txt file will have the following number of tokens:" 7echo "n | tokens" 8echo "--- | ---" 9echo "1 | 6230" 10echo "2 | 23619" 11echo "5 | 25859" 12echo "10 | 36888" 13echo "15 | 50188" 14echo "20 | 59094" 15echo "25 | 88764" 16echo "30 | 103121" 17echo "32 | 108338" 18echo "35 | 113403" 19echo "40 | 127699" 20echo "45 | 135896" 21exit 1 22} 23 24function has_cmd { 25if ! [ -x" $( command -v $ 1 ) " ];then 26echo "error: $ 1 is not available" >&2 27exit 1 28fi 29} 30 31# check for: curl, html2text, tail, sed, fmt 32has_cmd curl 33has_cmd html2text 34has_cmd tail 35has_cmd sed 36 37if [$ # -ne 1 ];then 38usage 39fi 40 41n =$ 1 42 43# get urls 44urls =" $( curl http://www.aaronsw.com/2002/feeds/pgessays.rss | grep html | sed -e "s/.*http/http/" | sed -e "s/html.*/html/" | head -n $ n ) " 45 46printf "urls:\n%s\n" " $ urls " 47 48if [ -f pg.txt ];then 49rm pg.txt 50fi 51 52c =1 53for url in $ urls ;do 54echo "processing $ url " 55 56cc =$( printf "%03d" $ c ) 57 58curl -L $ url | html2text | tail -n +4| sed -E "s/^[[:space:]]+//g" | fmt -w 80>> pg-$ cc -one.txt 59cat pg-$ cc -one.txt>> pg.txt 60 61cp -v pg.txt pg-$ cc -all.txt 62c =$((c +1)) 63 64# don't flood the server 65sleep 1 66done 67 68echo "done. data in pg.txt" 69 70exit 0