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
<?php
// obtener el listado de funciones que llama un objeto llamado conn
// grep -or "conn->.*.(" >/tmp/llamadas.txt
$f = file_get_contents('/tmp/llamadas.txt');
$lineas = explode("\n" , $f) ;
$aux = [ ];
foreach($lineas as $l){
if (strstr($l, 'vendor')===false)
@horaciod
horaciod / backkupgitrepo.sh
Created June 17, 2021 11:57
backup de cambios de un repositorio git sin hacer commit
#!/bin/bash
tar czvf $1 `git diff --name-only`
@horaciod
horaciod / exportdata.sh
Created May 7, 2021 15:59
export de todos los registros de una base de datos por tabla en local
#!/bin/bash
input="dbclean/tablas_datos.txt"
n=$((0))
while IFS= read -r line
do
((n++))
nn=`printf '%03d' "$n"`
echo "Exportando $nn $line "
@horaciod
horaciod / exportdata.sh
Last active May 7, 2021 15:38
export de todos los registros de una base de datos por tabla en local
#!/bin/bash
input="dbclean/tablas_datos.txt"
#el archivo tiene los nombres de las tablas con el esquema ej: biblio.usuarios
while IFS= read -r line
do
echo "Exportando $line"
docker exec -e PGPASSWORD=xxx sid21-db12 /usr/bin/pg_dump -Upostgres -hlocalhost siglocal2021 -a --inserts -t $line >dbclean/$line.sql
done < "$input"
@horaciod
horaciod / hiberna.sh
Created April 10, 2021 21:45
Hiberna
#!/bin/bash
zenity --question --text="Are you sure, proceed to shutdown?"
if [ $? = 0 ]; then
sudo s2disk
else
exit
fi
@horaciod
horaciod / to_timestamp.sql
Created January 28, 2021 22:58
timestamp unixtime postgresql
select(to_timestamp(61 ));
1970-01-01 01:01:01+01
---- Se me olvida siempre !!!
@horaciod
horaciod / ray-adodb.php
Last active January 22, 2021 23:22
Adodb Function that send the queries from adodb (https://adodb.org/) to ray app (https://myray.app/) (envía las consultas de la librería adodb.php a la app ray)
<?php
define('ADODB_OUTP', 'log_querys_to_ray');
function log_querys_to_ray($msg)
{
if (function_exists('ray')) {
$msg = strip_tags($msg);
ray($msg)->green();
@horaciod
horaciod / notify_table_update_trigger.sql
Created August 27, 2020 19:50
Guardado de registros automático en postgresql
CREATE OR REPLACE FUNCTION notify_table_update()
RETURNS TRIGGER
LANGUAGE PLPGSQL
AS
$$
BEGIN
IF TG_OP = 'INSERT' THEN
PERFORM pg_notify(
'update_' || TG_TABLE_NAME,
'{"new":' || row_to_json(NEW)::text || '}'
<?php
namespace App\Http\Livewire;
// use Kdion4891\LaravelLivewireForms\FormComponent;
use Kdion4891\LaravelLivewireForms\Field;
use Kdion4891\LaravelLivewireForms\FormComponent;
class AcheFormComponent extends FormComponent {
@horaciod
horaciod / gist:8b9d5da20376de7a2f9479f23f4a0081
Created August 6, 2020 22:37
export-postgres-json.psql
select json_agg(t)
from (select id,name, institucion_id from users where tipo='informador' ) t \g informadores.json