Compare commits

...

2 Commits

Author SHA1 Message Date
lee2sman 2585b65835 add offline-programs.gmi 2024-03-24 22:38:34 -04:00
lee2sman 3ada14f067 add offline-programs.gmi 2024-03-24 22:36:45 -04:00
3 changed files with 132 additions and 0 deletions

View File

@ -59,6 +59,7 @@ This page is coded by hand and may occasionally miss an article. The full list c
## Linux
=> offline-programs.gmi Offline programs (via aliases/functions)
=> remove-old-packages.gmi 2023-09-22 - How to remove old packages on Linux
=> why-cli.gmi 2023-07-31 - Why I use the command line
=> old-computer-recap.gmi 2023-07-17 - Old Computer Challenge 2023 Recap
@ -84,6 +85,7 @@ This page is coded by hand and may occasionally miss an article. The full list c
## Software
=> offline-programs.gmi Offline programs (via aliases/functions)
=> why-cli.gmi 2023-07-31 - Why I use the command line
=> old-computer-recap.gmi 2023-07-17 - Old Computer Challenge 2023 Recap
=> void-pi.gmi 2023-07-14 - Setting Up Void Linux on an Old Raspberry Pi
@ -118,6 +120,7 @@ This page is coded by hand and may occasionally miss an article. The full list c
## Permacomputing and Alternative and Minimal Computing
=> offline-programs.gmi Offline programs (via aliases/functions)
=> why-cli.gmi 2023-07-31 - Why I use the command line
=> old-computer-recap.gmi 2023-07-17 - Old Computer Challenge 2023 Recap
=> void-pi.gmi 2023-07-14 - Setting Up Void Linux on an Old Raspberry Pi

View File

@ -23,6 +23,7 @@ This gemlog is best visited between 1am and 6am local time.
██████████████████
```
=> offline-programs.gmi Offline programs (via aliases/functions)
=> categories.gmi Posts organized by category instead of date

128
offline-programs.gmi Normal file
View File

@ -0,0 +1,128 @@
# Offline programs (via aliases/functions)
2024-03-24
Responding to the challenge set out by Solderpunk this month to develop and share some piece of offline software that is offline-first I thought about what things I open a web browser to find out the answer to that could instead be easily found out through a short program, conversion, or lookup table.
=> gemini://zaibatsu.circumlunar.space/~solderpunk/gemlog/announcing-offlfirsoch-2024.gmi Announcing OFFLFIRSOCH 2024
### Thesaurus
I do a lot of writing and am frequently using a thesaurus to find better words, particularly when doing writing for school or grant applications. First I looked for thesaurus software in the Void package repository and found mythes. But I couldn't find a good CLI way to interact with it. Then I downloaded the mythes repository and attempted to build its examples but I couldn't make a successful build. I tried a few iterations but ultimately gave up. Next, despite my dislike of the Python packaging environment, I set up a python virtual environment (ugh) and installed cli-thesaurus, then built a fish function wrapper (instead of a Bash alias) since I use fish shell.
```
function thesaurus --description "find synonyms of words"
~/Software/venv/bin/python ~/Software/venv/bin/thesaurus $argv
end
```
So now I just need to type: thesaurus word-to-look-up
Is that how you're supposed to make a simple CLI shortcut? I'm not sure, but that's what I did.
### Inches to Centimeters
The next one seemed to be so simple that I thought I'd use fish shell's math command.
I often need to convert between inches and centimeters because Americans are insane and everywhere else uses centimeters and I work on bicycles which could have parts indicated one way or the other and I need to check they will work together.
The multiplication symbol needs to be escaped since it is the glob character in the shell. Here's the form it should take to convert an argumnt from inches to centimeters with the standard conversion rate of 2.54 centimeters per inch.
```
math $argv \* 2.54
```
And the conversion from centimeters to inches.
```
math $argv \* 1/2.54
```
So I made two fish functions:
```
#inches.fish
function inches --description "convert inches to centimeters"
echo $argv inches is (math $argv \* 2.54) centimeters
end
```
Example:
$ inches 20
20 inches is 50.8 centimeters
And next for converting centimeters to inches
```
function centimeters --description "convert centimeters to inches"
echo $argv centimeters is (math $argv \* 1/2.54) inches
end
```
It might be nice to do this instead with gforth so I coul write instead 53 centimeters instead of centimeters 53, but I haven't yet wrapped my head around how floating point numbers work in forth yet!
## Oldies but goodies
These are similar offline shell wrapper programs that I use already.
### Diceroll
```
function diceroll --description "Roll 1d6"
shuf -i 1-6 -n 1
end
```
If I had need to roll other dice occasionally I could alter it make use of an argument, maybe something like diceroll 20.
### calm
```
function calm --description "calm ocean sounds white noise"
play -n synth brownnoise synth pinknoise mix synth 0 0 10 10 40 trapezium amod 0.1 30
end
```
I believe I read this oneliner somewhere but I don't remember where.
### dither
There are websites to run dithering on an image. Here's a basic one I run. Requires imagemagick.
```
function dither --description 'dither, reduce size and grayscale file'
convert $argv -resize 800x600 -colorspace gray -ordered-dither 8x8 (string split -r -m1 . $argv)[1].gif
echo 'converted to dither: ' (string split -r -m1 . $argv)[1].gif
end
```
### music shuffler
I love the noise band Wolf Eyes and have acquired a few dozen of their albums. I often put it on in the background but want it to play randomly.
```
function wolfeyes
mplayer -quiet -shuffle -playlist ~/Music/wolf-eyes/playlist.txt
end
```
### download article for offline reading
### Game
I love the amount of games you can get when you download and install the bsdgames package. But I often forgot which ones it comes with, so I made this simple list to remind me.
```
function bsdgames --description 'list installed bsdgames'
echo "Installed bsdgames: adventure, arithmetic, atc, backgammon, battlestar, bcd, boggle, caesar, canfield, countmail, cribbage, dab, go-fish, gomoku, hack, hangman, hunt, mille, monop, morse, number, pig, phantasia, pom, ppt, primes, quiz, random, rain, robots, rot13, sail, snake, tetris-bsd, trek, wargames, worm, worms, wump, wtf "
end
```
=> ./index.gmi Back to index
---
You can leave a comment by emailing lettuce at the ctrl-c.club domain. Put the name of the post you're responding to and your comment and nickname to list.