Skip to content

Instantly share code, notes, and snippets.

View horaciod's full-sized avatar
💭
aprendiendo todo lo posible

Horacio Degiorgi horaciod

💭
aprendiendo todo lo posible
View GitHub Profile
@horaciod
horaciod / entorno.kdl
Created January 16, 2024 14:55
entorno zellij para laravel , serve, npm y logs, arrancar con zellij --layout entorno.kdl
layout {
pane split_direction="horizontal" {
pane command="php" {
args "artisan" "serve"
}
pane command="npm" {
args "run" "dev"
}
pane command="tail" {
args "-f" "storage/logs/laravel.log"
@horaciod
horaciod / getcolumns-table-as-array-laravel.php
Created January 15, 2024 02:50
laravel to get all the fields in a table as array (for $fillable ...)
<?php
$x = collect(Schema::getColumnListing('templatefields'))
->transform(function ($item, $key) {
return "
'" . $item ."'"
;
})
->implode(",");
;
@horaciod
horaciod / dockerss.sh
Created December 29, 2023 22:56
listar todos los contenedores con los nombres de proyectos de docker-compose
#!/bin/bash
## https://stackoverflow.com/questions/70915151/how-to-show-all-running-containers-created-by-docker-compose-globally-regardle
base='{{.Status}}\t{{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Ports}}\t{{.Networks}}\t{{.Mounts}}'
compose='{{.Label "com.docker.compose.project"}}\t{{.Label "com.docker.compose.service"}}'
docker container ls --all \
--filter label=com.docker.compose.project \
--format "table $compose\t$base"
@horaciod
horaciod / seq-max.sql
Created June 24, 2023 22:10
Sql para generar todas las sqls necesarias para verificar los max y las sequencias de un postgresql 13
-- sql para generar todas las sqls necesarias para verificar los max y las sequencias de un postgresql 13
select
'select '''|| sequencename || ''', max(id) , '|| last_value::text || ' as sec from ' || replace( sequencename , '_id_seq',' ; ')
from pg_sequences ;
@horaciod
horaciod / string.sql
Last active April 20, 2023 23:43
postgresql-funciones-string
-- Teniendo una columna activida con el texto
-- Se ha validado la tapa de OLESID060417 con el archivo https://bibliotecas.uncuyo.edu.ar/sig/catalogo/editor/tapa/tapaurl.
-- se puede obtener solo el código con la siguiente sql
select substring (actividad, length('Se ha validado la tapa de '),
position(' ' in replace(actividad, 'Se ha validado la tapa de ',
''))),
actividad
from "logueo"
where actividad like 'Se ha validado la tapa de%'
@horaciod
horaciod / alter_seq.sql
Created March 8, 2023 23:27
alter sequence
SELECT setval(‘table_id_seq’, (SELECT MAX(id) FROM table));
#!/bin/bash
num=10
short=0
timestyle='--time-style=locale'
#"+%d-%b-%Y%H:%M:%S "'
## number of files to print
## set to 1 for short listing
## GNU-specific time format
opts=Aadn:os
@horaciod
horaciod / screentelegram.sh
Last active May 11, 2022 03:05
Toma un screenshot en linux y lo envía con el script telegram-notify.sh a un bot en telegram.
#!/bin/bash
### llamar con la cantidad de segundos de espera entre captura y captura
sleep 3
while true
do
gnome-screenshot -f /tmp/screen.png
fecha=`date +%Y-%m-%d\ %H:%M`
echo $fecha
@horaciod
horaciod / ips.sh
Created May 5, 2022 12:12
lista de ips con vista pretty
#!/bin/bash
ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print '
@horaciod
horaciod / screentelegram.sh
Created May 2, 2022 15:47
toma screenshot y envia a telegram
#!/bin/bash
sleep 3
while true
do
gnome-screenshot -f /tmp/algo.png
./telegram-notify.sh --success --texto "pantalla" --photo /tmp/algo.png
rm /tmp/algo.png
sleep 300
echo "enviado cada 5 minutos"
done