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 / HostLibs.rs
Last active September 28, 2018 16:35
Shared Library Others to Rust - FFI
//Dir: project/target/deps/libname.ext <- your custom lib
#[link(name = "libname"/*,kind = "static" or kind = "framework"*/)]
extern "C" {
fn fib(n: i64) -> i64; //both libs
fn MySucc(AVal: i64) -> i64; //libmath test only!
fn MyPred(AVal: i64) -> i64; //libmath test only!
}
fn main()
@kassane
kassane / Event_Loop.md
Created April 6, 2019 14:26
Explain Event Loop

Event Loop

In computer science, the event loop, message dispatcher, message loop, message pump, or run loop is a programming construct that waits for and dispatches events or messages in a program.

It works by making a request to some internal or external "event provider" (that generally blocks the request until an event has arrived), and then it calls the relevant event handler ("dispatches the event").

The event-loop may be used in conjunction with a reactor, if the event provider follows the file interface, which can be selected or 'polled' (the Unix system call, not actual polling).

The event loop almost always operates asynchronously with the message originator.

@kassane
kassane / .bashrc
Last active May 28, 2020 19:33
vscode-win with msys2-bash added
export PATH=$PATH:/c/msys64/mingw64/bin
if [ ! -z "$MSVSCODE" ]; then
unset MSVSCODE
source /etc/profile
cd $OLDPWD
fi
@kassane
kassane / program_shell.reg
Last active February 23, 2020 17:47
Tornar seu app shell inicializavel
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\program] ;or [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\program]
@="Message Here"
"Icon"="%Progra~1%\\Program_Dir\\MyIcon.ico"
[HKEY_CLASSES_ROOT\Directory\Background\shell\program\command] ;or [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\program\command]
@="\"%Progra~1%\\Program_Dir\\MyApp.exe\" \"%v.\""
;Inspirado n projeto: https://github.com/gabrielfroes/photo-organizer.git
@kassane
kassane / myproject.sublime-project
Created September 7, 2019 17:28
CMakeBuilder (sublime pack) default project
{
"cmake":
{
"build_folder": "${project_path}/build"
},
"folders":
[
{
"path": "."
}
@kassane
kassane / Deploy_qt.pro
Last active October 13, 2019 14:54
Qmake deploy
isEmpty(TARGET_EXT) {
win32 {
TARGET_CUSTOM_EXT = .exe
}
} else {
TARGET_CUSTOM_EXT = $${TARGET_EXT}
}
win32 {
DEPLOY_COMMAND = windeployqt
@kassane
kassane / firmware-detect.sh
Created October 15, 2019 15:03
Firmware Detector
#!/bin/bash
# Find IOMMU Groups
for d in /sys/kernel/iommu_groups/*/devices/*; do
n=${d#*/iommu_groups/*}; n=${n%%/*}
printf 'IOMMU Group %s ' "$n"
lspci -nns "${d##*/}"
done
# Did this PC boot in UEFI or BIOS?
[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS
# Find if CPU is 64-bit
#!/bin/bash
## A script to install Funtoo Linux on a computer.
####---------------------------------------------####
export PS1="(chroot) $PS1"
echo Downloading the portage tree...
ego sync
emerge --sync
@kassane
kassane / CMakeLists.txt
Last active February 12, 2020 12:35
Qt5 for Windows - deploy
cmake_minimum_required(VERSION 3.15)
project(MeuProjeto VERSION 1.0 LANGUAGES CXX)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "C:/Users/B40141/Documents/QtProjects/Deploy" CACHE PATH "..." FORCE)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@kassane
kassane / PQDBConn.h
Created February 23, 2020 17:34
Libpq Async
#pragma once
#include <libpq-fe.h>
#include <experimental/string_view>
#include "PQQuery.h"
#include "PQError.h"
#include <tuple>