Skip to content

Instantly share code, notes, and snippets.

View belenaj's full-sized avatar

Jorge belenaj

View GitHub Profile
@clrcrl
clrcrl / readme.md
Last active November 27, 2023 16:39
Using dbt to version-control macros

This is the process I used to put redshift user defined functions into dbt.

  1. Created a subdirectory: macros/udfs/
  2. Created a file for each udf, e.g. macros/udfs/f_future_date.sql.
{% macro f_future_date() %}
CREATE OR REPLACE FUNCTION {{target.schema}}.f_future_date()
RETURNS TIMESTAMP
IMMUTABLE AS $$
SELECT '2100-01-01'::TIMESTAMP;
@ghandic
ghandic / pil_s3.py
Last active March 15, 2024 14:16
Load image from S3 directly into memory as PIL image and write to S3 directly from memory from PIL image
import boto3
from PIL import Image
from io import BytesIO
import os
class S3ImagesInvalidExtension(Exception):
pass
class S3ImagesUploadFailed(Exception):
pass
@bmaupin
bmaupin / free-database-hosting.md
Last active October 5, 2026 09:49
Free database hosting
@felipou
felipou / decrypt_dbeaver.py
Last active April 27, 2026 17:28
DBeaver password decryption script - for newer versions of DBeaver
# https://stackoverflow.com/questions/39928401/recover-db-password-stored-in-my-dbeaver-connection
# requires pycryptodome lib (pip install pycryptodome)
import sys
import base64
import os
import json
from Crypto.Cipher import AES
@rokibhasansagar
rokibhasansagar / gitclean.sh
Last active January 13, 2025 12:30 — forked from Zibri/gitclean.sh
Bash script to remove all revisions from github or gist repository.
#!/bin/bash
#
# By Zibri (2019)
# Modified by @rokibhasansagar
#
# Usage: gitclean git-repo-url
#
gitclean ()
{
git clone "$1" workDir && {
@tfeldmann
tfeldmann / duplicates.py
Last active April 5, 2026 05:55
Fast duplicate file finder written in python
#!/usr/bin/env python
"""
Fast duplicate file finder.
Usage: duplicates.py <folder> [<folder>...]
Based on https://stackoverflow.com/a/36113168/300783
Modified for Python3 with some small code improvements.
"""
import os
import sys