Compare commits
24 Commits
786178195b
...
a8617fb5b1
Author | SHA1 | Date | |
---|---|---|---|
a8617fb5b1 | |||
98ffbe660a | |||
b34520c890 | |||
04814ff498 | |||
bbaee49831 | |||
7eea76f2be | |||
0544be1bbb | |||
069b0752e3 | |||
4447d3f877 | |||
8a4896b971 | |||
f3143876db | |||
b2ea104e96 | |||
5a1ba18176 | |||
3457ed4c61 | |||
75cf02197e | |||
f62e007d1f | |||
095adff052 | |||
f4176a9ddb | |||
588ce9b0cb | |||
bd657c9ddc | |||
658bda6eea | |||
7ec037d5df | |||
92d14e41b5 | |||
79fff90250 |
@ -1,6 +0,0 @@
|
||||
---
|
||||
title: "Linux Knowledge Base"
|
||||
---
|
||||
|
||||
{{< ticks >}}
|
||||
{{< /ticks >}}
|
12
basics/Joyous_ASCII.md
Normal file
12
basics/Joyous_ASCII.md
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
title: "Joyous ASCII"
|
||||
tags: [ "fun" ]
|
||||
---
|
||||
|
||||
- `asciiquarium`
|
||||
- `cbonsai -lim "$(fortune)"`
|
||||
|
||||
```bash
|
||||
cow=$(cowsay -l | sort -R | head -1)
|
||||
fortune -s | figlet | cowsay -nf $cow | lolcat
|
||||
```
|
114
basics/cron.md
114
basics/cron.md
@ -2,9 +2,11 @@
|
||||
title: "cron"
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
# Cron
|
||||
# Cronie
|
||||
|
||||
The crontab program might have various names, like `cronie` or `crond`.
|
||||
The `cronie` program is also known as `crond`.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
sudo apt search -n ^cron
|
||||
@ -17,29 +19,33 @@ sudo systemctl list-unit-files | grep cron
|
||||
sudo systemctl enable --now $NAME
|
||||
```
|
||||
|
||||
Make a file for your crontab, like this:
|
||||
## Usage
|
||||
|
||||
Show your current crontab:
|
||||
|
||||
```bash
|
||||
echo '39 */3 * * * /usr/bin/updatedb' > "$USER".cron
|
||||
crontab -l
|
||||
```
|
||||
|
||||
You can put this in a file and edit it:
|
||||
|
||||
```bash
|
||||
crontab -l > $filename
|
||||
echo '39 3 */3 * * /bin/tar czf /tmp/etc_backup.tgz /etc/' >> $filename
|
||||
```
|
||||
|
||||
Then apply that crontab:
|
||||
|
||||
```bash
|
||||
crontab "$USER".cron
|
||||
rm "$USER".cron
|
||||
crontab $filename
|
||||
rm $filename
|
||||
```
|
||||
|
||||
The `cron` program will check your syntax before adding the tab.
|
||||
|
||||
Your crontab file sits somewhere in `/var/spool/`.
|
||||
Probably in `/var/spool/cron`.
|
||||
|
||||
Check how your tab currently looks:
|
||||
|
||||
```bash
|
||||
crontab -l
|
||||
```
|
||||
|
||||
## Syntax
|
||||
|
||||
`* * * * *`
|
||||
@ -50,43 +56,61 @@ These five points refer to:
|
||||
|
||||
So '3pm every Sunday' would be:
|
||||
|
||||
> 0 15 * * 7
|
||||
`0 15 * * 7`
|
||||
|
||||
Here 'Sunday' is indicated by "7", and '3pm' is 'the 15th hour'.
|
||||
The minute is '0' (i.e. '0 minutes past three pm').
|
||||
|
||||
Doing the same thing, but only in February, would be:
|
||||
|
||||
> 0 15 * 2 7
|
||||
`0 15 * 2 7`
|
||||
|
||||
### Full Paths
|
||||
### Variables
|
||||
|
||||
`cronie` doesn't know where you live, so to put something in your `$HOME` directory, you have to tell it:
|
||||
|
||||
Executing something requires the full path to where it is, so you cannot simply use `apt update -y`, because cron does not know where `apt` is.
|
||||
Instead, find out where it is:
|
||||
|
||||
```bash
|
||||
type -P apt
|
||||
echo "HOME=$HOME" > $filename
|
||||
crontab -l >> $filename
|
||||
crontab $filename
|
||||
```
|
||||
|
||||
`/usr/bin/apt`
|
||||
`cronie` doesn't know where anything lives, including programs.
|
||||
You can give it your usual `$PATH` variable like this:
|
||||
|
||||
Then put that into the crontab:
|
||||
|
||||
```bash
|
||||
sudo crontab -e
|
||||
echo $PATH > $filename
|
||||
crontab -l >> $filename
|
||||
crontab $filename
|
||||
```
|
||||
|
||||
> 40 */3 * * * /usr/bin/apt update -y
|
||||
Now instead of doing this
|
||||
|
||||
This will run `apt update -y` as root every 3 hours, at 40 minutes past the hour, e.g. 00:40, 03:40, 06:40.
|
||||
`40 */3 * * * /usr/bin/du -sh $HOME/* | sort -h > $HOME/sum.txt`
|
||||
|
||||
## Directories
|
||||
You can simply do this:
|
||||
|
||||
`40 */3 * * * du -sh $HOME/* | sort -h > $HOME/sum.txt`
|
||||
|
||||
## Run as Root
|
||||
|
||||
You can execute a script as root by putting it into a directory, instead of in the tab.
|
||||
Look at the available cron directories:
|
||||
|
||||
```bash
|
||||
ls /etc/cron.\*
|
||||
ls -d /etc/cron.*
|
||||
```
|
||||
|
||||
Make a script which runs daily:
|
||||
|
||||
```bash
|
||||
f=apt_update.sh
|
||||
echo '#!/bin/bash' > $f
|
||||
echo 'apt update --yes' >> $f
|
||||
chmod +x $f
|
||||
sudo mv $f /etc/cron.daily/
|
||||
```
|
||||
|
||||
### Testing with runparts
|
||||
@ -97,47 +121,9 @@ Run-parts runs all executable scripts in a directory.
|
||||
run-parts /etc/cron.hourly
|
||||
```
|
||||
|
||||
## Tips
|
||||
|
||||
### Variables
|
||||
|
||||
Add your `$HOME` to crontab to use scripts.
|
||||
First add `HOME=/home/$USER`, then you can use syntax like this:
|
||||
|
||||
0 * * * * $HOME/.scripts/myScript.sh
|
||||
|
||||
*Remember to test the script by executing that line first*:
|
||||
|
||||
```bash
|
||||
$HOME/.scripts/myScript.sh
|
||||
```
|
||||
You can also add your regular path to your crontab as a variable (see example below).
|
||||
If you're using vim as the editor, just run this at the top of your crontab:
|
||||
|
||||
```bash
|
||||
:r!echo PATH=$PATH
|
||||
```
|
||||
# Troubleshooting
|
||||
|
||||
### `date` Commands
|
||||
|
||||
Cron doesn't understand the `%` sign, so if you want to use `date +%R`, then it should be escaped with a backslash: `date +\%R`.
|
||||
|
||||
### File Location
|
||||
|
||||
The crontab files are in `/var/spool/cron/`, so you can backup or restore them.
|
||||
|
||||
# Example
|
||||
|
||||
```
|
||||
HOME=/home/user
|
||||
PATH=/usr/condabin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/user/.local/bin:/home/user/.scripts/:/home/user/.local/bin:/home/user/.scripts/
|
||||
|
||||
1 0 1 * * /usr/bin/mkdir -p $HOME/arc/$(date +\%Y/\%m)
|
||||
|
||||
18 0 1 */3 * $HOME/.scripts/mail-clean.sh
|
||||
|
||||
* * * * * ping -c 1 home || mail-pull.sh
|
||||
|
||||
50 18 * * * /usr/bin/timeout 30m /usr/bin/syncthing
|
||||
|
||||
```
|
||||
|
180
basics/setup/Quality_of_Life.md
Normal file
180
basics/setup/Quality_of_Life.md
Normal file
@ -0,0 +1,180 @@
|
||||
---
|
||||
title: "Quality of Life"
|
||||
tags: [ "basics", "setup" ]
|
||||
dependencies: [ "vi", "basics" ]
|
||||
---
|
||||
|
||||
This & That
|
||||
===========
|
||||
|
||||
Refer to 'that last thing', and 'the first thing':
|
||||
|
||||
```bash
|
||||
fortune -l > file1
|
||||
cat !$ | tr -d u
|
||||
diff !^ !$
|
||||
```
|
||||
|
||||
**NB:** this can go wrong:
|
||||
|
||||
```bash
|
||||
ls -l file1 file2
|
||||
cat !^
|
||||
```
|
||||
|
||||
Done
|
||||
----
|
||||
|
||||
`<C-d>`
|
||||
|
||||
- If you have a command, Control + d will execute the command.
|
||||
- If you have nothing, `exit`.
|
||||
|
||||
Input Run-Commands (`~/.inputrc`)
|
||||
=================================
|
||||
|
||||
Alias Expansion
|
||||
---------------
|
||||
|
||||
```bash
|
||||
echo '"\C- ": shell-expand-line' >> ~/.inputrc
|
||||
exec bash
|
||||
```
|
||||
|
||||
Now you can expand all aliases with 'Control + Space'.
|
||||
Try just `ls`, then 'Control + Space'.
|
||||
|
||||
Glob Expansion (`*`)
|
||||
--------------------
|
||||
|
||||
```bash
|
||||
echo '"\C-x": glob-expand-word' >> ~/.inputrc
|
||||
exec bash
|
||||
ls *<C-x>
|
||||
```
|
||||
|
||||
- Are you sure you want to delete that?
|
||||
* `rm -r *<C-x>`
|
||||
- Clean up the Downloads folder:
|
||||
* `rm Downloads/*pdf<C-x>`
|
||||
|
||||
Arbitrary Commands
|
||||
------------------
|
||||
|
||||
Use `\n` as a 'newline' character to automatically press `<Return>`.
|
||||
|
||||
```bash
|
||||
echo 'Control-y: "| lolcat\n"' >> ~/.inputrc
|
||||
exec bash
|
||||
ls<C-y>
|
||||
```
|
||||
|
||||
```bash
|
||||
Control-l: "\C-u clear -x && ls\n"
|
||||
exec bash
|
||||
cd /etc/<C-l>
|
||||
```
|
||||
|
||||
Readline as Vi
|
||||
--------------
|
||||
|
||||
```bash
|
||||
echo 'set editing-mode vi' >> ~/.inputrc
|
||||
echo 'set keymap vi-insert' >> ~/.inputrc
|
||||
exec bash
|
||||
```
|
||||
|
||||
The prompt now works according to `vi`-motions.
|
||||
This goes much further than the bash-option, `set -o vi` ('set option: `vi`').
|
||||
It changes the cursor in the terminal, not just bash.
|
||||
|
||||
Try:
|
||||
|
||||
- `ls <C-n>`
|
||||
- `ls <C-p>`
|
||||
- Type some words.
|
||||
- `<Esc>0dw$p`
|
||||
- <Esc> to normal-mode, and go back with 'b', and forward with 'e'.
|
||||
- `4b` to step back four times.
|
||||
- `cE`
|
||||
- `<Esc>kcw`
|
||||
- ls -a<Esc>xxxx
|
||||
|
||||
Works with `python` too:
|
||||
|
||||
```python
|
||||
im<C-n>os<Return>
|
||||
os.li<C-n><Return>
|
||||
<Esc>kfn
|
||||
<C-d>
|
||||
```
|
||||
|
||||
Fix Globs!
|
||||
----------
|
||||
|
||||
If you tried the previous commands then they will not work any more, because the `vi`-commands overwrite the other commands.
|
||||
Remove them.
|
||||
|
||||
```bash
|
||||
sed '/ vi/d' ~/.inputrc
|
||||
sed -i '/ vi/d' ~/.inputrc
|
||||
|
||||
sed '1 i set editing-mode vi' .inputrc
|
||||
sed -i '1 i set editing-mode vi' ~/.inputrc
|
||||
sed -i '2 i set keymap vi-insert' ~/.inputrc
|
||||
```
|
||||
|
||||
Vi-sibility
|
||||
-----------
|
||||
|
||||
The `readline` prompt becomes confusing if you don't remember if you're in insert or normal mode.
|
||||
But you can show the current mode in the prompt:
|
||||
|
||||
```bash
|
||||
echo 'set show-mode-in-prompt on' >> ~/.inputrc
|
||||
exec bash
|
||||
```
|
||||
|
||||
Set new symbols for normal and insert mode:
|
||||
|
||||
```bash
|
||||
echo 'set vi-ins-mode-string " "' >> ~/.inputrc
|
||||
echo 'set vi-cmd-mode-string " "' >> ~/.inputrc
|
||||
```
|
||||
|
||||
Fuzzy Sort
|
||||
==========
|
||||
|
||||
Check your repos for `sk-im`, and install.
|
||||
The program is called `sk`.
|
||||
|
||||
```bash
|
||||
FUZZY=sk
|
||||
```
|
||||
|
||||
If you don't have it, `fzy` or `fzf` should work the same way.
|
||||
|
||||
```bash
|
||||
FUZZY=fzy
|
||||
```
|
||||
|
||||
Find some 'read-config' files to check out:
|
||||
|
||||
```bash
|
||||
find . -maxdepth 2 -name "*rc"
|
||||
find . -maxdepth 2 -name "*rc" | $FUZZY
|
||||
```
|
||||
|
||||
And read some:
|
||||
|
||||
```bash
|
||||
PAGER='less -R'
|
||||
$PAGER "$(find . -maxdepth 2 -name "*rc" | $FUZZY)"
|
||||
```
|
||||
|
||||
Make the change long-term:
|
||||
|
||||
```bash
|
||||
alias rrc='$PAGER "$(find . -maxdepth 2 -name "*rc" | sk)"'
|
||||
alias | grep rrc= >> ~/.bash_aliases
|
||||
```
|
@ -92,7 +92,7 @@ A branch is a full copy of the project to test additional ideas.
|
||||
You can make a new branch called 'featurez' like this:
|
||||
|
||||
```bash
|
||||
git branch *featurez*
|
||||
git branch $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
Have a look at all your branches:
|
||||
@ -104,19 +104,20 @@ git branch
|
||||
Switch to your new branch:
|
||||
|
||||
```bash
|
||||
git checkout *featurez*
|
||||
git checkout $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
And if your changes are rubbish, checkout the "master" branch again, then delete "featurez":
|
||||
|
||||
```bash
|
||||
git branch -D *featurez*
|
||||
git branch -D $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
Or if it's a good branch, push it to the remote:
|
||||
|
||||
```bash
|
||||
git push *origin* *featurez*
|
||||
remote=origin
|
||||
git push $remote $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
## Merging
|
||||
@ -124,13 +125,13 @@ git push *origin* *featurez*
|
||||
Once you like the feature, merge it into the main branch. Switch to master then merge it:
|
||||
|
||||
```bash
|
||||
git merge *featurez*
|
||||
git merge $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
and delete `featurez` as you've already merged it:
|
||||
And delete the branch, as you've already merged it:
|
||||
|
||||
```bash
|
||||
git branch -d featurez
|
||||
git branch -d $FEATURE_BRANCH
|
||||
```
|
||||
|
||||
# Subtree
|
||||
@ -141,34 +142,6 @@ git branch -d featurez
|
||||
git subtree add -P config git@gitlab.com:bindrpg/config.git master
|
||||
```
|
||||
|
||||
## Pulling a Subtree from an existing git
|
||||
|
||||
The project has subdirectories sub-1,sub-2,sub-3. The first should be its own repository, but should also retain its own history.
|
||||
|
||||
First, we extract its history as an independent item, and make that into a seprate branch.
|
||||
|
||||
```bash
|
||||
git subtree split --prefix=sub-1 -b sub
|
||||
```
|
||||
|
||||
If you want something a few directories deep, you can use `--prefix=sub-1/dir-2/dir-3
|
||||
|
||||
Then go and create a new git somewhere else:
|
||||
|
||||
```bash
|
||||
cd ..;mkdir sub-1;cd sub-1;git init --bare
|
||||
```
|
||||
|
||||
Then go back to your initial git repo, and do the following:
|
||||
|
||||
git push ../subtest sub:master
|
||||
|
||||
Finally, you can clone this repo from your original.
|
||||
|
||||
```bash
|
||||
git clone ../subtest
|
||||
```
|
||||
|
||||
# Tricks
|
||||
|
||||
## Delete All History
|
||||
|
9
data/git/git_secret.md
Normal file
9
data/git/git_secret.md
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
title: "git-secret"
|
||||
tags: [ "data", "git" ]
|
||||
---
|
||||
|
||||
This utility is largely useless, as it can only identify people by their email.
|
||||
So if someone has multiple GPG keys associated with one email, the tool will not work.
|
||||
|
||||
A broken tool is better than a tool which will break soon.
|
34
data/git/subtree.md
Normal file
34
data/git/subtree.md
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
title: "git"
|
||||
tags: [ "Documentation", "data", "git", "subtree" ]
|
||||
---
|
||||
|
||||
## Pulling a Subtree from an existing git
|
||||
|
||||
The project has subdirectories `sub-1`, `sub-2`, `sub-3`.
|
||||
The first should be its own repository, but should also retain its own history.
|
||||
|
||||
First, we extract its history as an independent item, and make that into a seprate branch.
|
||||
|
||||
```bash
|
||||
git subtree split --prefix=sub-1 -b sub
|
||||
```
|
||||
|
||||
If you want something a few directories deep, you can use `--prefix=sub-1/dir-2/dir-3
|
||||
|
||||
Then go and create a new git somewhere else:
|
||||
|
||||
```bash
|
||||
cd ..;mkdir sub-1;cd sub-1;git init --bare
|
||||
```
|
||||
|
||||
Then go back to your initial git repo, and do the following:
|
||||
|
||||
git push ../subtest sub:master
|
||||
|
||||
Finally, you can clone this repo from your original.
|
||||
|
||||
```bash
|
||||
git clone ../subtest
|
||||
```
|
||||
|
@ -7,7 +7,7 @@ tags: [ "Documentation", "data", "GPG" ]
|
||||
Generate keys:
|
||||
|
||||
```bash
|
||||
gpg --gen-key
|
||||
gpg --full-generate-key
|
||||
```
|
||||
|
||||
Follow the guide.
|
||||
@ -24,7 +24,12 @@ Check you have an encrypted version of your file.
|
||||
|
||||
# Changing Expiration Dates
|
||||
|
||||
|
||||
```bash
|
||||
gpg --list-keys
|
||||
# or...
|
||||
gpg -k
|
||||
```
|
||||
|
||||
... and then use the second part of 'pub', which is the ID. But that's not appearing here so... on with gpg2?
|
||||
|
||||
@ -72,11 +77,11 @@ You get something like this:
|
||||
pub rsa3072 2021-08-15 [SC] [expires: 2023-08-15]
|
||||
CD30421FD825696BD95F1FF644C62C57B790D3CF
|
||||
uid [ultimate] Malin Freeborn <malinfreeborn@posteo.net>
|
||||
sub rsa3072 2021-08-15 [E] [expires: 2023-08-15]
|
||||
sub rsa3072 2021-08-15 [E] [expires: after-forever]
|
||||
|
||||
```
|
||||
|
||||
Notice the long, ugly, string - CD30421FD825696BD95F1FF644C62C57B790D3CF - and how horribly ugly it is.
|
||||
Notice the long, ugly, string - `CD30421FD825696BD95F1FF644C62C57B790D3CF` - and how horribly ugly it is.
|
||||
This is a fingerprint.
|
||||
|
||||
You can now decide the trust level (this stays on your computer).
|
||||
@ -124,7 +129,7 @@ Refreshing keys will tell you if some key you have contains a signature from som
|
||||
gpg --refresh-keys
|
||||
```
|
||||
|
||||
You can use the [crontab](../../basics/cron.md) to refresh keys.
|
||||
You can use the [crontab](../../basics/cron.md) to refresh keys, but this will mostly fail, since keyservers often don't hold the right data.
|
||||
|
||||
# Export
|
||||
|
||||
|
@ -1,10 +1,47 @@
|
||||
---
|
||||
title: "sc-im"
|
||||
tags: [ "Documentation", "data" ]
|
||||
tags: [ "Documentation", "TUI", "data" ]
|
||||
---
|
||||
# Edit
|
||||
|
||||
## Text
|
||||
- [Sample file](sc-im/sample.sc)
|
||||
|
||||
# Basic Commands
|
||||
|
||||
## See Cells
|
||||
|
||||
Cells are hard to see.
|
||||
Change this with `:set autowrap`.
|
||||
|
||||
Make `sc-im` always autowrap:
|
||||
|
||||
```bash
|
||||
mkdir .config/sc-im/bash
|
||||
echo 'set autowrap' >> .config/sc-im/scimrc
|
||||
```
|
||||
|
||||
## Movement
|
||||
|
||||
| Command | Key |
|
||||
|:------------------------------------|:---:|
|
||||
| highest part | H |
|
||||
| lowest part | L |
|
||||
| top | gg |
|
||||
| most right. | g$ |
|
||||
| most left. | g0 |
|
||||
| insert middle | \ |
|
||||
| insert left | \> |
|
||||
| insert right | < |
|
||||
| to to cell b4 | gb4 |
|
||||
| see all text in cells | aa |
|
||||
| format cells so you can see it. | f |
|
||||
| format wider right | fl |
|
||||
| format smaller left | fh |
|
||||
| format wider down | fj |
|
||||
| format smaller down | fk |
|
||||
|
||||
## Edit
|
||||
|
||||
### Text
|
||||
|
||||
| Action | Key |
|
||||
|:----------------------|:---:|
|
||||
@ -13,7 +50,7 @@ tags: [ "Documentation", "data" ]
|
||||
| text (right align) | `|` |
|
||||
| Edit existing text | E |
|
||||
|
||||
## Meta Actions
|
||||
### Meta Actions
|
||||
|
||||
| Action | Key |
|
||||
|:----------------------|:---:|
|
||||
@ -46,7 +83,7 @@ tags: [ "Documentation", "data" ]
|
||||
| format smaller down | fk |
|
||||
|
||||
|
||||
## Functions
|
||||
### Functions
|
||||
|
||||
| Action | Key |
|
||||
|:--------------------------------|:------------:|
|
||||
@ -56,7 +93,7 @@ tags: [ "Documentation", "data" ]
|
||||
| minimumof those numbers | =@min(B1:B8) |
|
||||
| multiply C1 to C8 | =@prod(C1:C8)|
|
||||
|
||||
## Visual
|
||||
### Visual
|
||||
|
||||
| Action | Key |
|
||||
|:--------------------------------|:------------:|
|
||||
|
38
data/sc-im/sample.sc
Normal file
38
data/sc-im/sample.sc
Normal file
@ -0,0 +1,38 @@
|
||||
# This data file was generated by the Spreadsheet Calculator Improvised (sc-im)
|
||||
# You almost certainly shouldn't edit it.
|
||||
|
||||
newsheet "Sheet1"
|
||||
movetosheet "Sheet1"
|
||||
offscr_sc_cols 0
|
||||
offscr_sc_rows 0
|
||||
nb_frozen_rows 1
|
||||
nb_frozen_cols 0
|
||||
nb_frozen_screenrows 2
|
||||
nb_frozen_screencols 0
|
||||
format A 14 1 0
|
||||
format B 18 2 0
|
||||
format 0 2
|
||||
freeze 0
|
||||
label A0 = "Food by Weight"
|
||||
leftstring B0 = "No. Meals"
|
||||
leftstring A1 = "Ajvar"
|
||||
let A1 = 5
|
||||
let B1 = A1*$A$10
|
||||
leftstring A2 = "Apples"
|
||||
let A2 = 3
|
||||
let B2 = A2*$A$10
|
||||
leftstring A3 = "Rocket"
|
||||
let A3 = 0.2
|
||||
let B3 = A3*$A$10
|
||||
leftstring A4 = "Beli Cheese"
|
||||
let A4 = 1
|
||||
let B4 = A4*$A$10
|
||||
leftstring A6 = "Total"
|
||||
let A6 = @sum(A1:A4)
|
||||
leftstring B6 = "Total"
|
||||
let B6 = @sum(B1:B4)
|
||||
leftstring A7 = "Average"
|
||||
let A7 = @avg(A1:A4)
|
||||
leftstring A10 = "Weight of Meal"
|
||||
let A10 = 0.3
|
||||
goto A0
|
28
distros/android/ssh_to_phone.md
Normal file
28
distros/android/ssh_to_phone.md
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
title: "ssh to phone"
|
||||
tags: [ "networking", "ssh", "android" ]
|
||||
---
|
||||
|
||||
1. Install fdroid on phone.
|
||||
2. Install termux.
|
||||
3. Open fdroid, and run:
|
||||
|
||||
|
||||
```bash
|
||||
pkg upgrade
|
||||
pkg install busybox termux-services openssh openssh-sftp-server
|
||||
source $PREFIX/etc/profile.d/start-services.sh
|
||||
```
|
||||
|
||||
`openssh-sftp-server` will mount the phone's file-system, and show you some directories in `~/storage/`.
|
||||
|
||||
4. Copy your PC's ssh public key to the phone's downloads or somewhere, so you can see it in `~/storage/downloads`.
|
||||
5. On the phone:
|
||||
* `yes | ssh-keygen`
|
||||
* `cat $pubkey.pub >> ~/.ssh/authorized_hosts`.
|
||||
* Check its ip address with `ifconfig | grep broadcast`
|
||||
* Check the phone's username with with `whoami`
|
||||
* `sshd -D`
|
||||
6. On the PC:
|
||||
* `ssh -p 8022 -l $phone_username $phone_ip`
|
||||
|
@ -39,7 +39,7 @@ Try placing this in a file:
|
||||
|
||||
> [ One ] { fill: seagreen; color: white; } -- label --> [ Two ] { shape: triangle; }
|
||||
>
|
||||
> [ One ] => { arrow-style: closed; } [ Three ]
|
||||
> [ One ] => { arrow-style: closed; } [ Three ] { border-style: none; }
|
||||
>
|
||||
> [ Five ] { fill: maroon; color: yellow; } <=> [ Three ]
|
||||
>
|
||||
@ -54,3 +54,15 @@ Try placing this in a file:
|
||||
> [ Eight ] .. [ None ] { shape: none; fill: red; color: brown; }
|
||||
>
|
||||
> [ no Network ] --> [ Is there an IP address? ]
|
||||
|
||||
> [ Little Group: o]
|
||||
|
||||
|
||||
```
|
||||
echo "( EU [ Madrid ] <---> [ K ] {label: Karlsruhe;}
|
||||
<== ...O\n ..o\n .O\no \nchoo choo ==> [ Cern ] [ Cern ] <== ...O\n ..o\n .O\no \nchoo choo ==> [ Paris ] <...> [ B ] {label: Budapest} )
|
||||
[ B ] <---> [ Belgrade ] [ G ] {label: Glasgow; }
|
||||
<==> [ M ] {label: Manchester },
|
||||
[ Madrid ] <---> [ Belgrade ] [ M ] <--> [ London ] <--> [ B ],
|
||||
[ Belgrade ]" | graph-easy --boxart
|
||||
```
|
||||
|
@ -83,7 +83,7 @@ If the file is in your home - `~` - but `transmission` is not allowed in your ho
|
||||
Next, find the torrent's number. You can use multiple numbers, separated with a comma:
|
||||
|
||||
```bash
|
||||
transmission-remote -t 3,5,8 --move /home/alice/music
|
||||
transmission-remote -t 3,5,8 --move $HOME/music
|
||||
```
|
||||
|
||||
## Change Default Location
|
||||
|
@ -93,7 +93,9 @@ apt install python3-certbot-nginx
|
||||
```
|
||||
|
||||
```bash
|
||||
certbot --nginx -d *mysite.tk* --non-interactive --agree-tos -m *webmaster@email.tld*
|
||||
domain=example.com
|
||||
my_email=me@posteo.uk
|
||||
certbot --nginx -d "$domain" --non-interactive --agree-tos -m "$my_email"
|
||||
```
|
||||
|
||||
When you are asked about redirecting from HTTP to HTTPS, say yes (option "2").
|
||||
|
@ -13,11 +13,14 @@ The ordering of `/etc/fstab` is
|
||||
5. dump
|
||||
6. pass
|
||||
|
||||
E.g.:
|
||||
|
||||
> UUID=877f14e8-4738-46b0-884f-ba330dad1a7d /mnt/biggie ext4 nofail,rw,relatime 0 2
|
||||
>
|
||||
> UUID=B21648C416488AF5 /mnt/share ntfs nofail,rw,nosuid,nodev,user_id=0,group_id=0,allow_other,blksize=4096 0 0
|
||||
*Example:*
|
||||
|
||||
```
|
||||
UUID=877f14e8-4738-46b0-884f-ba330dad1a7d /mnt/biggie ext4 nofail,rw,relatime 0 2
|
||||
|
||||
UUID=B21648C416488AF5 /mnt/share ntfs nofail,rw,nosuid,nodev,user_id=0,group_id=0,allow_other,blksize=4096 0 0
|
||||
```
|
||||
|
||||
## 5: Dump
|
||||
|
||||
|
@ -22,3 +22,8 @@ REP=5
|
||||
free --lohi -g -s $REP | lolcat
|
||||
```
|
||||
|
||||
Check the next thing cron will do:
|
||||
|
||||
```bash
|
||||
cronnext /var/spool/cron/$USER -l
|
||||
```
|
||||
|
@ -10,6 +10,12 @@ See a running log of all system messages:
|
||||
journalctl -f
|
||||
```
|
||||
|
||||
Or just one user:
|
||||
|
||||
```bash
|
||||
journalctl --user -f
|
||||
```
|
||||
|
||||
Or just one unit (`sshd`):
|
||||
|
||||
```bash
|
||||
|
@ -9,6 +9,14 @@ Turn a markdown file into a pdf:
|
||||
lowdown -stms "$FILE".md | pdfroff -itk -mspdf > "$FILE".pdf
|
||||
```
|
||||
|
||||
*Example:* put [this Makefile](lowdown/example.txt) in a directory, rename it `Makefile`, then do:
|
||||
|
||||
|
||||
```bash
|
||||
make example
|
||||
make
|
||||
```
|
||||
|
||||
To give the document a title, put that title in the metadata:
|
||||
|
||||
```bash
|
||||
|
36
vision/lowdown/example.txt
Normal file
36
vision/lowdown/example.txt
Normal file
@ -0,0 +1,36 @@
|
||||
output: all
|
||||
|
||||
.PHONY: example
|
||||
example: html/foot.html html/head.html
|
||||
mkdir -p articles/
|
||||
fortune > articles/fort_1.md
|
||||
fortune > articles/fort_2.md
|
||||
|
||||
HTML = $(patsubst articles/%.md,public/%.html,$(wildcard articles/*.md))
|
||||
|
||||
$(HTML): public/ articles/ $(wildcard html/*)
|
||||
|
||||
html/head.html:
|
||||
@mkdir $(@D)
|
||||
echo '<head> Something about CSS probably </head>' > $@
|
||||
echo '<body>' >> $@
|
||||
|
||||
html/foot.html: html/head.html
|
||||
echo '</body>' >> $@
|
||||
|
||||
public/%.html : articles/%.md
|
||||
cat html/head.html > $@
|
||||
lowdown $< >> $@
|
||||
cat html/foot.html >> $@
|
||||
|
||||
.PHONY: all
|
||||
all : $(HTML)
|
||||
|
||||
articles/:
|
||||
mkdir $@
|
||||
|
||||
public/:
|
||||
mkdir $@
|
||||
|
||||
clean :
|
||||
rm -rf public
|
Loading…
x
Reference in New Issue
Block a user