Compare commits
No commits in common. "b64d9de0c4723e4a8248d5d0721c68a3c613d0ac" and "a72e2b117d86619e2197b71d089a3bd60648bb19" have entirely different histories.
b64d9de0c4
...
a72e2b117d
@ -3,24 +3,6 @@ title: "Base 16"
|
|||||||
tags: [ "data" ]
|
tags: [ "data" ]
|
||||||
---
|
---
|
||||||
|
|
||||||
Base 16 numbers often use `0x` at the start, so '10' just means '10', but `0x10` means '10 in base 16' which means '16'.
|
```bash
|
||||||
|
|
||||||
For small numbers, use `printf`.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
printf "%x" $NUMBER
|
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
|
|
||||||
```
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
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
|
|
||||||
```
|
|
@ -23,8 +23,7 @@ Using four spaces will not work!
|
|||||||
|
|
||||||
## Dependency Files
|
## Dependency Files
|
||||||
|
|
||||||
Now we've made a `README.md` file, we can show how a makefile looks in the README file.
|
Now we've made a `README.md` file, we can show how a makefile looks in the README:
|
||||||
Add these lines to the `Makefile`:
|
|
||||||
|
|
||||||
```make
|
```make
|
||||||
README.md: Makefile
|
README.md: Makefile
|
||||||
@ -45,7 +44,7 @@ Note the order:
|
|||||||
|
|
||||||
Notice that the file above can print into the README by using `echo "" >> $@`.
|
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 `$@` stands for 'the file which we want', and `$<` stands for 'the first dependency file'.
|
||||||
The `make` program starts by replacing those variables, so when you run `make`, the program looks like this:
|
The `make` program starts by replacing those variables, and the result it:
|
||||||
|
|
||||||
```make
|
```make
|
||||||
README.md: Makefile
|
README.md: Makefile
|
||||||
@ -55,6 +54,7 @@ README.md: Makefile
|
|||||||
cat Makefile >> README.md
|
cat Makefile >> README.md
|
||||||
echo '```' >> README.md
|
echo '```' >> README.md
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
| Sigil | Meaning |
|
| Sigil | Meaning |
|
||||||
@ -71,6 +71,7 @@ README.md: Makefile
|
|||||||
|
|
||||||
You can assign a variable normally, but must refer to it in brackets.
|
You can assign a variable normally, but must refer to it in brackets.
|
||||||
|
|
||||||
|
|
||||||
```make
|
```make
|
||||||
storage_directory = backups
|
storage_directory = backups
|
||||||
|
|
||||||
@ -181,3 +182,4 @@ In this case, the makefile can see that `backup` depends on the current backup f
|
|||||||
- [File patterns](Makefiles/patterns.md)
|
- [File patterns](Makefiles/patterns.md)
|
||||||
- [Makefile graphs](Makefiles/graph-easy.md)
|
- [Makefile graphs](Makefiles/graph-easy.md)
|
||||||
- [In-build help](Makefiles/help.md)
|
- [In-build help](Makefiles/help.md)
|
||||||
|
- [Makefile graphs](Makefiles/graph-easy.md)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user