Skip to content

Instantly share code, notes, and snippets.

View Drowze's full-sized avatar

R Gibim Drowze

View GitHub Profile
@Drowze
Drowze / minix_tutorial.md
Last active October 21, 2024 20:51
MINIX: FROM ZERO TO ZERO+1: Setting SSH, adding system calls and system libraries to custom system calls in Minix 3.3.0; based on a University assignment. #minix #c #system_call #custom_library #c_library #library

Disclaimer

I take no responsability for any problems a user might have on following this gist. This includes university problems.

The motivation for this is to document, as dummy-oriented as possible, a way to setup and add a system call to Minix OS. This is a classic assignment at Operational Systems classes (and is pretty cool tbh)

Configuration:

ISO used: minix_R3.3.0-588a35b.iso

@Drowze
Drowze / check_cpf.rb
Created November 3, 2016 18:23
simple method to check a cpf
def check_cpf(cpf=nil)
return false if cpf.nil?
known_invalid_cpfs = %w{12345678909 11111111111 22222222222 33333333333
44444444444 55555555555 66666666666 77777777777
88888888888 99999999999 00000000000 }
cpf_digits = cpf.scan /[0-9]/
if cpf_digits.length == 11
unless known_invalid_cpfs.include?(cpf_digits.join)
cpf_digits = cpf_digits.map{|x| x.to_i}
{
"color_scheme": "Packages/Theme - Flatland/Flatland Monokai.tmTheme",
"font_size": 13,
"highlight_line": true,
"match_brackets_angle": true,
"ignored_packages":
[
"Vintage"
],
"tab_size": 2,
@Drowze
Drowze / gist:76a9b85372d168c8e013
Last active March 9, 2016 19:12
Podcasts I follow
--------- BRASILEIROS
Jogabilidade (games)
-> Esse feed abriga os podcasts sobre vídeo games do Jogabilidade. O DASH é temático e foca-se num jogo, série, desenvolvedor ou conceito a cada episódio. O Vértice é um compilado das mais recentes notícias e jogos que experimentamos. O Construindo Mundos entrevista e explora o lado humano dos desenvolvedores de games brasileiros.
http://feeds.feedburner.com/dashpodcast
Jogabilidade (não games)
-> Esse é o feed para os podcasts do Jogabilidade que não falam de vídeo games. O JACK é um podcast que discute anime e mangás num formato de "clube do livro". O Linha Quente é onde despejamos nossa (pouca) sabedoria sobre as mais diversas questões. No Fora da Caixa, recomendamos e discutimos todo o resto, de música a seriados, de filmes a canais de YouTube.
http://feeds.feedburner.com/jack-animeclub
@Drowze
Drowze / examinator.rb
Last active December 12, 2015 05:38
WIP: script to auto-correct almost any program (the outputs should not contain "\n\n" though)
## Converting line endings to unix:
inputs_file = File.open('./inputs.txt', 'a+')
outputs_file = File.open('./outputs.txt', 'a+')
input_file_contents = inputs_file.read.gsub(/\r\n?/,"\n")
inputs_file.truncate(0)
inputs_file.print input_file_contents
outputs_file_contents = outputs_file.read.gsub(/\r\n?/,"\n")
outputs_file.truncate(0)
Tempo (s) Pos (Y) V = at G (m/s^2) Variação Y
0 2500 0 -3.711
1 2498 -3.711 -3.711 -2
2 2493 -7.422 -3.711 -5
3 2483 -11.133 -3.711 -10
4 2470 -14.844 -3.711 -13
5 2454 -18.555 -3.711 -16
6 2433 -22.266 -3.711 -21
7 2409 -25.977 -3.711 -24
8 2381 -29.688 -3.711 -28
@Drowze
Drowze / mergesort.c
Last active December 4, 2015 05:11
#sort #sorting #puc apc-b 2016
#include <stdio.h>
void merge(int v[], int inicio, int meio, int fim) {
int aux[100];
int aux_inicio = inicio, aux_meio = meio + 1, k=0;
while(aux_inicio <= meio && aux_meio <= fim)
if(v[aux_inicio] <= v[aux_meio])
aux[k++] = v[aux_inicio++];
else
aux[k++] = v[aux_meio++];
@Drowze
Drowze / mim_ajuda.rb
Last active December 2, 2015 14:41
mim ajuda
require 'matrix'
class Matrix
def []=(i, j, x)
@rows[i][j] = x
end
end
class String # Only works for single letters; could be extended to uppercase letters too
def step(c, delta=1)
if c.ord + delta > 122 then
@Drowze
Drowze / caesar.c
Last active November 11, 2015 17:18
Only simple letters for now
#include <stdio.h>
void caesar_cipher(FILE *input, FILE *output, int k){
int ch;
k %= 26; //26 indica uma volta completa, logo qualquer k>26 é excessivo
do{
ch = fgetc(input);
if(ch >= 65 && ch <= 90) { //letra maiuscula? (valores de 'A' e 'Z' da tabela ASCII)
ch += k;
if(ch > 90)
@Drowze
Drowze / Compress_individual_files.txt
Created November 3, 2015 11:49
Compress all files in a folder into individual 7z files
FOR %i IN (*.*) DO 7z.exe a -m0=LZMA2 -mmt=x "%~ni.7z" "%i"
where x = number of cores