Skip to content

Instantly share code, notes, and snippets.

View ddanielsantos's full-sized avatar

Daniel Santos ddanielsantos

  • Fadesp
  • Belém - PA - Brazil
  • 20:34 (UTC -03:00)
  • X @ddanieu_
View GitHub Profile
@ddanielsantos
ddanielsantos / Dockerfile
Created August 28, 2024 13:35
rust_api_dockerfile
ARG RUST_VERSION=1.79
FROM lukemathwalker/cargo-chef:latest-rust-${RUST_VERSION} AS chef
WORKDIR /app
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
Measure-Command -Expression {
node ollama_embedding.js
}
async function generate_embeddings(input) {
const response = await fetch('http://localhost:11434/api/embeddings', {
method: 'POST',
body: JSON.stringify({ model: 'nomic-embed-text', prompt: input }),
headers: { "Content-Type": "application/json" },
});
const response_json = await response.json();
return response_json.embedding;
}
# This script is meant to copy some files to a folder inside my sdcard
# it has some requirements:
# - adb installed (https://developer.android.com/studio/releases/platform-tools?hl=pt-br#downloads)
# - download and extract it, the .exe file will be inside, you can add this folder to
# the PATH variable
# - an android device with usb debug enabled
# Here, 3836-6631 its how adb recognizes my sdcard,
# if you want to use the internal storage, you can change to "emulated/0".
@ddanielsantos
ddanielsantos / dockerLearnPath.md
Created September 9, 2022 12:22 — forked from sibelius/dockerLearnPath.md
Docker Learn Path - What do you need to know about Docker
  • learn why we need docker
  • learn how to define a Dockerfile
  • learn how to build a docker
  • learn how to list images
  • learn how to run docker with port forward
  • learn how to go inside docker to debug, running /bin/bash
  • learn docker compose
  • learn how to send a docker image to a reqistry (dockerhub or aws ecr)
  • learn how to deploy a docker to kubernetes, aws ecs or another platform
  • learn how to use docker volumes
@ddanielsantos
ddanielsantos / toggle-theme.lua
Created August 26, 2022 22:37
toggle light/dark on LunarVim
lvim.keys.normal_mode["<leader>t"] = ":lua ToggleTheme() <cr>"
function ToggleTheme()
if (vim.api.nvim_get_option("background") == "dark") then
vim.api.nvim_command("set background=light")
else
vim.api.nvim_command("set background=dark")
end
end
const [bgColor, setBgColor] = useState('initial color here')
useEffect(() => {
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const { backgroundColor } = getComputedStyle(entry.target)
setBgColor(backgroundColor)
}
})
@ddanielsantos
ddanielsantos / list.md
Last active September 14, 2022 17:21
graphql/relay-references
@ddanielsantos
ddanielsantos / bulk-rename.ps1
Created June 28, 2022 21:09
bulk rename powershell
Get-ChildItem *.js | Rename-Item -NewName { $_.Name -replace '.js','.ts' }
Function GoToFolderName {Set-Location -Path C:/some/folder/idk}
Set-Alias -Name FolderName -Value GoToFolderName