Skip to content

Instantly share code, notes, and snippets.

View mauleyzaola's full-sized avatar

Mauricio Leyzaola mauleyzaola

View GitHub Profile
@mauleyzaola
mauleyzaola / auth-hook.js
Created April 30, 2023 22:34 — forked from ulises-jeremias/auth-hook.js
Examples of hooks utils using axios, recoil.js, keycloak-js, @react-keycloak/web and more.
import { useCallback, useEffect, useState } from 'react';
import { useSetRecoilState } from 'recoil';
import { useKeycloak } from '@react-keycloak/web';
import { commonNotification } from './common';
/**
* Returns the auth info and some auth strategies.
*
*/
@mauleyzaola
mauleyzaola / uuid_bytea_casts.sql
Created June 29, 2023 14:55 — forked from Pigeo/uuid_bytea_casts.sql
Cast UUID into BYTEA (and vice versa) in PostgreSQL
-- UUID to BYTEA:
SELECT DECODE(REPLACE(CAST(uuid_field AS TEXT),'-',''), 'hex') FROM table;
-- BYTEA to UUID:
SELECT CAST(ENCODE(bytea_field, 'hex') AS UUID) FROM table;
-- BONUS --
@mauleyzaola
mauleyzaola / youtube.txt
Created December 14, 2023 13:50 — forked from iredun/youtube.txt
Youtube API get thumbnail image
Each YouTube video has 4 generated images. They are predictably formatted as follows:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
For the high quality version of the thumbnail use a url similar to this:
@mauleyzaola
mauleyzaola / GitRecovery
Created January 14, 2024 20:49 — forked from pce1991/GitRecovery
Repair git says object files are empty/corrupted
find .git/objects/ -type f -empty | xargs rm
git fetch -p
git fsck --full
http://stackoverflow.com/questions/11706215/how-to-fix-git-error-object-file-is-empty