ssh -o "ServerAliveInterval 60" -o "ServerAliveCountMax 120" -f -N -L 2525:localhost:25 [email protected]
iptables -t nat -A OUTPUT -p tcp --dport 25 -j DNAT --to-destination 127.0.0.1:2525
configure: error: no acceptable C compiler found in $PATH
yum groupinstall “Development Tools”
repomd.xml: [Errno 14] HTTP Error 404 – Not Found
yum install centos-release-scl
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.fra10.de.leaseweb.net
* epel: mirror.init7.net
* extras: ftp.tu-chemnitz.de
* updates: mirror1.hs-esslingen.de
http://mirror.fra10.de.leaseweb.net/centos/7.7.1908/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article
https://wiki.centos.org/yum-errors
If above article doesn't help to resolve this issue please use https://bugs.centos.org/.
http://ftp.plusline.net/centos/7.7.1908/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://centos.mirrors.psw.services/centos/7.7.1908/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
http://centosmirror.netcup.net/centos/7.7.1908/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
Fix:
yum clean all
acme.sh update account error _on_issue_err
Let’s Encrypt - agreement issue
AGREEMENT='https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf'
Update tos: https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf
url='https://acme-v01.api.letsencrypt.org/acme/reg/24591046'
payload='{"resource": "reg", "agreement": "https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf"}'
POST
url='https://acme-v01.api.letsencrypt.org/acme/reg/24591046'
_CURL='curl -L --silent --dump-header /var/lib/acme/.acme.sh/http.header '
_ret='0'
code='400'
Update account error.
on_issue_err
Please check log file for more details: /var/lib/acme/.acme.sh/acme.sh.log
Diagnosis versions:
If acme.sh --upgrade not helps, you need to update DEFAULT_AGREEMENT manually:
vim acme.sh/acme.sh
#DEFAULT_AGREEMENT="https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf"
DEFAULT_AGREEMENT="https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf"
save remote files to array
n=0; for i in `cat ttt` ; do readarray arr$n < <(ssh $i 'cat /etc/passwd'); n=$(( $n + 1 )) ; done
printf '%s\n' "${#arr0[@]}"
20
printf '%s\n' "${#arr1[@]}"
26
bash printf align output
for l in 1 10 100 1000 10000 100000 1000000; do printf "%7s %s\n" $l "test string"; done
1 test string 10 test string 100 test string 1000 test string 10000 test string 100000 test string 1000000 test string
linux add hostname to stdout
base64 /dev/urandom | head -c 1000 | sed "1 i\\`hostname`" | head -n 5
localhost.localdomain
brXE3yBW/afyXoZXigNc+bTaw71rW7Ykz9xFD01ZeXeglA/vubg9eJPmldDN3qQEOZongJbjSIEl
D6tu8lfhoYboc8eJTPPPasoQP1RcbdX/kVRbrxV2cLTaKVik2o3sywpjLZl+0Dow/9Of8iToahOw
JdWXPrkmsZZ9le4uN+qGU55Z2TO2Mc/baY0UUmBXaWX9NsNTsO4HwfqnT62Gs0BVtbMaWw0vWf3n
4QxJGcNl/gi5WUM/aamcUFe5exb8YlEk6Nj3szqf3b4DQE4XODe46W/4qCzg/UFzCb5SOC0YBnEa
check port on some random server
printf "%d.%d.%d.%d\n" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))"
for i in {1..3}; do !!; done > sm_rnd_ip
while read HOST ; do nc -zvw3 $HOST 80 &> /dev/null; [[ $? -eq 0 ]] &&
printf "Port 80 is UP on %s\n" $HOST || printf 'Port 80 is DOWN on %s\n' $HOST ; done < sm_rnd_ip
Port 80 is DOWN on 118.49.236.50
Port 80 is DOWN on 57.101.35.142
Port 80 is DOWN on 8.144.249.142
select no cache
mysql> SELECT SQL_NO_CACHE * from some_tabe limit 10;
check http2 support
if you are not sure if http2 is working:
echo | openssl s_client -alpn h2 -connect somedomain.lt:443 | grep -a ALPN
depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
verify return:1
depth=0 CN = somedomain.lt
verify return:1
DONE
ALPN protocol: h2
h2 means http/2 is enabled
Can’t locate Digest/MD5.pm in @INC
yum install perl-Digest-MD5
using index condition optimizer_switch
Index Condition Pushdown Optimization
MariaDB [(none)]> SET optimizer_switch = 'index_condition_pushdown=off';
vi /etc/my.cnf.d/server.cnf
optimizer_switch=index_condition_pushdown=off
To check:
mysql -e 'show global variables like "%optimizer_switch%";' | grep index_condition_pushdown
iptables forward traffic to another ip
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.0.100:80
iptables -t nat -A POSTROUTING -j MASQUERADE
mysql create 1 million test records
To create a lot of records for testing is possible using PROCEDURE like this:
DELIMITER //
drop procedure if exists gen //
CREATE TABLE mytable ( code int, a int, b int ) //
CREATE PROCEDURE gen() BEGIN DECLARE i int DEFAULT 0; WHILE i <= 1000000 DO INSERT INTO mytable (code, a, b) VALUES (i, 1, 1); SET i = i + 1; END WHILE; END //
CALL gen() //
DELIMITER ;
slow LATERAL DERIVED SQL using GROUP BY subqueries
If you have some new MariaDB or MYSQL version and slow GROUP BY issue, you can try explain your slow query and find many 'LATERAL DERIVED' select type, so you can try change optimizer:
MariaDB [db]> set optimizer_switch='split_materialized=off';
Query OK, 0 rows affected (0.000 sec)
To set permanently vi /etc/my.cnf.d/server.cnf
[mysqld]
optimizer_switch=split_materialized=off