Skip to content

Instantly share code, notes, and snippets.

View gist:f83134bb302ddf67303ecfdd354d842b
yum install -y xorg-x11-xauth xorg-x11-fonts-\* xorg-x11-utils xorg-x11-apps
/etc/ssh/sshd_config:
X11Forwarding yes
X11UseLocalhost yes
ssh -XY user@host
echo $DISPLAY
xclock
@pulketo
pulketo / gist:80480d5cca03c40364e863bffa8f1e94
Last active Feb 16, 2021
PHP documentation in the terminal
View gist:80480d5cca03c40364e863bffa8f1e94
git clone https://github.com/rbakels/PHP-Documentation
alias pman="man -M ./PHP-Documentation/manpages"
#test with:
pman explode
View gist:4334e3713b4bf9aca0a8ee583e448f2d
problem:
# ./configure
...
...
# make
/bin/cc -o perl.o -c perl.c -D_DEBUG_
perl.c:9:20: fatal error: EXTERN.h: No such file or directory
#include <EXTERN.h>
^
compilation terminated.
@pulketo
pulketo / gist:598b0ecb8e259ac4c5086685f7d58896
Created Feb 7, 2021
linux fb virtual screen (scroll screen)
View gist:598b0ecb8e259ac4c5086685f7d58896
todo: convert to script
suponiendo que tienes una pantalla de 1024x600 y quieres simular una pantalla de 1600x1200
xrandr --fb 1600x1200 --output LVDS-1 --mode 1024x600 --panning 1600x1200
@pulketo
pulketo / gist:b15078db8d410748b322f8768df4ab39
Created Feb 2, 2021
emulacion de mouse scroll, etc con combinaciones de teclado
View gist:b15078db8d410748b322f8768df4ab39
sudo apt-get install mouseemu
edit:/etc/default/mouseemu
showkey para obtener x
SCROLL="-scroll x"
@pulketo
pulketo / gist:69972fec50810782e2e57ab14806bc76
Created Nov 4, 2020
bind <ip>:443' : unable to load SSL private key from PEM file ...
View gist:69972fec50810782e2e57ab14806bc76
----END CERTIFICATE----------BEGIN RSA PRIVATE KEY-----
After I split it I could start HaProxy and load it OK:
*-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----*
@pulketo
pulketo / gist:658d163c8ed121f41ad58f86b74c04f4
Created Sep 1, 2020
sar Cannot open /var/log/sa/saXX: No such file or directory
View gist:658d163c8ed121f41ad58f86b74c04f4
sar
Cannot open /var/log/sa/saXX: No such file or directory
(and/or: "Please check if data collecting is enabled")
solution:
sudo service sysstat restart
View dmesg_human
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
@pulketo
pulketo / gist:192fa5217143b0745045e35899f81f50
Last active May 28, 2020
SAR linux statistics stats for alarms
View gist:192fa5217143b0745045e35899f81f50
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