Skip to content

Instantly share code, notes, and snippets.

View kachsheev's full-sized avatar
💩

Anton Kashcheev kachsheev

💩
  • Tashkent, Uzbekistan
View GitHub Profile
@kachsheev
kachsheev / main.cpp
Created December 28, 2023 19:37 — forked from ForNeVeR/main.cpp
"ЩИ!!!Симулятор жестокости" - http://www.gamedev.ru/projects/forum/?id=160897
#define WIN32_LEAN_AND_MEAN // just say no to MFC
#define INIT_GUID
#include "hge.h"
#include <hgesprite.h>
#include <hgefont.h>
#include <hgecolor.h>

ZeroTier настройка

База

Репозиторий

После сборки появляется три бинаря:

  • zerotier-cli -- утилитка для подключения
  • zerotier-idtool -- генерилка ключиков
@kachsheev
kachsheev / SharedMemorySample_read_main.cpp
Last active March 15, 2023 19:03 — forked from yoggy/SharedMemorySample_read_main.cpp
SharedMemory Sample for WIN32
#include <SDKDDKVer.h>
#include <Windows.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
int shmem_size = 16; // 16byte
HANDLE shmem = INVALID_HANDLE_VALUE;
HANDLE mutex = INVALID_HANDLE_VALUE;
@kachsheev
kachsheev / Source.cpp
Created February 14, 2023 22:00 — forked from AngelicosPhosphoros/Source.cpp
Example of OVERLAPPED IO using WinAPI
#include <atomic>
#include <cassert>
#include <iostream>
#include <list>
#include <memory>
#include <mutex>
#include <optional>
#include <thread>
#include <vector>
@kachsheev
kachsheev / main.cpp
Created January 10, 2023 18:48 — forked from sunmeat/main.cpp
client server UDP C++ example
CLIENT SIDE:
#include <iostream>
#include <winsock2.h>
using namespace std;
#pragma comment(lib,"ws2_32.lib")
#pragma warning(disable:4996)
#define SERVER "127.0.0.1" // or "localhost" - ip address of UDP server
@kachsheev
kachsheev / RandomSequence.h
Created April 28, 2021 19:50
WinAPI Generate Random class
// From stackoverflow: https://stackoverflow.com/a/21429737
#include <wincrypt.h>
class RandomSequence
{
HCRYPTPROV hProvider;
public:
RandomSequence(void) : hProvider(NULL) {
if (FALSE == CryptAcquireContext(&hProvider, NULL, NULL, PROV_RSA_FULL, 0)) {
@kachsheev
kachsheev / command_pattern.c
Last active December 10, 2020 14:13
Pure C command pattern
#include "command_pattern.h"
/** private **/
static int executorRun(ExecutorPtr executor)
{
return executor->command->run(executor->command, executor->invoker);
}
static Executor executionContextInit(InvokerPtr invoker, CommandPtr command)
@kachsheev
kachsheev / CommandPattern.hpp
Last active June 25, 2020 12:30
CommandPattern.hpp
#ifndef COMMAND_PATTERN_HPP
#define COMMAND_PATTERN_HPP
// declaration
namespace command
{
///
/// \brief The Invoker class
@kachsheev
kachsheev / main.cpp
Created December 24, 2019 14:49
Global boost::string_view
#include <iostream>
#include <boost/utility/string_view.hpp>
const boost::string_view globalView = "123";
int main()
{
std::cout << globalView << std::endl; // 123
return 0;
}
#include <utility>
namespace stdext
{
namespace details
{
template<typename T, T... elems>
struct is_element_of_sequence_impl