This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
onny:notizen [2022/11/07 19:18] – 10.100.0.1 | onny:notizen [2023/12/27 09:16] – [mail] 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== kernel ===== | ||
- | |||
- | grep kernel config running system | ||
- | <code bahs> | ||
- | zcat / | ||
- | </ | ||
- | |||
- | ===== fish ===== | ||
- | |||
- | unset history | ||
- | < | ||
- | fish --private | ||
- | </ | ||
===== bash ===== | ===== bash ===== | ||
Line 101: | Line 88: | ||
chmod +x $FILE | chmod +x $FILE | ||
$FILE " | $FILE " | ||
- | </ | ||
- | ==== sed ==== | ||
- | Mit sed inplace eine Zeile zu einer Datei hinzufügen: | ||
- | <code bash> | ||
- | sed -i ' | ||
- | </ | ||
- | add to end of file | ||
- | <code bash> | ||
- | sed -i -e ' | ||
- | </ | ||
- | Comment out specific line matching a string | ||
- | <code bash> | ||
- | sudo sed -e '/ | ||
- | </ | ||
- | comment out multiple lines / range | ||
- | <code bash> | ||
- | sed -i "28,33 s/# *//" autogen.sh | ||
- | </ | ||
- | regex parse value of xml tags | ||
- | <code bash> | ||
- | sed -n ' | ||
- | </ | ||
- | delete multiple lines | ||
- | <code bash> | ||
- | sed -i ' | ||
</ | </ | ||
- | insert line after match | ||
- | <code bash> | ||
- | sed '/ | ||
- | </ | ||
==== grep ==== | ==== grep ==== | ||
regex match group | regex match group | ||
Line 163: | Line 121: | ||
fd '[^A-Z a-züö@0-9._-]' | fd '[^A-Z a-züö@0-9._-]' | ||
</ | </ | ||
- | ==== rg ==== | ||
- | filter file type | ||
- | <code bash> | ||
- | rg GPIO_CFG_2MA -g ' | ||
- | </ | ||
- | |||
- | search file containing multiple strings/ | ||
- | |||
- | <code bash> | ||
- | rg -lU --multiline-dotall ' | ||
- | </ | ||
- | |||
- | ==== curl ==== | ||
- | post data | ||
- | <code bash> | ||
- | curl --data " | ||
- | </ | ||
- | download and extract archive | ||
- | <code bash> | ||
- | curl http:// | ||
- | </ | ||
- | set host header | ||
- | <code bash> | ||
- | torify curl --header "Host: http.pi" | ||
- | </ | ||
- | ==== tcpdump ==== | ||
- | specific ports | ||
- | <code bash> | ||
- | tcpdump -i eth0 -q '(tcp port 80) or (tcp port 443)' -A | ||
- | </ | ||
- | exclude specific host | ||
- | <code bash> | ||
- | tcpdump -i eth0 -q '(ip or ip6) and (tcp port 80) or (tcp port 443) and not host ifconfig.co' | ||
- | </ | ||
==== patching ==== | ==== patching ==== | ||
=== appling === | === appling === | ||
Line 243: | Line 167: | ||
</ | </ | ||
===== networking ===== | ===== networking ===== | ||
- | netcat | ||
- | <code bash> | ||
- | netcat -l 4444 | ||
- | </ | ||
- | <code bash> | ||
- | netcat playground.pi 4444 | ||
- | </ | ||
==== nftables ==== | ==== nftables ==== | ||
<code bash> | <code bash> | ||
Line 291: | Line 208: | ||
iptables -t nat -A OUTPUT -p tcp --dport 2222 -j DNAT --to 192.168.1.2: | iptables -t nat -A OUTPUT -p tcp --dport 2222 -j DNAT --to 192.168.1.2: | ||
</ | </ | ||
- | </ | ||
- | ==== ip ==== | ||
- | set address | ||
- | <code bash> | ||
- | ip address add dev usb0 172.16.42.1/ | ||
- | ip link set usb0 up | ||
- | </ | ||
- | route command example | ||
- | <code bash> | ||
- | ip route add 192.168.1.0/ | ||
- | ip route add default via 192.168.1.1 | ||
- | </ | ||
- | flush addresses | ||
- | <code bash> | ||
- | ip addr flush dev enp8s0 | ||
- | </ | ||
- | remove interface | ||
- | <code bash> | ||
- | ip link delete br0 | ||
- | </ | ||
- | delete address | ||
- | <code bash> | ||
- | ip addr del 192.168.178.20/ | ||
- | </ | ||
- | show only specific interface | ||
- | <code bash> | ||
- | ip a show wg0 | ||
</ | </ | ||
- | change mtu | ||
- | <code bash> | ||
- | ip link set dev eth0 mtu 1400 | ||
- | </ | ||
==== dnsmasq ==== | ==== dnsmasq ==== | ||
minimal hostapd and dnsmasq config | minimal hostapd and dnsmasq config | ||
Line 557: | Line 443: | ||
docker system prune -a | docker system prune -a | ||
</ | </ | ||
- | docker stop all container | + | |
- | <code bash> | + | |
- | docker stop (docker ps -a -q) | + | |
- | </ | + | |
prevent from auto start | prevent from auto start | ||
+ | |||
<code bash> | <code bash> | ||
docker update --restart=no client-iaro_db_1 | docker update --restart=no client-iaro_db_1 | ||
Line 953: | Line 837: | ||
</ | </ | ||
* check spamminess of email server: https:// | * check spamminess of email server: https:// | ||
- | * manual imap login | + | |
- | openssl imaps login | + | |
- | < | + | |
- | openssl s_client -connect mail.sexypump.de: | + | |
- | A login cypherpunk cypherpunk | + | |
- | </ | + | |
- | get quota | + | |
- | < | + | |
- | a GETQUOTAROOT INBOX | + | |
- | </ | + | |
- | get msg count of folder | + | |
- | < | + | |
- | a LIST INBOX * | + | |
- | * LIST (\HasChildren) " | + | |
- | * LIST (\HasNoChildren \UnMarked) " | + | |
- | * LIST (\HasNoChildren \UnMarked) " | + | |
- | * LIST (\HasNoChildren \UnMarked \Trash) " | + | |
- | * LIST (\HasNoChildren \UnMarked \Sent) " | + | |
- | * LIST (\HasNoChildren \UnMarked) " | + | |
- | * LIST (\HasNoChildren \UnMarked \Junk) " | + | |
- | * LIST (\HasNoChildren \UnMarked \Drafts) " | + | |
- | * LIST (\HasNoChildren \UnMarked) " | + | |
- | a OK List completed (0.001 + 0.000 secs). | + | |
- | a SELECT INBOX | + | |
- | </ | + | |
send smtp mail | send smtp mail | ||
< | < | ||
Line 1337: | Line 1197: | ||
<code bash> | <code bash> | ||
nix run nixpkgs# | nix run nixpkgs# | ||
+ | nix run github: | ||
nix shell nixpkgs# | nix shell nixpkgs# | ||
</ | </ | ||
Line 1374: | Line 1235: | ||
{ | { | ||
- | disabledModules = [ " | + | disabledModules = [ |
+ | | ||
+ | " | ||
+ | | ||
imports = [ | imports = [ | ||
Line 1416: | Line 1280: | ||
''; | ''; | ||
}); | }); | ||
- | </ | ||
- | |||
- | use local src / source | ||
- | |||
- | < | ||
- | src = / | ||
- | unpackPhase = '' | ||
</ | </ | ||
Line 1461: | Line 1318: | ||
}); | }); | ||
}) | }) | ||
- | ]; | ||
- | </ | ||
- | |||
- | fetchpatch | ||
- | |||
- | < | ||
- | patches = [ | ||
- | # Support HBPL1 printers https:// | ||
- | ./ | ||
- | |||
- | # Fix " | ||
- | # https:// | ||
- | (fetchpatch { | ||
- | url = " | ||
- | sha256 = " | ||
- | stripLen = 1; | ||
- | name = " | ||
- | }) | ||
- | |||
]; | ]; | ||
</ | </ | ||
Line 1537: | Line 1375: | ||
}; | }; | ||
}; | }; | ||
+ | </ | ||
+ | |||
+ | nix repl | ||
+ | |||
+ | <code bash> | ||
+ | nix repl '< | ||
+ | # wordpressPackages.plugins.gutenberg.meta.license | ||
</ | </ | ||
==== packaging ==== | ==== packaging ==== | ||
Line 1832: | Line 1677: | ||
''; | ''; | ||
</ | </ | ||
+ | |||
==== nixops ==== | ==== nixops ==== | ||
Line 1885: | Line 1731: | ||
<code bash> | <code bash> | ||
fatlabel /dev/sdb1 " | fatlabel /dev/sdb1 " | ||
- | </ | ||
- | |||
- | grow ext4 partition live | ||
- | <code bash> | ||
- | $ growpart /dev/sda 2 | ||
- | $ resize2fs /dev/sda2 | ||
</ | </ | ||
Line 1979: | Line 1819: | ||
</ | </ | ||
- | ===== avahi ===== | + | |
- | discover local services | + | |
- | <code bash> | + | |
- | avahi-browse --all --ignore-local --resolve --terminate | + | |
- | </ | + | |
===== curlftpfs ===== | ===== curlftpfs ===== | ||
<code bash> | <code bash> | ||
Line 2167: | Line 2003: | ||
===== postgresql ===== | ===== postgresql ===== | ||
+ | |||
+ | list all databases | ||
+ | <code bash> | ||
+ | sudo -u postgres psql | ||
+ | # \l | ||
+ | </ | ||
+ | |||
+ | drop database | ||
+ | <code bash> | ||
+ | sudo -u postgres psql | ||
+ | # drop database gitlabhq_production; | ||
+ | # drop database gitlabhq_production WITH (FORCE); | ||
+ | </ | ||
+ | |||
+ | list tables | ||
+ | <code bash> | ||
+ | sudo -u postgres psql | ||
+ | # \c gitlabhq_production | ||
+ | # \dt | ||
+ | </ | ||
+ | |||
+ | create and delete user | ||
+ | < | ||
+ | DROP ROLE gitlab; | ||
+ | CREATE USER gitlab WITH PASSWORD ' | ||
+ | </ | ||
+ | |||
+ | grant permissions | ||
+ | < | ||
+ | ALTER USER gitlab SUPERUSER; | ||
+ | CREATE DATABASE gitlabhq_production OWNER gitlab; | ||
+ | ALTER DATABASE gitlabhq_production OWNER TO gitlab; | ||
+ | </ | ||
dump database | dump database | ||
Line 2184: | Line 2053: | ||
</ | </ | ||
- | ===== mysql ===== | ||
- | Dump database | ||
- | <code bash> | ||
- | mysqldump -u root -p Tutorials > tut_backup.sql | ||
- | </ | ||
- | |||
- | Backup everything | ||
- | <code bash> | ||
- | mysqldump -u root -p --all-databases > alldb.sql | ||
- | # in case of nextcloud | ||
- | mysqldump -u root -p --all-databases --default-character-set=utf8mb4 > alldb.sql | ||
- | </ | ||
- | |||
- | Import database | ||
- | < | ||
- | mysql> CREATE DATABASE IF NOT EXISTS wordpress; | ||
- | mysql> GRANT ALL PRIVILEGES ON wordpress.* TO ' | ||
- | mysql> FLUSH PRIVILEGES; | ||
- | sudo mysql -u root wordpress < wordpress.sql | ||
- | </ | ||
- | |||
- | Setup | ||
- | <code bash> | ||
- | systemctl stop mysqld | ||
- | mysql_install_db --user=mysql --basedir=/ | ||
- | systemctl start mysqld | ||
- | mysql_secure_installation | ||
- | </ |