Skip to content

Instantly share code, notes, and snippets.

View 648trindade's full-sized avatar
🏠
Working from home

Rafael Trindade 648trindade

🏠
Working from home
View GitHub Profile
@648trindade
648trindade / MPI_Merge_Sort.md
Last active February 28, 2022 20:42
MPI Merge Sort in C++

MPI Merge Sort in C++

Sort an integer array filled with random numbers, and distributed over MPI nodes.

The maximum array size N for a node must be at least three times smaller than the memory available to the node.

The algorithm is very simple and not optimal:

  • Recursively subdivide node range until we got a single node
  • Sort the subarray on this node
  • Recursively merge arrays from neighbors nodes
@648trindade
648trindade / kd_tree.py
Created March 4, 2020 19:45
KD Tree in Pygame
import pygame, random
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
class Kd_tree:
class Axis:
@648trindade
648trindade / GGJScrapper.py
Created January 29, 2019 06:03
GGJ 2019 Scrapper
from bs4 import BeautifulSoup
from requests import get
from multiprocessing import Pool
from timeit import default_timer as timer
import csv
countries = (("AF", "Afghanistan"), ("AX", "Aland Islands"), ("AL", "Albania"), ("DZ", "Algeria"), ("AS", "American Samoa"), ("AD", "Andorra"), ("AO", "Angola"), ("AI", "Anguilla"), ("AQ", "Antarctica"), ("AG", "Antigua and Barbuda"), ("AR", "Argentina"), ("AM", "Armenia"), ("AW", "Aruba"), ("AU", "Australia"), ("AT", "Austria"), ("AZ", "Azerbaijan"), ("BS", "Bahamas"), ("BH", "Bahrain"), ("BD", "Bangladesh"), ("BB", "Barbados"), ("BY", "Belarus"), ("BE", "Belgium"), ("BZ", "Belize"), ("BJ", "Benin"), ("BM", "Bermuda"), ("BT", "Bhutan"), ("BO", "Bolivia"), ("BA", "Bosnia and Herzegovina"), ("BW", "Botswana"), ("BV", "Bouvet Island"), ("BR", "Brazil"), ("IO", "British Indian Ocean Territory"), ("VG", "British Virgin Islands"), ("BN", "Brunei"), ("BG", "Bulgaria"), ("BF", "Burkina Faso"), ("BI", "Burundi"), ("KH", "Cambodia"), ("CM", "Cameroon"), ("CA", "Canada"), ("CV",
@648trindade
648trindade / googlenet.prototxt
Created April 26, 2018 08:11
googlenet prototxt
name: "GoogleNet"
layer {
name: "data"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
@648trindade
648trindade / cifar10.prototxt
Created April 24, 2018 17:06
cifar10 caffe
name: "CIFAR10_quick"
layer {
name: "cifar"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
@648trindade
648trindade / eduroam.config
Created August 24, 2017 14:22
UFSM eduroam network configuration file for systems with connman
# Rafael Gauna Trindade - 24/08/17
# save this as /var/lib/connman/eduroam.config
[service_eduroam]
Type=wifi
Name=eduroam
EAP=ttls
Phase2=PAP
# replace XXXXXXXXXXX by your CPF number
[email protected]
@648trindade
648trindade / PyGameOfLife.py
Created November 5, 2016 20:12
PygGame Of Life
import pygame
from pygame import gfxdraw
pygame.init()
size = (800,600)
display = pygame.display.set_mode(size)
surface = [None, None]
surface[0] = pygame.Surface((size[0]/10, size[1]/10))
surface[1] = pygame.Surface((size[0]/10, size[1]/10))
@648trindade
648trindade / pokemons.pl
Last active July 4, 2016 18:37
Base de conhecimento prolog sobre pokemons
grass(bulbasaur).
grass(ivysaur).
grass(venusaur).
grass(oddish).
grass(gloom).
grass(vileplume).
grass(paras).
grass(parasect).
grass(bellsprout).
grass(weepinbell).
@648trindade
648trindade / stats-obi.py
Created June 4, 2016 21:51
Scripts para consultas em lote ao sistema de certificados da Olimpiada Brasileira de Informatica
#!/usr/bin/python3
# Script para consultas em lote ao sistema de certificados da Olimpiada Brasileira de Informatica
# http://olimpiada.ic.unicamp.br/
# Obs.: Emissao de certificados inicia em 2005 (OBI iniciou em 1999)
# Adaptado da versão original em bash escrito pela prof. Andrea
# Dependencias: python3-requests
# Author: Rafael
import requests
@648trindade
648trindade / DBFileGenerator.py
Last active September 21, 2022 21:01
Python script to convert the text file that is inside the compressed .bak project file from software Magic Set Editor to a .db sqlite3 file. Please read the comments to custom it your way
#!/usr/bin/python3
"""
The MIT License (MIT)
Copyright (c) 2016 Rafael Gauna Trindade
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions: