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 / Dockerfile
Last active October 3, 2023 11:42
[draft] Qt6 + KF6 for windows/mingw
# Image: stateoftheartio/qt6:6.5-mingw-aqt
FROM stateoftheartio/qt6:6.5-mingw-aqt
ARG ECM_DIR=${QT_PATH}\\share\\ECM
ENV DEBIAN_FRONTEND=noninteractive \
DEBCONF_NONINTERACTIVE_SEEN=true \
QT_PATH=${QT_PATH} \
ECM_DIR=${ECM_DIR} \
WINEDEBUG=-all
@kassane
kassane / sleepsort-asio.cpp
Last active November 19, 2023 14:23
slsort C++
#include <iostream>
#include <chrono>
#include <array>
#include <thread>
#include <asio/thread_pool.hpp>
#include <asio/post.hpp>
void sleepSort(const std::array<int,8>& numbers) {
asio::thread_pool pool(numbers.size());
for (const auto& num : numbers) {
@kassane
kassane / sleepsort.zig
Last active June 17, 2023 11:54
Sleepsort algorithm on Zig language
//! Zig version: 0.11.0 (std.Thread.Pool)
const std = @import("std");
pub fn main() !void {
std.debug.print("Sleep sorting\n", .{});
const values = [_]usize{ 9, 40, 10, 1, 6, 45, 23, 50 };
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
const allocator = arena.allocator();
defer arena.deinit();
@kassane
kassane / tb_client.d
Last active October 29, 2023 16:40
[Draft] TigerBeetle Client - Pascal binding
@nogc nothrow:
extern(C): __gshared:
//////////////////////////////////////////////////////////
// This file was auto-generated by tb_client_header.zig //
// Do not manually modify. //
//////////////////////////////////////////////////////////
import core.stdc.stdint;
import core.int128;
@kassane
kassane / nfe_xml.md
Last active May 10, 2023 19:48
Zig XML parser to NFe

Some tests

Need: https://github.com/kassane/xml (forked: updated to zig 0.11)

nfe_sample.xml
<?xml version="1.0" encoding="UTF-8"?>
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
{
"items": [
{
"sigla": "STF",
"nome": "Supremo Tribunal Federal",
"busca_processo": 1,
"busca_nome": 1,
"busca_oab": 0,
"disponivel_autos": 0,
"busca_documento": 0,
@kassane
kassane / RustToZigTargets.zig
Created April 27, 2023 14:37
Targets compare: Rust to Zig
//! ref: https://github.com/TwoClocks/repr-c/blob/arocc-test-gen/repc/arocc/RustToZigTargets.zig
//! updated to v0.11.0
// at attemp to convert between rust and zig targets.
// rustc must be in the path.
// compile with `zig build-exe RustToZigTgarets.zig
const std = @import("std");
const CrossTarget = std.zig.CrossTarget;
var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};
@kassane
kassane / adapton.c
Last active April 16, 2023 15:19
Adapton programming model & Lazy evaluation - int values
// Reference: http://plum-umd.github.io/adapton/
#include <stdio.h>
#include <stdlib.h>
typedef struct Adapton_Int {
int value;
int (*compute)(struct Adapton_Int *, struct Adapton_Int *);
struct Adapton_Int *arg1;
struct Adapton_Int *arg2;
@kassane
kassane / zig_cpp-modules.md
Last active October 6, 2023 19:41
Zig/clang++ (C++20) modules
// main.cpp

import moduleTest;

#include <cstdio>

auto main() -> int
{