Initial
This commit is contained in:
28
docs/progs/crontab.md
Normal file
28
docs/progs/crontab.md
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
# Crontab
|
||||
|
||||
```
|
||||
# PATH=$PATH:/usr/local/bin
|
||||
# LANG=
|
||||
# LC_ALL=
|
||||
|
||||
### on reboot
|
||||
# @reboot command
|
||||
|
||||
### on time
|
||||
# * * * * * command
|
||||
### | | | | |
|
||||
### | | | | |
|
||||
### | | | | |
|
||||
### | | | | |--| 0-7 день недели
|
||||
### | | | | |
|
||||
### | | | |----| 1-12 месяц
|
||||
### | | | |
|
||||
### | | |------| 1-31 день месяца
|
||||
### | | |
|
||||
### | |--------| 0-23 часы
|
||||
### | |
|
||||
### |----------| 0-59 минуты
|
||||
|
||||
```
|
||||
|
22
docs/progs/kubernetes.md
Normal file
22
docs/progs/kubernetes.md
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
```bash
|
||||
mkdir -p $HOME/.kube
|
||||
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
|
||||
sudo chown $(id -u):$(id -g) $HOME/.kube/config
|
||||
```
|
||||
|
||||
Alternatively, if you are the root user, you can run:
|
||||
```bash
|
||||
export KUBECONFIG=/etc/kubernetes/admin.conf
|
||||
```
|
||||
|
||||
You should now deploy a pod network to the cluster.
|
||||
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
|
||||
https://kubernetes.io/docs/concepts/cluster-administration/addons/
|
||||
|
||||
Then you can join any number of worker nodes by running the following on each as root:
|
||||
|
||||
```bash
|
||||
kubeadm join 10.0.0.1:6443 --token 000000.0000000000000000 \
|
||||
--discovery-token-ca-cert-hash sha256:0000000000000000000000000000000000000000000000000000000000000000
|
||||
```
|
8
docs/progs/mariadb.md
Normal file
8
docs/progs/mariadb.md
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
# MariaDB
|
||||
|
||||
## Create database, user and grand permission
|
||||
```sql
|
||||
CREATE DATABASE dbn CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
CREATE USER 'usr'@'localhost' IDENTIFIED BY 'pwd'; GRANT ALL PRIVILEGES ON dbn.* TO usr@localhost;
|
||||
```
|
53
docs/progs/mc.md
Normal file
53
docs/progs/mc.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# MC
|
||||
|
||||
## ~/.config/mc/ini
|
||||
```ini
|
||||
[Layout]
|
||||
command_prompt=1
|
||||
free_space=1
|
||||
horizontal_equal=1
|
||||
horizontal_split=0
|
||||
keybar_visible=0
|
||||
left_panel_size=104
|
||||
menubar_visible=0
|
||||
message_visible=0
|
||||
output_lines=0
|
||||
top_panel_size=1
|
||||
vertical_equal=1
|
||||
xterm_title=0
|
||||
|
||||
[Midnight-Commander]
|
||||
use_internal_view=1
|
||||
use_internal_edit=1
|
||||
alternate_plus_minus=1
|
||||
skin=darkfar
|
||||
|
||||
editor_ask_filename_before_edit=false
|
||||
editor_backspace_through_tabs=false
|
||||
editor_backup_extension=~
|
||||
editor_check_new_line=false
|
||||
editor_cursor_after_inserted_block=false
|
||||
editor_cursor_beyond_eol=false
|
||||
editor_drop_selection_on_copy=true
|
||||
editor_edit_confirm_save=true
|
||||
editor_fake_half_tabs=false
|
||||
editor_filesize_threshold=64M
|
||||
editor_fill_tabs_with_spaces=false
|
||||
editor_group_undo=false
|
||||
editor_line_state=false
|
||||
editor_option_auto_para_formatting=false
|
||||
editor_option_save_mode=0
|
||||
editor_option_save_position=true
|
||||
editor_option_typewriter_wrap=false
|
||||
editor_persistent_selections=true
|
||||
editor_return_does_auto_indent=true
|
||||
editor_show_right_margin=false
|
||||
editor_simple_statusbar=false
|
||||
editor_state_full_filename=false
|
||||
editor_stop_format_chars=-+*\\,.;:&>
|
||||
editor_syntax_highlighting=true
|
||||
editor_tab_spacing=4
|
||||
editor_visible_spaces=true
|
||||
editor_visible_tabs=false
|
||||
editor_word_wrap_line_length=72
|
||||
```
|
71
docs/progs/nmcli.md
Normal file
71
docs/progs/nmcli.md
Normal file
@@ -0,0 +1,71 @@
|
||||
|
||||
# Connection start
|
||||
```bash
|
||||
nmcli con up ens18
|
||||
```
|
||||
|
||||
# Connection modifity
|
||||
```bash
|
||||
ifc=eth0 \
|
||||
nmcli con mod $ifc ipv4.addresses 172.16.23.56/24 && \
|
||||
nmcli con mod $ifc ipv4.gateway 172.16.23.1 && \
|
||||
nmcli con mod $ifc ipv4.dns 172.16.20.130 && \
|
||||
nmcli con mod $ifc ipv4.method manual && \
|
||||
nmcli con mod $ifc ipv6.method disable && \
|
||||
nmcli con up $ifc restart && \
|
||||
true
|
||||
```
|
||||
|
||||
# Disable IPv6 for all
|
||||
```
|
||||
nmcli con show | awk '{if(NR > 1) { print $1; system("nmcli con mod " $1 " ipv6.method disable"); } }'
|
||||
```
|
||||
|
||||
# Connection event
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# This is /etc/NetworkManager/dispatcher.d/0167-cmp.sh
|
||||
|
||||
# IFACE="$1" # DEVICE_IFACE
|
||||
# EVENT="$2" # NM_DISPATCHER_ACTION
|
||||
# - connectivity-change
|
||||
# - down
|
||||
# - up
|
||||
# - vpn-down
|
||||
# - vpn-up
|
||||
#
|
||||
#
|
||||
|
||||
if [ "${NM_DISPATCHER_ACTION}" = "connectivity-change" ]; then
|
||||
if [ "${CONNECTIVITY_STATE}" = "FULL" ]; then
|
||||
nmcli conn up ssh-37
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${CONNECTIVITY_STATE}" = "LIMITED" ]; then
|
||||
nmcli conn up ssh-37
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "${CONNECTIVITY_STATE}" = "NONE" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# exit 0
|
||||
fi
|
||||
|
||||
if true; then
|
||||
logger -t 0167-cmp.sh @=$@ "ENV" \
|
||||
NM_DISPATCHER_ACTION=$NM_DISPATCHER_ACTION \
|
||||
CONNECTION_UUID=$CONNECTION_UUID \
|
||||
CONNECTION_ID=$CONNECTION_ID \
|
||||
CONNECTION_DBUS_PATH=$CONNECTION_DBUS_PATH \
|
||||
CONNECTION_FILENAME=$CONNECTION_FILENAME \
|
||||
CONNECTION_EXTERNAL=$CONNECTION_EXTERNAL \
|
||||
DEVICE_IFACE=$DEVICE_IFACE \
|
||||
DEVICE_IP_IFACE=$DEVICE_IP_IFACE \
|
||||
CONNECTIVITY_STATE=$CONNECTIVITY_STATE
|
||||
fi
|
||||
|
||||
```
|
5
docs/progs/php.md
Normal file
5
docs/progs/php.md
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
## Set default timezone
|
||||
```
|
||||
printf '[Date]\ndate.timezone = Asia/Katmandu\n' > /etc/php.d/17-cmp-timezone.ini
|
||||
```
|
4
docs/progs/socat.md
Normal file
4
docs/progs/socat.md
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
```bash
|
||||
socat PTY,link=/dev/vmodem0,echo=0,waitslave TCP:10.0.0.1:333
|
||||
```
|
17
docs/progs/ssh.md
Normal file
17
docs/progs/ssh.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# SSH
|
||||
|
||||
## Generate public key from private
|
||||
```
|
||||
ssh-keygen -f id_rsa -y > id_rsa.pub
|
||||
```
|
||||
|
||||
## Port forwarding
|
||||
```bash
|
||||
# forward : 172.16.0.1:80 -> 172.16.0.2 -> 127.0.0.1:4080
|
||||
ssh -f -N -L 4080:172.16.0.1:80 172.16.0.2
|
||||
```
|
||||
|
||||
## Allow old algorithm
|
||||
```bash
|
||||
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-dss 172.16.0.1
|
||||
```
|
Reference in New Issue
Block a user