// main.cpp
import moduleTest;
#include <cstdio>
auto main() -> int
{
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
// 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; |
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); |
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"); |
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 | |
} |
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 *); |
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 |
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> |
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> | |
#if defined(_WIN32) || defined(_WIN64) | |
#include <Windows.h> | |
#else | |
#include <unistd.h> | |
#endif | |
int main(int argc, char **argv) |
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
//! libp11 is a library that provides an implementation of the PKCS#11 standard. | |
//! It allows software developers to access and use cryptographic tokens that are compliant with the PKCS#11 standard, | |
//! without having to implement the PKCS#11 interface themselves. libp11 is written in C and is available as open-source software. | |
//! To use libp11, a software developer would typically include the libp11 header file in their source code and link their program | |
//! with the libp11 library. The developer would then use the functions and data structures provided by libp11 to access and | |
//! manage the cryptographic functions and keys on the token. | |
//! Here is an example of how libp11 could be used to encrypt a message using a cryptographic token: | |
const libp11 = @import("libp11"); |