Autosave: 2024-02-29 18:39:53

This commit is contained in:
thomasabishop 2024-02-29 18:39:53 +00:00
parent 157c54905c
commit 2fc4a57816
7 changed files with 114 additions and 5 deletions

View file

@ -2,10 +2,13 @@
# Automatically commits/pull changes to the remote ZK repository. # Automatically commits/pull changes to the remote ZK repository.
tidy_filenames="${EOLAS_DIR}/scripts/tidy_filenames.sh"
purge_images="${EOLAS_DIR}/scripts/purge_images.sh"
cd $EOLAS_DIR zk=$HOME/repos/eolas
tidy_filenames="${zk}/scripts/tidy_filenames.sh"
purge_images="${zk}/scripts/purge_images.sh"
cd $zk
echo "Standardising file-names..." echo "Standardising file-names..."
source ${tidy_filenames} source ${tidy_filenames}

View file

@ -1 +1 @@
zk new --title "$1" zk new --title "$1" /home/thomas/repos/eolas/zk

View file

@ -0,0 +1,21 @@
---
id: 5faz2y2e
title: Format specifiers in C
tags: []
created: Thursday, February 29, 2024 | 17:41
---
# Format specifiers in C
Format specifiers define the type of data to be printed on standard output. You
need to use format specifiers whenever you are
[printing-values-in-c](printing-values-in-c.md).
| Specifier | Usage |
| --------- | -------------------------- |
| `%c` | single character |
| `%s` | string |
| `%n` | nothing |
| `%d` | integer (assuming base 10) |
| `%f` | float |
| `%%` | The percent sign itself |

View file

@ -0,0 +1,25 @@
---
id: 3hcv0amc
title: Printing values in C
tags: []
created: Thursday, February 29, 2024 | 17:33
---
# Printing values in C
## To print a literal
```c
printf("hello world")
```
## To print a variable
```c
int age = 25
print("%d", age)
```
The `%d` is an example of a [format specifier](./zk/format-specifiers-in-c.md).
It is the decimal integer format specifier.

View file

@ -49,7 +49,7 @@ are as follows:
- control service daemons - control service daemons
- socket units (`.socket`) - socket units (`.socket`)
- handle incoming network connection request locations - handle incoming network connection request locations
- device units (`.device) - device units (`.device`)
- disks and other devices - disks and other devices
- mount units (`.mount`) - mount units (`.mount`)
- handle the attachment of filesystems to the system - handle the attachment of filesystems to the system

48
zk/systemd_status.md Normal file
View file

@ -0,0 +1,48 @@
---
id: v5f6xkdv
title: systemd status
tags: [systemd, systems-programming]
created: Thursday, February 29, 2024 | 18:19
---
# Get status of a specific unit
Here I have requested the status of the currently running `mongodb` unit:
```
$ systemctl status mongod
mongodb.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongodb.service; enabled; preset: disabled)
Active: active (running) since Wed 2022-08-17 07:25:27 BST; 24h ago
Docs: https://docs.mongodb.org/manual
Main PID: 931 (mongod)
Memory: 304.1M
CPU: 2min 18.630s
CGroup: /system.slice/mongodb.service
└─931 /usr/bin/mongod --config /etc/mongodb.conf
Aug 17 07:25:27 archbish systemd[1]: Started MongoDB Database Server.****
```
In addition to the core info it tells us the unit type. In this case it is a
service.
We can also view the journal entry for the given unit. This provides you with
its diagnostic log messages:
```
journalctl --unit=mongodb.service
- Boot b9565dfe8aca4d069143209b3aa84d8e --
Aug 05 18:31:30 archbish systemd[1]: Started MongoDB Database Server.
Aug 06 14:27:33 archbish systemd[1]: mongodb.service: Deactivated successfully.
Aug 06 14:27:33 archbish systemd[1]: mongodb.service: Consumed 3min 17.598s CPU time.
-- Boot 01922f84c3bd4b3a8f11824cf05f7320 --
Aug 07 11:58:09 archbish systemd[1]: Started MongoDB Database Server.
Aug 08 14:43:01 archbish systemd[1]: mongodb.service: Deactivated successfully.
Aug 08 14:43:01 archbish systemd[1]: mongodb.service: Consumed 5min 28.760s CPU time.
-- Boot e52b735e115c43bdad8c00462aaff395 --
Aug 10 13:13:22 archbish systemd[1]: Started MongoDB Database Server.
Aug 11 07:46:40 archbish systemd[1]: mongodb.service: Deactivated successfully.
Aug 11 07:46:40 archbish systemd[1]: mongodb.service: Consumed 2min 16.629s CPU time.
```
Each entry is organised around specific boots.

12
zk/variables_in_c.md Normal file
View file

@ -0,0 +1,12 @@
---
id: r4i16p1x
title: Variables in C
tags: [C]
created: Thursday, February 29, 2024 | 17:20
---
# Variables in C
```c
int age = 25
```