This page is a work in progress with no schedule for updates. Just thought I'd pass on things that I found useful.

Precis -- Searches for an article on Wikipedia and prints out the summary paragraph at the beginning

#!/bin/env sh #This is very much a script in progress. One that often chokes, too. #usage: ./precis [search term(s)] input=$(echo "$@" | tr ' ' '_') string=$(curl -s "https://en.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&titles=$input&formatversion=2&exintro=1&explaintext=1&exsectionformat=plain" \ | sed -e 's:\\n:\n:g; s:\\":\":g; s:\"\}\]\}\}::g') printf "\n" printf "%s" "${string#*extract\":\"}" printf "\n"

Useful things in my .bash_aliases file:

alias lynx='lynx -accept_all_cookies -cookie_file=/dev/null' alias note='echo -e "\n$(date +%D%t%T)" >>${HOME}/Documents/notes.txt ; cat - >>${HOME}/Documents/notes.txt' alias todo='echo $(date +%D) "$@" >>${HOME}/Documents/todo.txt' alias peek='tree -dL 2' qf(){ find . -iname "*$1*" } 2>/dev/null

Bash-Blogger -- A simple twtxt-like microblogger written in bash

#!/bin/bash #text-blogger -- a bash-script-based micro-blogger modeled on twtxt, but #with fewer features. (i.e. posting is all you can do) #Posts show up in reverse-chronological order (i.e. top-posted) #Quotes, apostrophes, and some punctuation will have to be escaped #for them to appear in the text of your post. #usage: ./text-blogger [Your post goes here.] ds=$(date -Iseconds) #change name of outfile as desired outfile=outfile.txt if [ -e $outfile ]; then line=$(printf "1i$ds\t$*\n") sed -i "$line" $outfile else touch $outfile printf "$ds\t$*\n" >$outfile fi ~~~~~~~~~~~~~~~~~~~~~~~~~
~thumos thumos [at] tilde [dot] club September 2024