Skip to content

Instantly share code, notes, and snippets.

View jarodsim's full-sized avatar
📚
studing

Jarod Mateus de Sousa Cavalcante jarodsim

📚
studing
View GitHub Profile
@jarodsim
jarodsim / atv4.py
Created December 7, 2024 20:45
Cálculo do número das páginas virtuais
import pandas as pd
enderecos = [4669, 2227, 13916, 34587, 48870, 12608, 49225]
tamanho_pagina = 4096 # 4 KiB
tlb = [
[1, 11, 12],
[1, 7, 2004],
[1, 3, 2006],
[2000, 4, 9]
@jarodsim
jarodsim / cache_simulation_block_size_2.py
Created November 12, 2024 02:24
cache_simulation_block_size_2.py
import math
def simulate_cache(addresses, cache_size, block_size):
block_size_bits = block_size * 32
index_bits = int(math.log2(cache_size))
cache = {}
results = []
for address in addresses:
binary_address = bin(address)[2:].zfill(32)
@jarodsim
jarodsim / decimal_to_binary.py
Created November 12, 2024 02:12
decimal_to_binary.py
def decimal_to_binary_32bit(number):
return format(number, '032b')
addresses = [3, 180, 43, 2, 191, 88, 190, 14, 181, 44, 186, 253]
results = []
num_blocks = 16
index_bits = 4
@jarodsim
jarodsim / .tsx
Created September 18, 2024 16:31
import {
createBrowserRouter,
RouteObject,
RouterProvider,
} from "react-router-dom";
import { ListResources } from "./pages/Resources/ListResurces";
import { Root } from "./pages/Root";
import ViewResource from "./pages/Resources/ViewResource";
import CreateResourceForm from "./pages/Resources/CreateResource";
import { Button, Result } from "antd";
@jarodsim
jarodsim / gitc.py
Created May 24, 2024 16:27
Automatiza o processo de atualização de múltiplos repositórios Git localizados em subdiretórios a partir do diretório onde o script é executado. O script aceita o nome de uma branch como argumento, faz checkout dessa branch em cada repositório encontrado e, em seguida, executa um git pull para atualizar os repositórios com as últimas mudanças do…
import os
import sys
import subprocess
def main():
if len(sys.argv) != 2:
print("Uso: python script.py <BRANCH_NAME>")
sys.exit(1)
branch_name = sys.argv[1]
@jarodsim
jarodsim / index.js
Created July 29, 2023 13:41
JAVASCRIPT - TODO
// Seleção de elementos
const todoForm = document.querySelector("#todo-form");
const todoInput = document.querySelector("#todo-input");
const todoList = document.querySelector("#todo-list");
const editForm = document.querySelector("#edit-form");
const editInput = document.querySelector("#edit-input");
const cancelEditBtn = document.querySelector("#cancel-edit-btn");
let oldInputValue;
@jarodsim
jarodsim / styles.css
Created July 29, 2023 12:12
CSS - TODO
/* Geral */
* {
padding: 0;
margin: 0;
font-family: Helvetica;
color: #333;
box-sizing: border-box;
}
body {
@jarodsim
jarodsim / index.html
Created July 29, 2023 12:11
html - TODO
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Todo Avançado</title>
<!-- CSS do projeto -->
<link rel="stylesheet" href="css/styles.css">
<!-- Font Awesome -->
@jarodsim
jarodsim / meet.js
Created November 24, 2022 00:18
Script para automagicamente responder mensagens no chat do google meet
function handleMessages(filter) {
const valuesAlreadySent = []
const interval = setInterval(() => {
if (valuesAlreadySent.length >= Object.keys(filter).length) {
clearInterval(interval)
return
}
const div_message = document.querySelectorAll('div[data-message-text]')
@jarodsim
jarodsim / removeLogs.js
Last active October 13, 2022 11:47
Script para remover os console.logs do projeto
const fs = require('fs');
const path = require('path');
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});