// main.cpp
import moduleTest;
#include <cstdio>
auto main() -> int
{
View zig_cpp-modules.md
View bl808.zig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const micro = @import("microzig"); | |
const mmio = micro.mmio; | |
pub const devices = struct { | |
/// Bouffalo BL808 chip | |
pub const BL808 = struct { | |
pub const properties = struct { | |
pub const license = | |
\\ | |
\\Copyright (c) 2022 Bouffalo Lab |
View forth.zig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! Tested on Zig v0.10 (stage 1) | |
const std = @import("std"); | |
test "forwarding a value" { | |
const result = forth("value", .{ | |
.value = @as(u32, 42), | |
}); | |
std.testing.expectEqual(@as(u32, 42), result); |
View sample.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <pthread.h> | |
#include <sys/time.h> | |
#include "tb_client.h" | |
///////////////////////////////////////////////////////////////////////////////////// | |
// Place this file at the same folder tb_client.h // | |
// Shows the basic usage of the TigerBeetle C client. // |
View check_cpu_version.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ref: https://unix.stackexchange.com/questions/631217/how-do-i-check-if-my-cpu-supports-x86-64-v2/631226#631226 | |
// by: Matheus Catarino França | |
// License: CC0 | |
#include <fstream> | |
#include <iostream> | |
#include <string> | |
int main() { | |
std::ifstream cpuinfo("/proc/cpuinfo"); |
View client.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "tb_client.hpp" | |
int main() { | |
tb::Client client("localhost", 8080); | |
tb::Account account({0, 0, {0}, 1, 1, TB_ACCOUNT_LINKED, 0, 0, 0, 0, 0}); | |
tb::create_account_result result = client.create_account(account); | |
if (result != TB_CREATE_ACCOUNT_OK) { | |
// Handle error | |
} |
View tlsf.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <cstring> | |
#include <iostream> | |
#include <limits> | |
#include <memory> | |
#include <vector> | |
// The minimum block size is the size of two pointers | |
constexpr size_t MIN_BLOCK_SIZE = 2 * sizeof(void *); |
View asio_ntpclient.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// by: Matheus Catarino França | |
// License: CC0 | |
// NTP timestamp is represented as a 64-bit unsigned integer, | |
// in seconds since January 1, 1900. | |
// NTP packet format: | |
// | |
// 0 1 2 3 | |
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
View asio_libvlc.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// by: Matheus Catarino França | |
// License: CC0 | |
// usage: g++ -o asio_vlc asio_libvlc.cpp $(pkg-config --cflags --libs libvlc) | |
// STANDALONE ASIO | |
#include <asio.hpp> | |
#include <chrono> | |
#include <iostream> | |
#include <vlc/vlc.h> |
View cli_player.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <vlc/vlc.h> | |
int main(int argc, char **argv) | |
{ | |
libvlc_instance_t *inst; | |
libvlc_media_player_t *mp; | |
libvlc_media_t *m; |
NewerOlder