master
Spagnolo Gasper 2022-12-25 13:54:13 +01:00
parent 71cae6f4d2
commit 5f81a9417e
6 changed files with 44 additions and 160 deletions

View File

@ -1,23 +0,0 @@
+++
date="2022-11-30"
author="spanskiduh"
title="adress_space"
description="click to read about adress_space"
+++
# Adress space
## AS in C
```
[code ]
[init data ]
[uninit data]
[heap ]
[ | ]
[ . ]
[ free ]
[ . ]
[ | ]
[stack ]
[args + env ]
```

View File

@ -1,6 +1,6 @@
+++
date="2022-12-24"
date="2022-12-25"
author="spanskiduh"
title="docker"
description="click to read about docker"
@ -216,3 +216,44 @@ networks:
external:
name: frontend
```
### Problmes with UFW on VPS?
Well this comes with experience iguess. I once disabled all traffic, but the ssh and https using UFW
,but did not know that docker fucks up iptables and bypasses ufw. So I left
the database open...
So there is thankfully a [workadound](https://github.com/chaifeng/ufw-docker/blob/master/README.md#solving-ufw-and-docker-issues),
basically add this segment to file `/etc/ufw/after.rules`.
```bash
# BEGIN UFW AND DOCKER
*filter
:ufw-user-forward - [0:0]
:ufw-docker-logging-deny - [0:0]
:DOCKER-USER - [0:0]
-A DOCKER-USER -j ufw-user-forward
-A DOCKER-USER -j RETURN -s 10.0.0.0/8
-A DOCKER-USER -j RETURN -s 172.16.0.0/12
-A DOCKER-USER -j RETURN -s 192.168.0.0/16
-A DOCKER-USER -p udp -m udp --sport 53 --dport 1024:65535 -j RETURN
-A DOCKER-USER -j ufw-docker-logging-deny -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -d 192.168.0.0/16
-A DOCKER-USER -j ufw-docker-logging-deny -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -d 10.0.0.0/8
-A DOCKER-USER -j ufw-docker-logging-deny -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -d 172.16.0.0/12
-A DOCKER-USER -j ufw-docker-logging-deny -p udp -m udp --dport 0:32767 -d 192.168.0.0/16
-A DOCKER-USER -j ufw-docker-logging-deny -p udp -m udp --dport 0:32767 -d 10.0.0.0/8
-A DOCKER-USER -j ufw-docker-logging-deny -p udp -m udp --dport 0:32767 -d 172.16.0.0/12
-A DOCKER-USER -j RETURN
-A ufw-docker-logging-deny -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW DOCKER BLOCK] "
-A ufw-docker-logging-deny -j DROP
COMMIT
# END UFW AND DOCKER
```

View File

@ -1,10 +0,0 @@
+++
date="2022-11-30"
author="spanskiduh"
title="document-conversion"
description="click to read about document-conversion"
+++
### Pandoc
- `pandoc -o doc.pdf doc.md` - convert md to pdf

View File

@ -1,6 +1,6 @@
+++
date="2022-12-24"
date="2022-12-25"
author="spanskiduh"
title="rust"
description="click to read about rust"
@ -278,6 +278,7 @@ pub fn run() {
assert_eq!(2, s.len());
assert_eq!(10, s.capacity());
}
```
### Structs

View File

