Skip to content

Instantly share code, notes, and snippets.

@mansueli
mansueli / gist:023b61137227547d8d509860a09672ca
Last active December 27, 2023 15:19
Service role Vault interaction
GRANT pgsodium_keyiduser TO service_role;
CREATE OR REPLACE FUNCTION public.create_secret(secret text, name text, description text default '', key_id uuid default null)
RETURNS uuid
LANGUAGE plpgsql
SECURITY DEFINER
AS $function$
DECLARE
result uuid;
BEGIN
import { serve } from "https://deno.land/std@0.200.0/http/server.ts"
console.log("Hello from Functions!")
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers":
"authorization, x-client-info, apikey, content-type",
};
@mansueli
mansueli / gist:e9dc3b6ca562c35fa58f4e37348cc452
Created September 7, 2023 14:55
Commit backup - workflow
# This is a basic workflow to help you get started with Actions
name: Supa-backup
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
push:
branches: [ main ]
pull_request:
branches: [main]
api.supabase.io/platform/pg-meta//extensions:1 Failed to load resource: the server responded with a status of 404 ()
instrument.js:109 GoTrueClient@0 2023-07-07T14:59:24.478Z #getSession() begin
instrument.js:109 GoTrueClient@0 2023-07-07T14:59:24.478Z #getSession() session from storage Object
instrument.js:109 GoTrueClient@0 2023-07-07T14:59:24.478Z #getSession() session has not expired expires_at 1688742056
instrument.js:109 GoTrueClient@0 2023-07-07T14:59:24.478Z #getSession() end
instrument.js:109 GoTrueClient@0 2023-07-07T14:59:24.478Z #_autoRefreshTokenTick() access token expires in 3, a tick lasts 30000ms, refresh threshold is 3 ticks
instrument.js:109 GoTrueClient@0 2023-07-07T14:59:24.478Z #_autoRefreshTokenTick() end
instrument.js:109 GoTrueClient@0 2023-07-07T14:59:54.473Z #_autoRefreshTokenTick() begin
instrument.js:109 GoTrueClient@0 2023-07-07T14:59:54.479Z #getSession() begin
instrument.js:109 GoTrueClient@0 2023-07-07T14:59:54.479Z #getSession() session from storage Object
@mansueli
mansueli / resume.json
Last active May 22, 2023 19:32
resume.json
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Rodrigo Martins Mansueli, M.Sc.",
"label": "Support Engineer at Supabase",
"picture": "https://i.stack.imgur.com/tsqmf.png?s=400&g=1",
"email": "rodrigo@mansueli.com",
"phone": "+55 44991347731",
"url": "https://mansueli.com",
"summary": "I am a Support Engineer with experience in the tech industry. With a Master's Degree in Computer Science and a Bachelor's Degree in Computer Engineering, I have developed a strong technical background and knowledge of programming languages such as Java, Python, and SQL.\n\nIn my current role, I work closely with customers to provide exceptional technical support and help them troubleshoot issues with software and hardware systems. I am passionate about customer service and always strive to go above and beyond to exceed their expectations.\n\nI am excited to connect with other professionals in the industry and look forward to learn
@mansueli
mansueli / testing_rls_supabase.mdx
Last active November 2, 2023 23:14
Testing Row Level Security (RLS) policies @supabase

Testing RLS policies

To test policies on the database itself (i.e., from the SQL Editor or from psql) without switching to your frontend and logging in as different users, you can utilize the following helper SQL procedures (credits):

grant anon, authenticated to postgres;

create or replace procedure auth.login_as_user (user_email text)
    language plpgsql
    as $$
package foo;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
public class RTF {
private StringBuilder texto;
public String getTexto() {
return texto.toString();
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JComboBox;
public class Main {
public static void main(String[] args){
JComboBox<String> shapeChoice = new JComboBox<>();
shapeChoice.addItem("Point");
shapeChoice.addItem("Square");
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class DataRow {
private Integer numSlices;
private StringProperty selected;
public DataRow(int numSlices, String selected) {
this.selected = new SimpleStringProperty(selected);
this.numSlices = numSlices;
}
@mansueli
mansueli / mt_rand.php
Created August 1, 2014 19:37
Gist php rand() vs mt_rand()
<?php
header("Content-type: image/png");
mt_srand((double)microtime()*1000000);
$im = imagecreatetruecolor(300, 300) or die("A biblioteca GD provavelmente nao esta' instalada");
$emBranco = imagecolorallocate($im, 255, 255, 255);
for ($y = 0; $y < 300; $y++) {
for ($x = 0; $x < 300; $x++) {
if (mt_rand(0, 1)) {
imagesetpixel($im, $x, $y, $emBranco);
}