Skip to content

Instantly share code, notes, and snippets.

View ivanfretes's full-sized avatar
😄

Iván Fretes ivanfretes

😄
View GitHub Profile
@ivanfretes
ivanfretes / fetch_tree.adoc
Created March 1, 2023 14:56 — forked from jexp/fetch_tree.adoc
Fetch a Tree with Neo4j

Fetch a Tree with Neo4j

Today I came across a really interesting StackOverflow question:

Given a forest of trees in a Neo4j REST server, I`m trying to return a single tree given the root vertex. Being each tree quite large, I need a de-duplicated list of all vertices and edges in order to be able to reconstruct the full tree on the client side.

@ivanfretes
ivanfretes / fetch_tree.adoc
Created March 1, 2023 14:56 — forked from jexp/fetch_tree.adoc
Fetch a Tree with Neo4j

Fetch a Tree with Neo4j

Today I came across a really interesting StackOverflow question:

Given a forest of trees in a Neo4j REST server, I`m trying to return a single tree given the root vertex. Being each tree quite large, I need a de-duplicated list of all vertices and edges in order to be able to reconstruct the full tree on the client side.

@ivanfretes
ivanfretes / recovery-git-files.bash
Last active December 15, 2022 22:39
Recovery commits, tree and blob with bash
#!/usr/bin/env bash
mkdir recovery-git
filehashes='recovery-git/00_hashes.txt'
rm $filehashes
git fsck --unreachable >> $filehashes
while read line; do
wordsInLine=($line)
hash=${wordsInLine[2]}

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@ivanfretes
ivanfretes / settings.json
Last active June 29, 2022 12:35
My vscode config
{
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
// Para que no defecte la indentación del archivo
"editor.detectIndentation": false,
"editor.tabSize": 2,
// Inserta espacios cuando se agregan tabs
"editor.insertSpaces": true,
@ivanfretes
ivanfretes / Generar Truncate
Last active May 25, 2020 12:32
Sentencias SQL
-- Genera sentencias para hacer truncate de una DB
SELECT CONCAT('TRUNCATE TABLE ', TABLE_NAME, ';') as tables_name
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'
AND TABLE_SCHEMA = 'db_name'
LIMIT 500;
@ivanfretes
ivanfretes / balanced_parenthesis.ts
Last active March 19, 2020 15:57
quanto-test-v2
/**
* Verifica el primer y ultimo elemento
*
* O(1)
* @param simbols
*/
function verficarPrincipioFin(simbols : string ) : boolean{
const firstElement = simbols[0]
const lastElement = simbols[simbols.length - 1]
'use strict';
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
@ivanfretes
ivanfretes / script.py
Created November 26, 2019 07:29
python3 script.py
#!/usr/bin/python3
numeros_en_letras = [
"cero", "uno", "dos", "tres", "cuatro", "cinco", "seis", "siete", "ocho", "nueve", "diez"
]
def contar_y_decir(numero):
''' Luego de parsear el numero a cadena,
iteramos y verificamos si los numeros contiguos son iguales
e incrementamos conctador en dicho caso, cuando se produce el
@ivanfretes
ivanfretes / drop-constraint.sql
Created January 6, 2019 18:04
Select and drop constraint (unique, foreign, primary or custom) - postgreSQL
ALTER TABLE "my_table" DROP CONSTRAINT "constraint_name"