@ -1,115 +0,0 @@
+++
date="2022-11-30"
author="spanskiduh"
title="shell"
description="click to read about shell"
+++
# SHELL SHORTCUTS
### Moving the cursor
```bash
Ctrl + a Go to the beginning of the line (Home)
Ctrl + e Go to the End of the line (End)
Ctrl + p Previous command (Up arrow)
Ctrl + n Next command (Down arrow)
Alt + b Back (left) one word
Alt + f Forward (right) one word
Ctrl + f Forward one character
Ctrl + b Backward one character
Ctrl + xx Toggle between the start of line and current cursor position
```
### Editing
```bash
Ctrl + L Clear the Screen, similar to the clear command
Alt + Del Delete the Word before the cursor.
Alt + d Delete the Word after the cursor.
Ctrl + d Delete character under the cursor
Ctrl + h Delete character before the cursor (Backspace)
Ctrl + w Cut the Word before the cursor to the clipboard.
Ctrl + k Cut the Line after the cursor to the clipboard.
Ctrl + u Cut/delete the Line before the cursor to the clipboard.
Alt + t Swap current word with previous
Ctrl + t Swap the last two characters before the cursor (typo).
Esc + t Swap the last two words before the cursor.
ctrl + y Paste the last thing to be cut (yank)
Alt + u UPPER capitalize every character from the cursor to the end of the current word.
Alt + l Lower the case of every character from the cursor to the end of the current word.
Alt + c Capitalize the character under the cursor and move to the end of the word.
Alt + r Cancel the changes and put back the line as it was in the history (revert).
ctrl + _ Undo
TAB Tab completion for file/directory names
```
### Special keys
Text Terminals send characters (bytes), not key strokes.
Special keys such as Tab, Backspace, Enter and Esc are encoded as control characters.
Control characters are not printable, they display in the terminal as ^ and are intended to have an effect on applications.
```bash
Ctrl+I = Tab
Ctrl+J = Newline
Ctrl+M = Enter
Ctrl+[ = Escape
Many terminals will also send control characters for keys in the digit row:
Ctrl+2 → ^@
Ctrl+3 → ^[ Escape
Ctrl+4 → ^\
Ctrl+5 → ^]
Ctrl+6 → ^^
Ctrl+7 → ^_ Undo
Ctrl+8 → ^? Backward-delete-char
Ctrl+v tells the terminal to not interpret the following character, so Ctrl+v Ctrl-I will display a tab character,
similarly Ctrl+v ENTER will display the escape sequence for the Enter key: ^M
```
### History
```bash
Ctrl + r Recall the last command including the specified character(s).
searches the command history as you type.
Equivalent to : vim ~/.bash_history.
Ctrl + p Previous command in history (i.e. walk back through the command history).
Ctrl + n Next command in history (i.e. walk forward through the command history).
Ctrl + s Go back to the next most recent command.
(beware to not execute it from a terminal because this will also launch its XOFF).
Ctrl + o Execute the command found via Ctrl+r or Ctrl+s
Ctrl + g Escape from history searching mode
!! Repeat last command
!n Repeat from the last command: args n e.g. !:2 for the second argumant.
!n:m Repeat from the last command: args from n to m. e.g. !:2-3 for the second and third.
!n:$ Repeat from the last command: args n to the last argument.
!n:p Print last command starting with n
!string Print the last command beginning with string.
!:q Quote the last command with proper Bash escaping applied.
Tip: enter a line of Bash starting with a # comment, then run !:q on the next line to escape it.
!$ Last argument of previous command.
ALT + . Last argument of previous command.
!* All arguments of previous command.
^abc­^­def Run previous command, replacing abc with def
```
### Process control
```bash
Ctrl + C Interrupt/Kill whatever you are running (SIGINT).
Ctrl + l Clear the screen.
Ctrl + s Stop output to the screen (for long running verbose commands).
Then use PgUp/PgDn for navigation.
Ctrl + q Allow output to the screen (if previously stopped using command above).
Ctrl + D Send an EOF marker, unless disabled by an option, this will close the current shell (EXIT).
Ctrl + Z Send the signal SIGTSTP to the current task, which suspends it.
To return to it later enter fg 'process name' (foreground).
```

View File

@ -1,10 +0,0 @@
+++
date="2022-11-30"
author="spanskiduh"
title="virt-manager"
description="click to read about virt-manager"
+++
# VIRT MANAGER
https://www.xmodulo.com/convert-ova-to-qcow2-linux.html