Skip to content

Instantly share code, notes, and snippets.

@Kiterai
Kiterai / gridfs_seek.cpp
Created May 14, 2024 12:47
test for mongodb gridfs with seek
#include <cassert>
#include <cstdint>
#include <iostream>
#include <random>
#include <vector>
#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/json.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>
@Kiterai
Kiterai / draw.c
Last active January 25, 2024 13:37
syncronous world clock(WIP)
#include <math.h>
#include "GUI_Paint.h"
#include "utils.h"
#include "world.h"
#define SCALE_L1 105
#define SCALE_L2 120
#define DISPLAY_CENTERX 120
#define DISPLAY_CENTERY 120
@Kiterai
Kiterai / main.c
Last active January 24, 2024 03:35
practice code for Waveshare RP2040-LCD-1.28
// based on demo code https://www.waveshare.com/wiki/RP2040-LCD-1.28#Demo
#include "DEV_Config.h"
#include "GUI_Paint.h"
#include "LCD_1in28.h"
#include <stdio.h>
uint16_t gen_rgb565(uint16_t r, uint16_t g, uint16_t b) {
uint16_t code = 0;
code |= (r & 0b11111);
#include <filesystem>
#include <fstream>
#include <iostream>
#include <random>
#include <vulkan/vulkan.hpp>
struct Param {
uint32_t matAH;
uint32_t matAWBH;
uint32_t matBW;
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image.h"
#include "stb_image_write.h"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <vulkan/vulkan.hpp>
#include <filesystem>
#include <fstream>
#include <iostream>
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#include <vulkan/vulkan.hpp>
#include <fstream>
#include <filesystem>
#include <iostream>
#include <vector>
const uint32_t screenWidth = 640;
const uint32_t screenHeight = 480;
@Kiterai
Kiterai / RealTimeStylus.cpp
Created September 2, 2023 11:00
windows RealTimeStylus demo
//
// Write by Kiterai 2023
// https://chaosplant.tech/tech-notes/page50
//
// This source code is licensed under CC0
// http://creativecommons.org/publicdomain/zero/1.0/deed.ja
//
#include <windows.h>
#include <ole2.h>
@Kiterai
Kiterai / CMakeLists.txt
Last active August 31, 2023 15:16
windows RealTimeStylus input
cmake_minimum_required(VERSION 3.7)
project(stylus_test)
add_executable(test main.cpp)
find_package(SDL2 CONFIG REQUIRED)
target_link_libraries(test
PRIVATE
$<TARGET_NAME_IF_EXISTS:SDL2::SDL2main>
$<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
@Kiterai
Kiterai / stdsort.cpp
Last active May 14, 2020 17:00
64bitのUbuntuでppa:ubuntu-toolchain-r/testリポジトリからインストールしたGCC9.xで-O2にするとstd::sortの処理結果がおかしくなる
#include <iostream>
#include <algorithm>
using namespace std;
struct A
{
long long a, b;
};
const int len = 10;
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
#define rep(i,n) for(lint i = 0; i < n; i++)
#define repr(i,n) for(lint i = n - 1; i >= 0; i--)
#define repb(i,start,end) for(lint i = start; i <= end; i++)