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
#pragma once | |
#include <algorithm> | |
#include <cassert> | |
#include <cstddef> | |
#include <cstdint> | |
#include <cstdio> | |
#include <cstring> | |
#include <filesystem> | |
#include <string> |
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
//////////////////////////////////////////////////////////// | |
// Vector 2D | |
template <typename T> | |
struct Vec2T { | |
constexpr Vec2T() = default; | |
constexpr Vec2T(T v) : x(v), y(v) {} | |
constexpr Vec2T(T x, T y) : x(x), y(y) {} | |
constexpr Vec2T(const Vec2T&) = default; |
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
cmake_minimum_required(VERSION 3.25) | |
project(sdlinputtest LANGUAGES CXX) | |
find_package(SDL2 REQUIRED) | |
add_executable(sdlinputtest sdlinputtest.cpp) | |
target_link_libraries(sdlinputtest PRIVATE SDL2::SDL2 SDL2::SDL2main) | |
if(WIN32) | |
add_custom_command(TARGET sdlinputtest POST_BUILD |
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
import subprocess | |
import sys | |
from asyncio import Future | |
from contextlib import contextmanager | |
@contextmanager | |
def ParallelSh(): | |
""" |
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
void copyOver(std::ofstream& dst, std::ifstream& src, std::uint64_t length) | |
{ | |
// This seems to be broken, we are skipping bytes at some point. Apparently | |
// istream_iterator shouldn't be used for binary files, despite the | |
// underlying stream being opened in binary mode. istreambuf_iterator was | |
// suggested, but is not applicable here as it fills an internal buffer with | |
// more than we read and therefore advances the file cursor too far. | |
// | |
// std::copy_n(std::istream_iterator<uint8_t>(src), length, | |
// std::ostream_iterator<uint8_t>(dst)); |
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
from datetime import datetime | |
from typing import List | |
class DatetimeInterval: | |
def __init__(self, start, end): | |
self.start = start | |
self.end = end | |
def __lt__(self, other): |
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
#pragma once | |
#include <cassert> | |
#include <map> | |
#include <memory> | |
#include <utility> | |
template <class L, class R, class CompareLeft = std::less<L>, class CompareRight = std::less<R>, | |
class AllocatorLeft = std::allocator<std::pair<const L, const R *>>, | |
class AllocatorRight = std::allocator<std::pair<const R, const L *>>> |
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
--- | |
Language: Cpp | |
BasedOnStyle: LLVM | |
ColumnLimit: 120 | |
IndentWidth: 4 | |
Standard: Latest | |
TabWidth: 4 | |
UseTab: ForIndentation | |
AlignEscapedNewlines: Left |
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
#!/bin/bash | |
readonly payload='\ | |
foo abc xyz | |
bar def uvw' | |
while read one two three ; do | |
echo $one : $two : $three | |
done <<< $payload |
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
// Instructions: | |
// 1) Add NuGet: glfw-net | |
// 2) Download official GLFW DLL (pre-compiled): https://www.glfw.org/download.html | |
// 3) Copy DLL to $(TargetDir) so it can be loaded | |
// 4) Rename DLL to glfw.dll | |
using GLFW; | |
using System; | |
using System.Threading; |
NewerOlder