Skip to content

Instantly share code, notes, and snippets.

View kassane's full-sized avatar
🏠
Working from home

Matheus C. França kassane

🏠
Working from home
View GitHub Profile
@kassane
kassane / multithread_cpp.cpp
Last active April 1, 2018 16:40
Multithread C++ Modern
/*
*****************************************************************
* THREADING - CHAPTER 1
*****************************************************************
*/
#include <chrono>
#include <iostream>
#include <memory>
#include <mutex>
@kassane
kassane / NanaProject.pro
Created June 22, 2018 15:52
Build Nana Library on QMake
######################################################################
# Automatically generated by qmake (3.1) Fri Jun 22 12:31:36 2018
######################################################################
#TEMPLATE = app
QT -= gui core
TARGET = HelloWorld
CONFIG += c++17
@kassane
kassane / boost.python_compiler.py
Created June 25, 2018 17:44
buiding boost.python3 extension
from os import system
from sys import argv
def Compile(arg):
#{arg:2} => remove directory ex: C:\ ou ./
arg = arg.replace('.cpp','') #remove extension file
print('Compiling source code to object code:')
system(f'g++ -std=gnu++2a -c -fPIC {arg:2}.cpp -I /usr/include/python3.6m/')
print('Liking object code to machine code [Dynamic library]:|')
system(f'gcc -shared {arg:2}.o -L /usr/lib/python3.6/ -lboost_system -lboost_python3 -lpython3.6m -o {arg:2}.so')
@kassane
kassane / juros_simples.py
Last active July 30, 2019 12:15
Calculando juros simples no Python 3
'''
_____________________________________________________________________________
| Juros Simples (PV=Valor Presente, FV=Valor Futuro, tax=%, men=mensalidade |
-----------------------------------------------------------------------------
'''
from math import pow
def PV(tax, men):
return pow(tax/100 + 1, men)
@kassane
kassane / juros_composto.py
Created July 7, 2018 15:53
Juros Composto em python 3
'''
A fórmula para calcular o valor final de juros compostos (compound interest) é mostrada na Wikipedia como
A = P(1 + r/n)^nt
Onde:
A = Valor Futuro
P = Valor Presente
r = taxa de juros anual nominal
n = número de vezes que o juro é capitalizado por ano
@kassane
kassane / Beginner.rs
Last active December 4, 2018 13:54
Getting Start - Rust Language Programming
#![allow(non_snake_case)] //permitir palavras sem Snake_Case
#![allow(dead_code)] //permitir código inútil
enum Direction
{
Subir,
Descer,
Esquerda,
Direita
}
@kassane
kassane / downloader_list.py
Last active July 25, 2018 18:37
Simple youtube downloader
'''
DOWNLOADER LIST - Requires YOUTUBE-DL (Python 3.6.x)
Date: 07/25/2018
@author: Kassany
'''
from os import system
def download(videos):
@kassane
kassane / float_vector.c
Created July 29, 2018 14:17
Simple float Vector in C
/**
MEMORY MANAGER IN C LANGUAGE
@author: Kassane
Date: 07/29/2018
*/
#include <stdio.h>
#include <stdlib.h>
struct Vector
@kassane
kassane / Qt_for_Windows.md
Last active April 2, 2019 17:44
Qt for Windows

Qt for Windows

Qual a diferença do Instalador Oficial entre o online/offline?

R = Obviamente o on necessita de internet durante a instalação do início ao fim. E o off necessita de um teste de conexão durante a tela de login do instalador, mas a instalação em si é offline.

@kassane
kassane / Program.cpp
Last active August 11, 2019 20:10
DynamicLibrary in Rust to Others Languages - FFI
#include <iostream>
#include <thread>
#include <mutex>
#include <chrono>
#include <cstdint>
std::mutex m;
extern "C" uint64_t fib2(uint64_t n); //rust
uint64_t fib(uint64_t n); //C++