Merge branch 'dev' into vhs

This commit is contained in:
Malin Freeborn 2023-09-14 19:00:06 +02:00
commit 89ec9614e5
Signed by: andonome
GPG Key ID: 52295D2377F4D70F
3 changed files with 86 additions and 3 deletions

24
basics/yes.md Normal file
View File

@ -0,0 +1,24 @@
---
title: "yes"
tags: [ "basics" ]
---
# The Best Linux Program: `yes`
The program `yes` prints the word `yes` to your terminal until you cancel it, perhaps with 'Control + c'.
Or technically it prints `yes\n`, meaning `yes` and then a new line (like pressing the Return key).
This is extremely powerful.
If you ever want to automatically install something which persistently nags you with `do you want to do the thing? [y/N]?`, then you can just pipe `yes` into that program, and it will answer 'yes' to all questions.
```bash
yes | $INSTALL_SCRIPT_FILE.sh
```
This works best for disposable systems, like VMs or containers.
Try this on a live system, and you might find out that you should have read that message fully.
```bash
yes | yay
```

View File

@ -0,0 +1,33 @@
---
title: "Brand Name Wallpaper"
tags: [ "void" ]
---
To automatically stick the logo onto your background, do these commands in the directory.
Get the void linux logo from wikipedia
```bash
wget https://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Void_Linux_logo.svg/256px-Void_Linux_logo.svg.png?20170131170632
```
Rename it, and resize it (the standard size is too small for most wallpapers)
```bash
convert -resize 200% '256px-Void_Linux_logo.svg.png?20170131170632' void-logo.png
```
Download a pretty wallpaper
```bash
wget http://wallpapercave.com/wp/Wlm9Gv0.jpg
```
Put the void logo on all *jpg and *png images
```bash
for x in *.jpg
do
composite -compose multiply -gravity Center void-logo.png "$x" "$x"
done
```

View File

@ -12,6 +12,11 @@ See changes in a directory, as it changes:
`watch -d ls *directory*`
Or use the `-g` flag to exit once the output changes.
This command will look at whether you're connected to the internet, and turn into a rainbow once the connection hits.
> watch -g ip address && clear && ip address | lolcat
## Automatic Renaming
There are a bunch of files:
@ -34,17 +39,19 @@ done
IFS is the field separator. This is required to denote the different files as marked by a new line, and not the spaces.
(Alternatively, just install `renameutils` and do `rename Column Alice *`)
## Arguments and Input
The `rm' program takes arguments, but not `stdin' from a keyboard, and therefore programs cannot pipe results into rm.
That said, we can sometimes pipe into rm with `xargs rm' to turn the stdin into an argument. For example, if we have a list of files called `list.txt' then we could use cat as so:
To fix this, use `xargs` to turn the stdin into an argument.
For example, if we have a list of files called `list.txt' then we could use cat as so:
```bash
cat list.txt | xargs rm
```
... *However*, this wouldn't work if spaces were included, as rm would take everything literally.
Of course if spaces are included in the file, you would have to account for that.
## Numbers
@ -71,3 +78,22 @@ find . -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 15
```bash
cat /dev/urandom | tr -cd [:alnum:] | dd bs=1 count=200 status=none && echo
```
## Temporary Working Directory
Try something out in a random directory in `/tmp` so the files will be deleted when you next shut down.
```bash
mktemp -d
```
That gives you a random directory to mess about in.
```bash
dir=$(mktemp -d)
for x in {A..Z}; do
fortune > "$dir"/chimpan-$x
done
cd $dir
```