Skip to content

Instantly share code, notes, and snippets.

@thaolt
thaolt / number_format.c
Last active September 6, 2024 08:11
Number format for thousand separators in C programming language
#include <stdio.h>
#include <stdint.h>
/**
* @brief Format a number in the format of 123.456.789
*
* @param[out] outbuf output buffer
* @param[in/out] outcaplen output buffer capacity + return length
* @param[in] num number to format
* @param[in] thousep thousands separator
@thaolt
thaolt / build.zig
Last active March 16, 2024 08:32
Zig mongoose ws simple http server example
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "http_server",
.root_source_file = .{ .path = "src/main.zig" },
@thaolt
thaolt / base85.c
Created June 6, 2023 15:34
base85 encode and decode in pure C
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
uint8_t _b85alphabet[85] = ("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~");
char *_b85chars = NULL;
var config = {
baseBet: { label: "base bet", value: 0.00000006, type: "number" },
payout: { label: "payout", value: 3, type: "number" },
stop: { label: "stop if next bet >", value: 34, type: "number" },
wagerBet: { label: "wager bet", value: '0.00000006', type: "number" },
};
function main() {
var currentBet = config.baseBet.value;
var bet = currentBet + config.wagerBet.value;
var losses = 0;
/**
* BC Game' Classic Dice Automation Script Template
* Tác giả: github.com/thaolt
*
* Đọc kỹ trước khi sử dụng
*
* - Script này là gì? là mẫu script với mục đích giúp người chơi Classic Dice tại BCGame hiện thực
* chiến thuật của mình bằng javascript. Dùng trực tiếp sẽ không có tác dụng gì.
* - Tác giả không có bất kỳ trách nhiệm nào với bất kỳ mất mát trong việc người chơi sử dụng script
* - Hãy chơi có trách nhiệm. Cờ bạc luôn luôn là cờ bạc. Chỉ cược những gì bạn có thể thua
const maxes = [4,4,5,5,5,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,9,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,15,15,15,15,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,18,18,18,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,41,41,41,41,41,42,42,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,6
@thaolt
thaolt / attiny_usi_uart.ino
Created January 26, 2021 14:59
Simple ATtiny USI UART
/* ATtiny85 USI UART v2
David Johnson-Davies - www.technoblogy.com - 3rd May 2015
ATtiny85 @ 8MHz (external crystal; BOD disabled)
CC BY 4.0
Licensed under a Creative Commons Attribution 4.0 International license:
http://creativecommons.org/licenses/by/4.0/
*/
#ifndef RFIDREADER_H
#define RFIDREADER_H
#include <QObject>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QFuture>
class RFIDReader : public QObject
{