Skip to content

Instantly share code, notes, and snippets.

View kallebysantos's full-sized avatar
🦔
Catching components

Kalleby Santos kallebysantos

🦔
Catching components
View GitHub Profile
@kallebysantos
kallebysantos / Dockerfile
Created May 2, 2024 09:07
Supabase edge functions with custom embed model
FROM supabase/edge-runtime:v1.41.2 AS build
# Change here with the HF model name. It must be ONNX runtime compatible
ENV MODEL_NAME=Xenova/paraphrase-multilingual-MiniLM-L12-v2
# Setting up
RUN apt update && apt install curl -y
# Replacing 'gte-small' by $MODEL_NAME
WORKDIR /etc/sb_ai/models/gte-small
@kallebysantos
kallebysantos / _state-pattern-csharp.md
Created February 15, 2024 09:22
State pattern implementation in C#

pattern-matching.cs

public static class PatternMatching
{
    public static U Match<U, T1, T2>(Func<T1, U> match1, Func<T2, U> match2, T1? value1, T2? value2)
    {
        if (value1 is not null)
            return match1(value1);

        if (value2 is not null)
@kallebysantos
kallebysantos / option.md
Last active January 25, 2024 09:39
Rust types implementation in CSharp
public abstract record Option<T>()
{
    internal T? Value { get; init; }

    protected Option(T Value) : this()
    {
        this.Value = Value;
    }
@kallebysantos
kallebysantos / App.tsx
Last active June 25, 2024 01:55
Running Local AI models with FastAPI and Vercel AI SDK
import "./App.css";
import { useEffect, useState } from "react";
import { useCompletion } from "ai/react";
function App() {
const [apiResponse, setApiResponse] = useState("");
useEffect(() => {
fetch("/api/reply?value=Hello from React App!")
.then((response) => response.json())
@kallebysantos
kallebysantos / _server-send-events.md
Last active May 22, 2023 18:37
Server Send Events with .NET

.NET Sample implementation of SSE

image

Getting started

Creating our data object

// Message.cs
@kallebysantos
kallebysantos / _elastic-stack-with-docker.md
Last active May 9, 2023 13:19
Elastic Stack with Docker

Elastic Stack with Docker - GUIDE

Starting docker containers:

In order to start the Elastic + Kibana containers you should execute the following command:

docker compose up -d

Setting up Elasticsearch:

Once the container service has started run the following command to regenerate an user password:

@kallebysantos
kallebysantos / docker-server-setup.md
Last active May 9, 2023 13:18
Guide for setup a Linux server in order to run containerized applications

Server Setup

Installing environment tools:

Uninstall old versions:

sudo apt-get remove docker docker-engine docker.io containerd runc
@kallebysantos
kallebysantos / react-native-develop-guide.md
Last active March 1, 2023 12:57
Guide for setup a react-native-cli project

React Native - Development Guide

Environment Setup:

Install NodeJs LTS:

  • winget install OpenJS.NodeJS.LTS

Install OpenJDK 11: