Skip to content

Instantly share code, notes, and snippets.

Mārtiņš Možeiko mmozeiko

  • San Jose, CA
Block or report user

Report or block mmozeiko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mmozeiko / test.c
Last active Jun 22, 2019
View test.c
#include <windows.h>
#include <stdio.h>
LRESULT CALLBACK WindowProc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
if (msg == WM_TIMER)
printf("press SPACE now\n");
DWORD tid = GetWindowThreadProcessId(wnd, NULL);
mmozeiko / ods.c
Created Apr 16, 2019
Example how to capture OutputDebugString on Windows
View ods.c
#include <windows.h>
#include <intrin.h>
#define Assert(x) do { if (!(x)) __debugbreak(); } while (0)
static struct
DWORD process_id;
char data[4096 - sizeof(DWORD)];
}* ods_buffer;
mmozeiko / main.cpp
Created Feb 13, 2019
Windows drag & drop example
View main.cpp
Minimal Drag and Drop Application for Windows
Copright (C) Alexandre LHUILLIER - 2019
This application creates an application window and a console window.
Whenever you drag a file or a set of files from the Windows explorer
to the application window, the absolute paths of the dropped files
are printed in the console window.
mmozeiko /
Created Feb 9, 2019
Python script that converts .unitypackage file to .zip archive
#!/usr/bin/env python3
import sys
import tarfile
import zipfile
from pathlib import Path
src = sys.argv[1]
dst = Path(src).name + ".zip"
mmozeiko / go_aeshash.h
Created Nov 14, 2018
Go's AES-NI based hash
View go_aeshash.h
#include <stddef.h>
#include <stdint.h>
#include <intrin.h>
// see aeshashbody in
// this is initialized on process startup with random from system
static __declspec(align(16)) uint8_t aeskeysched[128];
static __declspec(align(16)) const uint8_t masks[16][16] =
mmozeiko / meow_hash_bench.c
Last active Oct 28, 2018
Meow hash in generic C (v0.2)
View meow_hash_bench.c
#ifdef _MSC_VER
#define MEOW_API static __declspec(noinline)
#include <intrin.h>
// assume clang
#define MEOW_API static __attribute__((noinline))
#define __rdtsc __builtin_readcyclecounter
#include "meow_hash_c.h"
mmozeiko / meow_hash_armv8.h
Last active Oct 27, 2018
Meow hash for ARMv8 (v0.2)
View meow_hash_armv8.h
/* ========================================================================
Meow - A Fast Non-cryptographic Hash for Large Data Sizes
(C) Copyright 2018 by Molly Rocket, Inc. (
See for details.
zlib License
mmozeiko / dwrite.cpp
Created Jul 25, 2018
DirectWrite without D2D
View dwrite.cpp
#include <windows.h>
#include <dwrite.h>
#include <intrin.h>
#pragma comment (lib, "gdi32.lib")
#pragma comment (lib, "user32.lib")
#pragma comment (lib, "dwrite.lib")
#define CHECK(x) do { if (!(x)) __debugbreak(); } while (0)
mmozeiko / icop_test.c
Last active Dec 24, 2018
Trying out wait on IOCP handle & messages ** WARNING** works only on Windows 10
View icop_test.c
#include <windows.h>
#include <stdio.h>
#include <stdarg.h>
static LARGE_INTEGER start;
static LARGE_INTEGER freq;
static void LOG(const char* thread, const char* format, ...)
char message[1024];
mmozeiko / floor.c
Last active Jun 18, 2018
various floor functions with SSE1 or SSE2
View floor.c
// various SSE1 and SSE2 floor function for float
// assumes only normal input values
// does not handle NAN or INF - they may or may not work
// only guarantee is that 0, subnormal or normal float values will work
#include <emmintrin.h>
#ifdef _MSC_VER
#include <intrin.h>
#define NOINLINE __declspec(noinline)
You can’t perform that action at this time.