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 4, 2019
switch vs computed goto
View test.c
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#define HALT 0
#define LOAD 1
#define INC 2
#define DEC 3
#define ADD_7 4
#define SUB_7 5
mmozeiko / crt.cpp
Created Jan 16, 2017
MSVC CRT startup
View crt.cpp
#include <windows.h>
extern "C"
#pragma section(".CRT$XIA",long,read)
#pragma section(".CRT$XIZ",long,read)
#pragma section(".CRT$XCA",long,read)
#pragma section(".CRT$XCZ",long,read)
#pragma section(".CRT$XPA",long,read)
#pragma section(".CRT$XPZ",long,read)
mmozeiko / test.cpp
Created Aug 2, 2015
Testing performance
View test.cpp
#include <stdint.h>
#include <stdio.h>
#if _WIN32
#include <intrin.h>
#include <unistd.h>
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 / MemSpeed.cpp
Created Dec 21, 2014
Memory copy benchmark
View MemSpeed.cpp
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <xmmintrin.h> // SSE
#include <immintrin.h> // AVX
#ifdef _WIN32
#include <intrin.h> // for __movsb, __movsd, __movsq
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 / 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 / overlapped_named_pipe.cpp
Last active Jan 22, 2019
Example how to use read-only named pipes with single client in non-blocking way on single thread
View overlapped_named_pipe.cpp
#include <windows.h>
#include <stdio.h>
#include <assert.h> // for potential error handling, change to real errors in your code
int main()
HANDLE pipe = CreateNamedPipeW(
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];
You can’t perform that action at this time.