Skip to content

Instantly share code, notes, and snippets.

@celsowm
celsowm / exemplo.js
Created January 13, 2025 21:43
Plugin de Exemplo em CKEditor 5
import { Plugin, ButtonView, View, InputTextView } from 'ckeditor5';
export default class Exemplo extends Plugin {
init() {
const editor = this.editor;
// Adiciona o botão "Exemplo" à barra de ferramentas
editor.ui.componentFactory.add('exemplo', locale => {
@celsowm
celsowm / llama_cpp_python.bat
Last active January 11, 2025 14:40
llama_cpp_python with CUDA on windows
setx CMAKE_ARGS "-DGGML_CUDA=on"
pip install -U --no-cache --force-reinstall -vvv llama-cpp-python
@celsowm
celsowm / index.htm
Created January 7, 2025 12:43
Menu Dropdown generator via bootstrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Menu Dinâmico</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-dark text-light p-3">
@celsowm
celsowm / index.htm
Created January 6, 2025 15:19
basic chat llm using stream mode
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Levi Chat</title>
<style>
body {
font-family: Arial, sans-serif;
@celsowm
celsowm / index.htm
Created January 1, 2025 02:17
extract pdf text using pdfjs + drag and drop file pdf
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PDF.js Drag & Extract</title>
<script type="module" src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.9.155/pdf.min.mjs"></script>
<style>
body {
display: flex;
@celsowm
celsowm / index.htm
Created December 31, 2024 14:29
ckeditor 5 + html2pdfjs
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>CKEditor 5 - Decoupled Editor com Visualização PDF</title>
<style>
body, html {
height: 100%;
margin: 0;
font-family: Arial, sans-serif;
@celsowm
celsowm / codigo_civil.json
Last active January 31, 2025 21:59
codigo_civil.json
[
{
"numero": 1,
"texto": "Toda pessoa é capaz de direitos e deveres na ordem civil."
},
{
"numero": 2,
"texto": "A personalidade civil da pessoa começa do nascimento com\r\nvida; mas a lei põe a salvo, desde a concepção, os direitos do nascituro."
},
{
@celsowm
celsowm / markdown2docx.js
Created December 27, 2024 16:28
markdown2docx.js
// Importe VerticalAlign e ExternalHyperlink
const {
Document,
Packer,
Paragraph,
TextRun,
HeadingLevel,
Table,
TableRow,
TableCell,
@celsowm
celsowm / main.c
Last active December 26, 2024 02:43
jump cube demo jo engine saturn
#include <jo/jo.h>
// Estrutura para armazenar posição e velocidade da caixa
typedef struct {
jo_pos3Df position;
float velocity_y;
bool is_jumping;
} Cube;
// Instância da caixa
@celsowm
celsowm / markdown2docx.js
Created December 25, 2024 13:11
markdown2docx
function convertTextToHTML(text) {
// Primeira etapa: detectar e converter tabelas
let lines = text.split('\n');
let htmlParts = [];
let i = 0;
while (i < lines.length) {
// Verifica se a linha atual parece ser um cabeçalho de tabela
if (isTableHeader(lines[i]) && i + 1 < lines.length && isTableDivider(lines[i + 1])) {
// Encontramos um possível bloco de tabela