#!/bin/sh # calculate padding spaces for given string pad() { pad= pad_size=$(( 50-${#1} )) while [ $pad_size -gt 0 ]; do pad="$pad " pad_size=$(( $pad_size-1 )) done } # create blog line blog() { for file in $(find posts -type f -maxdepth 1 -name "*.txt" -o -name "*.gph" | sort) do local cdate="$(printf $file | sed 's,posts/\(....-..-..\).*,\1,g')" local title="$(head -1 $file | sed -r 's/(^.{46}).*/\1.../')" pad "$title" if [ "${file##*.}" == "gph" ]; then BLOG="[1| * $title$pad--:-- @ $cdate|/$file|server|port]\n$BLOG" else BLOG="[0| * $title$pad--:-- @ $cdate|/$file|server|port]\n$BLOG" fi done } git() { GIT=$(cat git/index.gph) } twtxt() { TWTXT="$(tail -5 /home/www/htdocs/gopher/tw.txt | while read -r TXT do TXT=$(printf "$TXT" | sed 's/@<\([^ ]*\)[^\>]*>/@\1/g') # collapse mentions DATE=$(printf "$TXT" | sed 's/\(....-..-..\)T\(..:..\).*/\1/g') # extract date TIME=$(printf "$TXT" | sed 's/\(....-..-..\)T\(..:..\).*/\2/g') # extract time TXT=$(printf "$TXT" | cut -d" " -f2-) # extract text TXT=$(printf "$TXT" | sed 's/%/%%/g;s/|/\\|/g') # fixes TXT=$(printf "$TXT" | sed -r 's/(^.{46}).*/\1.../') # truncate pad "$TXT" TWTXT="[1| * $TXT$pad$TIME @ $DATE|/tw?${DATE}T${TIME}|server|port]\n" printf "$TWTXT" done)" } journal() { if [ "$REMOTE_ADDR" == "116.203.153.95" ]; then JOURNAL=" { only available on gopher }\n" else for file in $(find journal -type f -maxdepth 1 -name "*.txt" -o -name "*.gph" | sort) do local cdate="$(printf $file | sed 's,journal/\(....-..-..\).*,\1,g')" local title="$(head -1 $file | sed -r 's/(^.{46}).*/\1.../')" pad "$title" if [ "${file##*.}" == "gph" ]; then JOURNAL="[1| * $title$pad--:-- @ $cdate|/$file|server|port]\n$JOURNAL" else JOURNAL="[0| * $title$pad--:-- @ $cdate|/$file|server|port]\n$JOURNAL" fi done fi } honks() { HONKS=$(curl -Ls "https://honk.codevoid.de/rss" | sfeed | grep -v bonked | \ sed -e 's/<[^>]*>//g' | sed -e "s/\&#..;/'/g" | \ awk -F"\t" '{ print "[h| * "substr($4" ",1,46)"... "$1"|URL:"$3"|server|port]" }' | head -5 | tail -r ) } # MODULES (can be used with same value in uppercase as variable) blog git twtxt journal # Linux people do what they do because they hate Microsoft. # We do what we do because we love Unix. # ~ Theo de Raadt printf "%s" \ ' ___ _____ ____ ____ _ _ _____ ____ ____ / __)( _ )( _ \( ___)( \/ )( _ )(_ _)( _ \ ( (__ )(_)( )(_) ))__) \ / )(_)( _)(_ )(_) ) \___)(_____)(____/(____) \/ (_____)(____)(____/ Good software lets me sleep. ~ Michael W. Lucas ' printf " === PHLOG ============================================================ $BLOG === GIT REPOSITORIES ================================================= $GIT === TWTXT TWEETS ==================================================== $TWTXT === INTERESTING ON GOPHER ============================================ [1| * Bitreich|/|bitreich.org|70] [1| * Phlogosphere|/lawn/c/phlog.gph|bitreich.org|70] [1| * RaumZeitLabor Media Gopher|/|gopher.raumzeitlabor.org|70] [1| * The Gopher Lawn|/lawn|bitreich.org|70] [1| * Youtube Gopher|/yt|server|port] === STUFF I WROTE FOR GOPHER ========================================= [1| * 100 Days SAP SE share|/sap|server|port] [1| * CNN|/cnn|server|port] [1| * FIXME Date Planner|/fixme|server|port] [1| * Fefes Blog|/fefe|server|port] [1| * Hacker News|/hn|server|port] [1| * Slashdot Main Feed|/slashdot|server|port] [1| * Heise Podcast|/heise_podcast|server|port] === BECAUSE WHY NOT ================================================== [1| * Got Breached - Excuse Generator|/excuse|server|port] [1| * Magic 8Ball|/8ball|server|port] [1| * Name/Address Generator|/idgen|server|port] === INTERNET MUSIC =================================================== [h| * Bandcamp|URL:https://bandcamp.com|server|port] [h| * Jamendo|URL:https://www.jamendo.com|server|port] [h| * Psychedelik|URL:https://www.psychedelik.com|server|port] === ADMIN STUFF ====================================================== [1| * jail/vmm status (slow because it pings)|/vmm|server|port] [1| * traffic/load/space of gopher hole|/stats|server|port] Contact: $ finger(1) finger@codevoid.de "; #|------------------------------------------------------------>|<72c