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 / gist:8770c6d35f67fdab9c7c
Last active Aug 29, 2015
https://gist.github.com/rygorous/c6831e60f5366569d2e9 with MinGW 4.9.2 (-fno-exceptions -msse2 -mfpmath=sse -O3 -ffast-math)
View gist:8770c6d35f67fdab9c7c
pushl %edi
pushl %esi
pushl %ebx
subl $8, %esp
movl 24(%esp), %edi
testl %edi, %edi
je L1
movl 28(%esp), %eax
movl 32(%esp), %ebx
movl 44(%esp), %esi
@mmozeiko
mmozeiko / gist:bd29519cd538b2989011
Last active Aug 29, 2015
https://gist.github.com/rygorous/c6831e60f5366569d2e9 with MinGW 4.9.2 (-fno-exceptions -msse2 -mfpmath=sse -O3)
View gist:bd29519cd538b2989011
pushl %ebp
pushl %edi
pushl %esi
pushl %ebx
subl $92, %esp
movl 112(%esp), %eax
testl %eax, %eax
je L1
movl 116(%esp), %ebp
movl 120(%esp), %ecx
@mmozeiko
mmozeiko / floor_sse2.c
Last active Aug 29, 2015
floor function with SSE2
View floor_sse2.c
#include <emmintrin.h>
#include <math.h>
#include <stdio.h>
#include <intrin.h>
// On i7-4600U, 2.1GHz
// With g++ -O2 -msse2 -mfpmath=sse -ffast-math floor_sse2.cpp
//
// floor_sse2 = 6.75 cycles
// floor_sse2_mxcsr = 41.45 cycles
You can’t perform that action at this time.