Skip to content

Instantly share code, notes, and snippets.

View pulketo's full-sized avatar

Pulketo pulketo

View GitHub Profile
@pulketo
pulketo / gist:ad2eae86c6bd47d2111624596852f206
Created March 7, 2022 23:57
double screen width xrandr linux
double width desktop
CO=$(xrandr | tail -n+2|head -n1| cut -d " " -f1); W=$(xrandr | grep \* | awk '{print $1}'|cut -d "x" -f1);H=$(xrandr | grep \* | awk '{print $1}'|cut -d 'x' -f2);W2=$(echo "$W*2"| tr -d $'\r' |bc -l);xrandr --fb ${W2}x${H} --output ${CO} --mode ${W}x${H} --panning ${W2}x${H}
reset:
xrandr --fb ${W}x${H} --output ${CO} --mode ${W}x${H} --panning ${W}x${H}
@pulketo
pulketo / gist:37d9dd42cbdbbbbc5b250722bf4c6f54
Created February 24, 2022 23:24
PHP Parse errors on PHP 7.2
PHP Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STR
ING) in xxxxxxxx.php on line ZZZ
PHP Parse error: syntax error, unexpected ']', expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in xxxxxxxxxxx.php on line XXX
At least on this installation of Ubuntu 18.04 & PHP7.2 ... those errors appear to be appearing just after some heredocs, so maybe heredoc syntaxis changed. (verify)
@pulketo
pulketo / hotadd.sh
Created January 25, 2022 23:53
make ubuntu aware of vmware hot plug cpu / memory
#!/bin/bash
# Based on script by William Lam - http://engineering.ucsb.edu/~duonglt/vmware/
# Bring CPUs online
for CPU in $(ls /sys/devices/system/cpu/ |grep -E '(cpu[0-9])')
do
CPU_DIR="/sys/devices/system/cpu/${CPU}"
echo "Found cpu: \"${CPU_DIR}\" ..."
CPU_STATE_FILE="${CPU_DIR}/online"
if [ -f "${CPU_STATE_FILE}" ]; then
@pulketo
pulketo / gist:750ed60df217f93a659a9a1ab103fcaa
Created December 21, 2021 16:34
espacio en disco que ocupa los archivos de los ultimos X días
find . -type f -mtime -10 -print0 | du -hc --files0-from - | tail -n 1
@pulketo
pulketo / gist:036f24338d98dd56af53b6aa42e14e35
Created December 9, 2021 03:44
cosillas bash scripting head tail cut
Los comandos:
head -n -1 test.txt
tail -n +2 test.txt
cut -c 20-40 test.txt
son cosillas que no usa uno seguido, pero que agradeces que existan.
@pulketo
pulketo / gist:674a9f6b9660198163164c7de284b101
Created December 3, 2021 18:15
podman docker "container state improper"
Error: can only stop created or running containers. xxIDxx is in state configured: container state improper
R= podman ps -a --sync
@pulketo
pulketo / gist:29e29d89396b2c4cbd7be967d416a8c8
Created October 22, 2021 14:58
Fecha y como será el cambio de horario de verano/invierno
zdump -v America/Mexico_City | grep $(date +"%Y")
America/Mexico_City Sun Apr 4 07:59:59 2021 UT = Sun Apr 4 01:59:59 2021 CST isdst=0 gmtoff=-21600
America/Mexico_City Sun Apr 4 08:00:00 2021 UT = Sun Apr 4 03:00:00 2021 CDT isdst=1 gmtoff=-18000
America/Mexico_City Sun Oct 31 06:59:59 2021 UT = Sun Oct 31 01:59:59 2021 CDT isdst=1 gmtoff=-18000
America/Mexico_City Sun Oct 31 07:00:00 2021 UT = Sun Oct 31 01:00:00 2021 CST isdst=0 gmtoff=-21600
@pulketo
pulketo / h2dsite
Last active September 14, 2021 19:56 — forked from jlazic/haconfig.sh
Split monolithic HAProxy configuration
#!/bin/bash
#Requirements: nothing
#This script renames haproxy individual site configuration files to disable them for h2gencfg to be aware of them
#Script assumes templates on: /etc/haproxy/templates
#config files on /etc/haproxy/conf.d/
#├── 20-http-domain.tld.cfg
#├── 40-https-domain.tld.cfg
#└── 50-backends-domain.tld.cfg
TIMEDATE=$(date +"%Y%m%d-%H%M%S")
@pulketo
pulketo / gist:9f18fa1aab6244425d1708e480fc4a43
Created September 13, 2021 19:02
haproxy instalacion y configuración chida
-----Instalacion
yum install gcc pcre-devel tar make systemd-devel.x86_64 -y
#yum groupinstall -y development
wget 'https://www.haproxy.org/download/2.4/src/haproxy-2.4.4.tar.gz'
tar zxvf haproxy-2.4.4.tar.gz
cd haproxy-2*
#make TARGET=linux-glibc
make TARGET=linux-glibc USE_OPENSSL=1 USE_SYSTEMD=1
make install
-----Configuracion
@pulketo
pulketo / gist:13069dd4dbf953aaf057fb9554978346
Created September 3, 2021 17:29
VirtualBox para instalar/conectar disco fisico
Tuve problemas con un disco fisico que no lo detecta(ba) correctamente la máquina al iniciar pero que si lo conectaba como disco extra ya en el Sistema Operativo funcionaba bien.
tons, decidí usar VirtualBox para instalarle un nuevo SO.
el usuario actual requiere poder manejar devices:
$ sudo usermod -a -G disk $USER
$ VBoxManage internalcommands createrawvmdk -filename "/tmp/diskuser.vmdk" -rawdisk /dev/sdX
Una vez en VirtualBox, solo se coloca en la parte de storage la referencia a /tmp/diskuser.vmdk y listo, ya podemos usarlo
$ sudo usermod -a -G vboxusers $USER #no se si sea estrictamente necesario, pero también lo ejecuté.
* no usar FS extravagantes, EXT4 por mucho.