From 8c8a39aef2facd47a201cb2163bb1a6fc81c4a2c Mon Sep 17 00:00:00 2001 From: root Date: Sat, 2 Mar 2024 02:54:33 +0300 Subject: [PATCH] Add new data --- docs/linux/cmp-iptables.service | 14 ++++++++++++++ docs/linux/common.md | 16 ++++++++-------- docs/linux/fedora.md | 3 ++- docs/linux/network.md | 17 +++++++++++++++++ docs/linux/rsyslog.md | 5 +++++ docs/linux/selinux.md | 4 +++- docs/other/math.md | 1 + docs/progs/crontab.md | 2 -- docs/progs/ffmpeg.md | 12 ++++++++++++ docs/progs/git.md | 26 ++++++++++++++++++++++++++ docs/progs/kubernetes.md | 2 ++ docs/progs/mc.md | 1 + docs/progs/nmcli.md | 10 ++++++---- docs/progs/php.md | 5 ++++- docs/progs/socat.md | 2 ++ docs/progs/ssh.md | 3 ++- docs/progs/termux.md | 7 +++++++ 17 files changed, 112 insertions(+), 18 deletions(-) create mode 100644 docs/linux/cmp-iptables.service create mode 100644 docs/linux/network.md create mode 100644 docs/progs/ffmpeg.md create mode 100644 docs/progs/git.md create mode 100644 docs/progs/termux.md diff --git a/docs/linux/cmp-iptables.service b/docs/linux/cmp-iptables.service new file mode 100644 index 0000000..57ee137 --- /dev/null +++ b/docs/linux/cmp-iptables.service @@ -0,0 +1,14 @@ +[Unit] +Description=Apply iptables rules +After=network.target + +[Service] +Type=oneshot +# EnvironmentFile=/etc/default/firewall +ExecStart=/root/bin/cmp-iptables-start.sh +RemainAfterExit=true +ExecStop=/root/bin/cmp-iptables-stop.sh +StandardOutput=journal + +[Install] +WantedBy=multi-user.target diff --git a/docs/linux/common.md b/docs/linux/common.md index 6b4063a..0167edf 100644 --- a/docs/linux/common.md +++ b/docs/linux/common.md @@ -8,7 +8,7 @@ # Common ## find -``` +```bash find /var -maxdepth 2 -type d -printf "%TY-%Tm-%Td %TH:%TM:%TS %Tz %p\n" ``` @@ -20,9 +20,15 @@ export EDITOR=mcedit export HISTFILESIZE=10485760 export HISTSIZE=500000 export HISTCONTROL=ignoreboth:erasedups -export HISTIGNORE="history:reboot:poweroff:cd:ls:pwd:mc:ps:m:e:l" +export HISTIGNORE="history:reboot:poweroff:cd:ls:pwd:mc:ps:m:e:l:z:zz:zzz" export SSH_ASKPASS= +# PS1 Green +# PS1='[\[\e[32m\]\u@\h\[\e[0m\] \[\e[32m\]\W\[\e[0;31m\]\[\e[0m\]]\$ ' + +# PS1 Default +# PS1='[\u@\h \W]\$ ' + alias ffi='ffmpeg -hide_banner -i' alias m='cd /mnt' @@ -30,7 +36,6 @@ alias e='cd /etc' alias l='cd /var/log' tabs -4 - ``` ## reboot @@ -44,11 +49,6 @@ echo b > /proc/sysrq-trigger cat /sys/devices/virtual/dmi/id/board_name ``` -## grab video from screen -```bash -ffmpeg -s 1920x1080 -framerate 10 -f x11grab -i :0 -qscale 6 out.mkv -``` - ```bash ps --ppid 2 -p 2 --deselect ``` diff --git a/docs/linux/fedora.md b/docs/linux/fedora.md index a01dffb..6077069 100644 --- a/docs/linux/fedora.md +++ b/docs/linux/fedora.md @@ -1,3 +1,4 @@ + # Fedora / CentOS / Etc ## Relabel @@ -6,7 +7,7 @@ touch /.autorelabel ``` ## Install PHP 8 -``` +```bash dnf install https://rpms.remirepo.net/fedora/remi-release-38.rpm dnf module reset php dnf module install php:remi-8.2 diff --git a/docs/linux/network.md b/docs/linux/network.md new file mode 100644 index 0000000..3eb6a77 --- /dev/null +++ b/docs/linux/network.md @@ -0,0 +1,17 @@ + +# Network + +## ipset +```bash +# Create ip-list with timeout +ipset create ipl-name hash:ip timeout 3600 +``` + +## iptables +```bash +# Show current rules +iptables -L -vn + +# Fix TTL for mobile network +iptables -t mangle -A POSTROUTING -j TTL --ttl-set 65 +``` diff --git a/docs/linux/rsyslog.md b/docs/linux/rsyslog.md index eb1b654..a133ae6 100644 --- a/docs/linux/rsyslog.md +++ b/docs/linux/rsyslog.md @@ -1,3 +1,8 @@ + +# RSysLog + +## Config + ``` $ModLoad imudp $UDPServerRun 514 diff --git a/docs/linux/selinux.md b/docs/linux/selinux.md index ea5a586..463ec91 100644 --- a/docs/linux/selinux.md +++ b/docs/linux/selinux.md @@ -1,5 +1,7 @@ -# Nginx +# SELinux + +## Nginx ``` # Allow open local port semanage port -a -t http_port_t -p tcp 28081 diff --git a/docs/other/math.md b/docs/other/math.md index 83c0292..347c5d9 100644 --- a/docs/other/math.md +++ b/docs/other/math.md @@ -1,3 +1,4 @@ # Аппроксимация функции одной переменной + [https://planetcalc.ru/5992/](https://planetcalc.ru/5992/) diff --git a/docs/progs/crontab.md b/docs/progs/crontab.md index 6a0e514..acfed89 100644 --- a/docs/progs/crontab.md +++ b/docs/progs/crontab.md @@ -23,6 +23,4 @@ ### | |--------| 0-23 часы ### | | ### |----------| 0-59 минуты - ``` - diff --git a/docs/progs/ffmpeg.md b/docs/progs/ffmpeg.md new file mode 100644 index 0000000..04dbff3 --- /dev/null +++ b/docs/progs/ffmpeg.md @@ -0,0 +1,12 @@ + +# FFmpeg + +## Crop video to 720x520 begin from 0:280 +```bash +ffi in.mov -vf "crop=720:520:0:280" -c:v libx264 -c:a copy -b:v 1200k out.mp4 +``` + +## Grab video from screen +```bash +ffmpeg -s 1920x1080 -framerate 10 -f x11grab -i :0 -qscale 6 out.mkv +``` diff --git a/docs/progs/git.md b/docs/progs/git.md new file mode 100644 index 0000000..24515ef --- /dev/null +++ b/docs/progs/git.md @@ -0,0 +1,26 @@ + +# GIT + +## Remote control +```bash +git remote -v +git remote add origin https://site/repo.git +git remote set-url origin https://site/repo.git +``` + +## Config ~/.gitconfig +```ini +[user] + email = user@gmail.com + +[alias] + aa = !git add -A && git status -v + up = push + st = status -v + sta = status -v + cam = commit -am + last = log -1 HEAD + +[safe] + directory = /mnt/data/src +``` diff --git a/docs/progs/kubernetes.md b/docs/progs/kubernetes.md index abb1826..83efa0f 100644 --- a/docs/progs/kubernetes.md +++ b/docs/progs/kubernetes.md @@ -1,4 +1,6 @@ +# Kubernetes + ```bash mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config diff --git a/docs/progs/mc.md b/docs/progs/mc.md index 5049962..8d393fc 100644 --- a/docs/progs/mc.md +++ b/docs/progs/mc.md @@ -1,3 +1,4 @@ + # MC ## ~/.config/mc/ini diff --git a/docs/progs/nmcli.md b/docs/progs/nmcli.md index 10e6ad4..b791ede 100644 --- a/docs/progs/nmcli.md +++ b/docs/progs/nmcli.md @@ -1,10 +1,12 @@ -# Connection start +# NMCli + +## Connection start ```bash nmcli con up ens18 ``` -# Connection modifity +## Connection modifity ```bash ifc=eth0 \ nmcli con mod $ifc ipv4.addresses 172.16.23.56/24 && \ @@ -16,12 +18,12 @@ nmcli con up $ifc restart && \ true ``` -# Disable IPv6 for all +## Disable IPv6 for all ``` nmcli con show | awk '{if(NR > 1) { print $1; system("nmcli con mod " $1 " ipv6.method disable"); } }' ``` -# Connection event +## Connection event ```bash #!/bin/bash diff --git a/docs/progs/php.md b/docs/progs/php.md index b465271..89296df 100644 --- a/docs/progs/php.md +++ b/docs/progs/php.md @@ -1,5 +1,8 @@ +# PHP + ## Set default timezone -``` + +```bash printf '[Date]\ndate.timezone = Asia/Katmandu\n' > /etc/php.d/17-cmp-timezone.ini ``` diff --git a/docs/progs/socat.md b/docs/progs/socat.md index 0c5a462..d42a3ec 100644 --- a/docs/progs/socat.md +++ b/docs/progs/socat.md @@ -1,4 +1,6 @@ +# Socat + ```bash socat PTY,link=/dev/vmodem0,echo=0,waitslave TCP:10.0.0.1:333 ``` diff --git a/docs/progs/ssh.md b/docs/progs/ssh.md index 19a7c91..aaf94f3 100644 --- a/docs/progs/ssh.md +++ b/docs/progs/ssh.md @@ -1,7 +1,8 @@ + # SSH ## Generate public key from private -``` +```bash ssh-keygen -f id_rsa -y > id_rsa.pub ``` diff --git a/docs/progs/termux.md b/docs/progs/termux.md new file mode 100644 index 0000000..a5bfb27 --- /dev/null +++ b/docs/progs/termux.md @@ -0,0 +1,7 @@ + +# Termux + +## Config ~/.termux/termux.properties +``` +extra-keys = [['ESC','/','-','HOME','UP','END','PGUP'],['TAB','CTRL','ALT','LEFT','DOWN','RIGHT','PGDN']] +```