Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
White Hat & Head: pt-clip, pt-dqd, pt-kfa

Leonid Yuriev erthink

🎯
White Hat & Head: pt-clip, pt-dqd, pt-kfa
View GitHub Profile
@erthink
erthink / patch.diff
Last active Apr 28, 2016
Intel's VTune driver (sepdk) fix for modern kernels
View patch.diff
commit acaf1cd6b292c7b54f2d4861d12fedb2674bd8d3
Author: Leo Yuriev <leo@yuriev.ru>
Date: 2016-04-14 22:12:37 +0300
fix for modern kernels
diff --git a/src/vtsspp/module.c b/src/vtsspp/module.c
index 266becc..f662f89 100644
--- a/src/vtsspp/module.c
+++ b/src/vtsspp/module.c
View ly_random.c
#include <stdint.h>
static unsigned rnd_head, rnd_tail;
static uint32_t rnd_pool[64];
static __inline
uint32_t random_poly (unsigned n)
{
/* LY: доступ к ряду полинома через циклический буфер. */
return rnd_pool [(rnd_tail + n) & 63];
@erthink
erthink / Windows_LockFileEx_WriteFile_Bug.cpp
Last active Feb 2, 2018
This testcase reproduce a multithread clash-bug between LockFileEx() and WriteFile()
View Windows_LockFileEx_WriteFile_Bug.cpp
// This testcase reproduce a multithread clash-bug
// between LockFileEx() and WriteFile().
//
// The bug was discovered when testing
// https://github.com/leo-yuriev/libmdbx and https://github.com/PositiveTechnologies/libfpta
// (Ultra fast, compact, Embedded Database for tabular and semistructured data).
//
//--------------------------------------------------------
// UPDATE 2018-02-02
//
@erthink
erthink / toc.sh
Created Jul 14, 2019
Generates Table of Contents for markdown document
View toc.sh
#!/bin/bash
###########################################################
# This script generates a nested Table of Contents from a #
# markdown document's header tags. #
# https://github.com/leo-yuriev #
###########################################################
# DEFAULTS
@erthink
erthink / naive_wc.c
Last active Mar 1, 2020
Naive C-implementation of wc
View naive_wc.c
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <time.h>
#include <unistd.h>
@erthink
erthink / ascii_wc.c
Last active Mar 3, 2020
Simple portable optimized ASCII-only version of wc util
View ascii_wc.c
/*
* zlib License, see https://en.wikipedia.org/wiki/Zlib_License
*
* Copyright (c) 2020 Leonid Yuriev <leo@yuriev.ru>,
* Simple portable optimized ASCII-only version of wc tool.
* Just for fun & https://en.wikipedia.org/wiki/The_Computer_Language_Benchmarks_Game
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
@erthink
erthink / ascii_wc.hs
Created Feb 25, 2020
Simple ASCII-only version of wc util
View ascii_wc.hs
{-# LANGUAGE Strict #-}
{-# LANGUAGE RecordWildCards #-}
import qualified Data.ByteString as BS
import System.Environment
import System.IO.Posix.MMap
data State = State
{ bs :: Int
, ws :: Int
@erthink
erthink / ascii_wc_avx2.c
Created Feb 26, 2020
Simple AVX2-enabled version of ASCII-only wc util
View ascii_wc_avx2.c
/*
* zlib License, see https://en.wikipedia.org/wiki/Zlib_License
*
* Copyright (c) 2020 Leonid Yuriev <leo@yuriev.ru>,
* Simple portable optimized ASCII-only version of wc tool.
* Just for fun &
* https://en.wikipedia.org/wiki/The_Computer_Language_Benchmarks_Game
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@erthink
erthink / wc.hs.lst
Created Feb 26, 2020
asm-dump of wc.hs
View wc.hs.lst
[1 of 1] Compiling Main ( wc.hs, wc.o )
==================== Asm code ====================
.section .data
.align 8
.align 1
.globl __stginit_main@main:Main
.type __stginit_main@main:Main, @object
__stginit_main@main:Main:
@erthink
erthink / ascii_wc_like_ghc.c
Created Feb 26, 2020
Inspired by ghc naive C-implementation of wc
View ascii_wc_like_ghc.c
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <time.h>
#include <unistd.h>
You can’t perform that action at this time.