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 <Windows.h> | |
#include <websocket.h> | |
#include <iostream> | |
#include <winerror.h> | |
ULONG RecieveBuffer = 4096; | |
ULONG SendBuffer = 4096; | |
BOOL DisableMasking = false; // by default, this is not used. try disabling it first | |
BOOL DisableUTF8Verification = false; |
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 <string> | |
#include <regex> | |
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
#include <sstream> | |
#include <chrono> | |
#include <assert.h> | |
using namespace std; | |
using Splits = vector<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
#include <Windows.h> | |
#include <stdexcept> | |
#include <string> | |
#include <memory> | |
#include <vector> | |
#include <chrono> | |
#include <thread> | |
#include <iostream> | |
class TimerQueue |
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 | |
/* an exeption object that gets the error message for windows error codes. */ | |
/* default constructor will get the error code from windows, alternativly you can provide the error code. */ | |
/* exmple: | |
#include "win32exception.h" | |
#include <iostream> | |
int main() | |
{ | |
try |
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 <vector> | |
#include <iostream> | |
#include <algorithm> | |
constexpr auto iterateVectors = [](auto...vectors) | |
{ | |
constexpr auto getSmallestVector = [](auto...vectors) | |
{ | |
size_t end{ reinterpret_cast<size_t>(std::numeric_limits<size_t>::max) }; | |
((end = std::min(vectors.size(), end)), ...); |
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
template<typename...Args> | |
std::string concat(Args...args) | |
{ | |
std::stringstream stream; | |
((stream << args), ...); | |
return std::move(stream.str()); | |
} | |
int main() | |
{ |
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 <iostream> | |
#include <format> | |
#include <iterator> | |
class Thing | |
{ | |
public: | |
std::string s{ "some text" }; | |
}; |
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
adding Handle.exe to the context menu: | |
Computer\HKEY_CLASSES_ROOT\Directory\shell\runas | |
HasLUASHield = "" | |
MUIVerb = "Query open handles" | |
Computer\HKEY_CLASSES_ROOT\Directory\shell\runas\Command | |
Default="powershell.exe -noexit -command handle.exe -u '%V'" | |
Computer\HKEY_CLASSES_ROOT\Directory\Background\shell\runas | |
HasLUASHield = "" |
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
std::format is a nice simple way to do string interpolation in c++ | |
std::format("hello, {}!", "World); would print "`hello, World!`" for example. | |
I wanted to learn to create my own formatters so i could provide custom objects and have them printed nicely by just providing | |
it. There is not currently much documentation on the subject, but i managed to make it happen however one problem is the | |
std::formatter implementations will only take values, not references which means either you pass std::format a pointer to your object or | |
you allow it to take copies of your object. | |
## What if you dont want std::format to copy your object | |
Either you can define a formatter for a pointer of your object, or you can copy the code in this gist. |
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 "SomeClass.h" | |
#include <iostream> | |
// implementation | |
void SomeClass::doSomething() | |
{ | |
std::cout << "doing saomething" << std::endl; | |
} | |
int SomeClass::addTen(int from) |
OlderNewer