Skip to content

Instantly share code, notes, and snippets.

View Hugoberry's full-sized avatar

Igor Cotruta Hugoberry

View GitHub Profile
@Hugoberry
Hugoberry / description.md
Created May 29, 2024 22:00 — forked from braden-w/description.md
Google Sheets Script for Fetching Data from Supabase

Google Sheets Script for Fetching Data from Supabase

This Google Sheets script fetches data from a Supabase database and writes the selected headers and data to the active sheet. The script first clears the sheet, writes the headers, then fetches the data from the Supabase API, and finally writes the data to the sheet. It is optimized and has anonymized variables for public use.

How to Use

  1. Create a new Google Sheet or open an existing one.
  2. Click on "Extensions" in the menu, then select "Apps Script." (If you don't see "Extensions," click on "Tools" and then "Script editor.")
  3. In the Apps Script editor, replace the default Code.gs content with the content of supabase_to_google_sheets.gs.
  4. Replace the SUPABASE_URL and SUPABASE_ANON_KEY variables with your actual Supabase URL and anon key.
@Hugoberry
Hugoberry / duckdb-RAG.py
Last active March 6, 2024 11:03
Bare-bones implementation of similarity search in DuckDB using Expression API
import duckdb
from duckdb import (
ConstantExpression,
ColumnExpression,
FunctionExpression,
StarExpression
)
conn = duckdb.connect(database='embed.ddb')
text="Wooden floor"
@Hugoberry
Hugoberry / KMeansClustering.dax
Created January 18, 2024 12:56
A worked example of using the undocumented DAX function KMeansClustering
evaluate
var sample =
{
("L", 5),
("N", 5),
("P", 7),
("E", 9),
("U", 11),
("Y", 11),
("V", 29),
@Hugoberry
Hugoberry / customEdge.html
Created January 17, 2024 09:22 — forked from davidjgraph/customEdge.html
Custom edge example for mxGraph
<!--
$Id: markers.html,v 1.4 2013/10/28 08:44:55 gaudenz Exp $
Copyright (c) 2006-2014, JGraph Ltd
Demonstrates creating a custom edge in mxGraph
-->
<html>
<head>
<title>Custom edge example for mxGraph</title>
// Function to wrangle data into the required format
function wrangle(data) {
let charactersMap = {};
// Helper function to get characters by ID
function characterById(id) {
if (!charactersMap[id]) {
charactersMap[id] = data.characters.find(character => character.id === id);
}
return charactersMap[id];
<head>
<script type="text/javascript">
mxBasePath = 'https://jgraph.github.io/mxgraph/javascript/src';
</script>
<script type="text/javascript" src="https://jgraph.github.io/mxgraph/javascript/src/js/mxClient.js"></script>
<script type="text/javascript">
function wrangle(data) {
var charactersMap = {};
return data.scenes.map(function(scene) {
return {
let
Source = {"B", "F", "T"},
n = List.Count(Source),
combinations = Number.Power(2,n)-1,
CreateCombination = (mask as number) as list =>
List.Select(List.Transform(List.Positions(Source), (position) =>
if Number.BitwiseAnd(mask, Number.Power(2, position)) <> 0 then Source{position} else null),
each _ <> null),
@Hugoberry
Hugoberry / ABF_tabular_file_types.md
Last active September 6, 2023 15:20
ABF structure of files located under a datamodel file in PBIX. #PowerBI #tabular

{Table} ({TableID}).tbl folders contains the following

  • #.{Table} ({TableID}).Column ({ColumnID}).dictionary file for all the HASH encoded columns
  • #.H${Table} ({TableID})${Column} ({ColumnID}).hidx hash index files for all the VALUE encoded columns
  • {PartitionID}.prt partition folder with:
    • #.{Table} ({TableID).{Column} ({ColumnID}).0.idf column data storage file
    • #.{Table} ({TableID).{Column} ({ColumnID}).0.idfmeta column data storage metadata file

H${Table} ({TableID})${Column} ({ColumnID})$({SystemTableID}).tbl hierarchy folders

  • {PartitionID}.prt
  • #.H${Table} ({TableID})$Column ({ColumnID}).{ID_TO_POS|POS_TO_ID}.0.idf Column Hierarchy Position–to–Identifier or Identifier–to–PositionFile
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"$id": {
"type": "string"
},
"DaxModelVersion": {
"type": "string"
},
@Hugoberry
Hugoberry / CodeWindow.html
Created July 5, 2023 10:30
Tailwindcss play link https://play.tailwindcss.com/jJ7APsi5d8 ide window prime for embedding some code
<section class="container mx-auto mt-8 w-full max-w-none md:mt-10 lg:mt-12 xl:max-w-screen-2xl xl:px-16">
<div class="before:bg-marketing-gradient-brand before:-z-high after:z-high safari:before:will-change-transform xl:after:border-marketing-divider relative relative col-span-12 flex select-none font-sans will-change-transform before:pointer-events-none before:absolute before:inset-0 before:hidden before:rounded-[20%] before:opacity-[0.12] before:blur-3xl after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] md:h-[min(70vw,90vh)] md:max-h-[600px] xl:max-h-[800px] xl:rounded-xl xl:before:block xl:after:border">
<div class="xl:bg-marketing-surface-base relative flex flex-1 flex-col overflow-hidden xl:rounded-[inherit]">
<div class="border-marketing-divider hidden h-12 flex-none grid-cols-[1fr_auto_1fr] border-b xl:grid">
<div class="flex items-center gap-4 pl-4">
<div class="group flex gap-2">
<div class="h-3 w-3 rounded-full bg-white/10"></div