Compare commits

...

3 Commits

Author SHA1 Message Date
b64d9de0c4
bad.horse bad.horse 2025-03-20 13:10:43 +01:00
fa9c8edb1d
edit Makefile intro 2025-03-18 18:54:17 +01:00
741e988536
base 16 notes 2025-03-18 18:11:57 +01:00
3 changed files with 42 additions and 6 deletions

View File

@ -3,6 +3,24 @@ title: "Base 16"
tags: [ "data" ]
---
```bash
Base 16 numbers often use `0x` at the start, so '10' just means '10', but `0x10` means '10 in base 16' which means '16'.
For small numbers, use `printf`.
```sh
printf "%x" $NUMBER
```
For any number, use `bc`.
```sh
fortune | md5sum | cut -d' ' -f1 | tr [:lower:] [:upper:] | bc
```
- Inputting base 16 uses `ibase=16`.
- Outputting base 10 uses `ibase=10`
```sh
echo 'ibase=16;' $(echo cbb478ac825f0dce7671254be035d0bc | tr [:lower:] [:upper:]) | bc
```

20
networking/bad_horse.md Normal file
View File

@ -0,0 +1,20 @@
---
title: "Mapping the Net"
tags: [ "networking", "graph", "fun" ]
---
Find the path to a domain:
```sh
domain=bad.horse
max_hops=50
tracepath -m $maximum_hops $domain
```
If you're on Debian, you can use `graph-easy` and `dothost` to make an instant diagram:
```sh
domain=dice.camp
dothost $domain | graph-easy --boxart
```

View File

@ -23,7 +23,8 @@ Using four spaces will not work!
## Dependency Files
Now we've made a `README.md` file, we can show how a makefile looks in the README:
Now we've made a `README.md` file, we can show how a makefile looks in the README file.
Add these lines to the `Makefile`:
```make
README.md: Makefile
@ -44,7 +45,7 @@ Note the order:
Notice that the file above can print into the README by using `echo "" >> $@`.
The `$@` stands for 'the file which we want', and `$<` stands for 'the first dependency file'.
The `make` program starts by replacing those variables, and the result it:
The `make` program starts by replacing those variables, so when you run `make`, the program looks like this:
```make
README.md: Makefile
@ -54,7 +55,6 @@ README.md: Makefile
cat Makefile >> README.md
echo '```' >> README.md
```
| Sigil | Meaning |
@ -71,7 +71,6 @@ README.md: Makefile
You can assign a variable normally, but must refer to it in brackets.
```make
storage_directory = backups
@ -182,4 +181,3 @@ In this case, the makefile can see that `backup` depends on the current backup f
- [File patterns](Makefiles/patterns.md)
- [Makefile graphs](Makefiles/graph-easy.md)
- [In-build help](Makefiles/help.md)
- [Makefile graphs](Makefiles/graph-easy.md)