Skip to content

Instantly share code, notes, and snippets.

// Add below to /usr/share/X11/xkb/symbols/br in replacement of Brazilian Nativo layout for US keyboards
//
// Keychron K2 Brazilian - Replaces Brazilian Nativo layout for US keyboards.
//
// Victor Oliveira <eu@victoroliveira.com.br>
//
partial alphanumeric_keys
xkb_symbols "nativo-us" {
@victoroliveirab
victoroliveirab / script.js
Created February 26, 2020 15:04
Postman Pre-Request Script
// Adapted from:
// https://www.nicolaswidart.com/blog/automatically-set-authentication-tokens-in-postman-requests
var requiredAuthPath = pm.environment.get('requiredAuthPath');
var authServicePath = pm.environment.get('authServicePath');
var gatewayBaseUrl = pm.environment.get('gatewayBaseUrl');
var username = pm.environment.get('username');
var password = pm.environment.get('password');
var sdk = require('postman-collection');
@victoroliveirab
victoroliveirab / cloudSettings
Last active December 29, 2021 14:11
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-08-09T00:55:40.507Z","extensionVersion":"v3.4.3"}
@victoroliveirab
victoroliveirab / contiguous.c
Last active October 14, 2019 02:03
Contiguous - Worst code ever written :D
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFFER_LENGTH 20
int parse_process(char* token);
void request_worst(short (*array)[], long num_of_bytes, int pid);
void request_best(short (*array)[], long num_of_bytes, int pid);
void request_first(short (*array)[], long num_of_bytes, int pid);
@victoroliveirab
victoroliveirab / banker.c
Created October 2, 2019 00:37
Banker's Algorithm
#include <stdio.h>
#include <stdlib.h>
#define TYPES_OF_RESOURCES 3
#define NUM_OF_THREADS 5
#define DEBUG 2
void populate_need();
int is_system_in_safe_state();
void traverse_array(int length, int* first, char* name);
@victoroliveirab
victoroliveirab / Makefile
Last active November 22, 2022 10:59
Threadpool with pthreads, semaphore and mutex lock
# makefile for thread pool
#
CC=gcc
CFLAGS=-Wall
PTHREADS=-lpthread
all: client.o threadpool.o
$(CC) $(CFLAGS) -o test client.o threadpool.o $(PTHREADS)
@victoroliveirab
victoroliveirab / schedule_rr.c
Created September 4, 2019 19:35
Round-Robin Implementation in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "task.h"
#include "list.h"
#include "cpu.h"
/*
Round-Robin Scheduling Algorithm Implementation
Programming Project of Chapter 5 from the book "Operating System Concepts - 10th Edition"