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
mmozeiko / aes.py
Last active Aug 29, 2015
AES in Python
View aes.py
from __future__ import print_function
import sys
import struct
rcon = [ \
0x01000000, 0x02000000, 0x04000000, 0x08000000,
0x10000000, 0x20000000, 0x40000000, 0x80000000,
0x1b000000, 0x36000000,
]
@mmozeiko
mmozeiko / lz4.py
Created Jul 26, 2014
lz4 decompression in Python 2.x
View lz4.py
# Warning: this implementation doesn't check if writes or reads will happen
# out of input/output buffer range, so that will generate IndexError exception
def LZ4_decompress(source, osize):
isize = len(source)
src = bytearray(source)
dst = bytearray(osize)
si = 0
View ScopeGuard11.h
#pragma once
template <class Fun>
class ScopeGuard
{
private:
Fun f;
bool active;
public:
View Expected.h
#pragma once
#include <exception>
#include <stdexcept>
#include <utility>
template <class T>
class Expected
{
public:
View ipviking.cs
using Microsoft.Win32;
using System;
using System.Drawing;
using System.Windows.Forms;
class ipviking
{
class ScreenSaver : Form
{
public ScreenSaver(Rectangle bounds)
@mmozeiko
mmozeiko / win32_crt_float.cpp
Last active Jun 30, 2019
Visual C/C++ CRT functionality
View win32_crt_float.cpp
extern "C"
{
int _fltused;
#ifdef _M_IX86 // following functions are needed only for 32-bit architecture
__declspec(naked) void _ftol2()
{
__asm
{
@mmozeiko
mmozeiko / win32_handmade.cpp
Created Dec 13, 2014
win32_handmade.cpp with WASAPI from Day 19
View win32_handmade.cpp
/* ========================================================================
$File: $
$Date: $
$Revision: $
$Creator: Casey Muratori $
$Notice: (C) Copyright 2014 by Molly Rocket, Inc. All Rights Reserved. $
======================================================================== */
/*
TODO(casey): THIS IS NOT A FINAL PLATFORM LAYER!!!
@mmozeiko
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
You can’t perform that action at this time.