Skip to content

Instantly share code, notes, and snippets.

View mjgargani's full-sized avatar
💭
🐧

Rodrigo Gargani Oliveira mjgargani

💭
🐧
View GitHub Profile
@mjgargani
mjgargani / .bashrc
Last active December 20, 2025 14:03
Ollama "ask" for `.bashrc`
# (...)
# Custom 'ask' function to interact with the Ollama model
# Usage: ask "your question here"
# Code-block location: ~/.bashrc
# Require Ollama with main and summary models
ask() {
# Configuration
local MAIN_MODEL="qwen2.5-coder:3b-instruct"
local SUMM_MODEL="qwen2.5:0.5b-instruct"
@mjgargani
mjgargani / calculator.rs
Last active May 10, 2025 22:25
Simple Calculator in Rust
// Trying to learn Rust - Simple Calculator
// Tentando aprender Rust - Calculadora Simples
// Define possible operations as an enum (enumeration)
// Define possíveis operações com tipo enum (enumeração)
enum Operation {
Add, // Soma
Subtract, // Subtração
Multiply, // Multiplicação
Divide, // Divisão
Array.prototype.asyncForEach = async function (fn) {
for (let i = 0; i < this.length; i++) {
await fn(this[i], i);
}
};
const asyncFunc = async (txt, ms) => new Promise((resolve,_reject) =>
setTimeout(() => resolve(console.log(`'${txt}'\t em ${ms} ms`)), ms));
const arrayDados = ['eita', 'cara', 'que', 'coisa', 'doida'];
@mjgargani
mjgargani / sidChallenge01.sql
Last active October 19, 2020 11:07
Tabela de disputas da copa (combinações sem repetições do grupo C)
-- criação e uso do db
DROP DATABASE IF EXISTS copa;
CREATE DATABASE copa;
USE copa;
-- criacao da tabela com restrições no campo
CREATE TABLE grupo_c (selecoes VARCHAR(20) UNIQUE NOT NULL);
-- inserção de times na tabela
INSERT INTO grupo_c (selecoes)
VALUES ('Brasil'),
('Turquia'),
@mjgargani
mjgargani / fbSponsorBlocker.js
Last active January 29, 2020 13:04
Bloqueador de posts patrocinados no novo template do fb (2020). A implementação vai de cada um.
const interval = 250; // Em ´ms´ (valor muito baixo vai gerar lag na navegação)
let SB = null;
// seletor Xpath
function getElementByXpath(path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
function iniciarSB() {
console.log('SponsorBlock iniciado', new Date().toLocaleString());