Skip to content

Instantly share code, notes, and snippets.

View yuyoyuppe's full-sized avatar

Andrey Nekrasov yuyoyuppe

  • 12:32 (UTC +02:00)
View GitHub Profile
@yuyoyuppe
yuyoyuppe / onscreen_kb_input_sender.cpp
Last active January 7, 2024 15:50
This application uses Windows On-Screen keyboard to type provided text.
#include <array>
#include <string>
#include <string_view>
#include <format>
#include <cstdio>
#include <cctype>
#include <vector>
#include <filesystem>
#include <windows.h>
$lib_dir = "..."
$symbol = "..."
$jobs = @()
Get-ChildItem -Path $lib_dir -Filter *.lib -Recurse | ForEach-Object {
$lib_path = $_.FullName
# Write-Host "Processing $lib_path..."
$jobs += Start-Job -ScriptBlock {
param($lib_path, $symbol)
@yuyoyuppe
yuyoyuppe / recursive_variant_print.cxx
Last active November 16, 2022 22:50
Recursive variant printer
#include <string>
#include <format>
#include <variant>
#include <cstdio>
#include <regex>
#include <vector>
template <typename T, template <typename...> class Of>
struct is_specialization : std::false_type
{
@yuyoyuppe
yuyoyuppe / Void linux on raspberry Pi.md
Last active November 5, 2022 21:44
Raspberri Pi Void Linux

How to install Void linux on Raspberry Pi from Windows

# Extract .img file somwhere, e.g.: 
cd /mnt/d/Downloads/temp/void-rpi-aarch64-20221001.img/

# expand it by 28GB, so it occupies full 32GB SD card
dd if=/dev/zero bs=10MiB of=void-rpi-aarch64-20221001.img conv=notrunc oflag=append status=progress count=2800
@yuyoyuppe
yuyoyuppe / build_powertoys.cmd
Last active April 12, 2023 11:54
PowerToys-related scripts
if "%1"=="arm64" (
set MSPLATFORM="arm64"
set VCVARS=amd64_arm64
) else (
set MSPLATFORM="x64"
set VCVARS=x86_x64
)
echo "Building PowerToys for %VCVARS% platform!"
class OnExc(object):
def __init__(self, default_val):
self.default_val = default_val
def __call__(self, func):
decorator_self = self
def decorated_func(*args, **kwargs):
try:
return func(*args, **kwargs)
#include <array>
#include <vector>
#include <memory_resource>
#include <iostream>
int main()
{
std::array<char, 24> memory{};
std::pmr::monotonic_buffer_resource arena{data(memory), size(memory), nullptr};
std::pmr::vector<char> v(8, 'A', &arena);
@yuyoyuppe
yuyoyuppe / puzzle_solve.cxx
Created July 31, 2020 12:44
Finds shortest solution for the inverse-the-square puzzle in Heroes of Hammerwatch, lol.
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <span>
#include <string>
#include <optional>
using route_t = std::array<size_t, 9>;
using field_t = std::array<bool, 9>;
var objs = new Set(); // we'll store the object references in this array
function walkTheObject(obj) {
var requiredClass = "MediaStreamTrack";
var keys = {};
try {
keys = Object.keys(obj); // get all own property names of the object
} catch {}
keys.forEach(function (key) {
try {
@yuyoyuppe
yuyoyuppe / HandleTransferChannel.hxx
Last active July 12, 2020 10:35
A simple wrapper class for working with a spin-lock protected shared memory on Windows.
#include "SerializedSharedMemory.h"
class HandleTransferChannel
{
std::optional<HANDLE> _handle;
const DWORD _destination_pid;
public:
HandleTransferChannel(const DWORD destination_pid) noexcept
:_destination_pid{destination_pid}
{