Skip to content

Instantly share code, notes, and snippets.

View edwintorok's full-sized avatar
💭
I may be slow to respond.

Török Edwin edwintorok

💭
I may be slow to respond.
View GitHub Profile
let base = Char.code '0'
let rec string_of_int_rec b i n =
let i = i - 1 in
Bytes.unsafe_set b i (Char.unsafe_chr (base + n mod 10));
let n = n / 10 in
if n = 0 then i
else string_of_int_rec b i n
let int_min_str = string_of_int min_int
1250 files changed, 121864 insertions(+), 115011 deletions(-)
[root@db1993e8c429]/home/edvint/xen/xen# git diff --dirstat
5.5% xen/arch/arm/include/asm/
5.5% xen/arch/arm/
4.2% xen/arch/x86/cpu/
4.7% xen/arch/x86/hvm/
8.1% xen/arch/x86/include/asm/
3.3% xen/arch/x86/mm/
4.4% xen/arch/x86/x86_emulate/
10.2% xen/arch/x86/
#!/usr/bin/env python3
import browser_cookie3
import requests
import logging
logging.basicConfig(level=logging.DEBUG)
logging.debug("About to load Firefox cookiejar")
BASE = "https://discuss.ocaml.org"
cookiejar = browser_cookie3.firefox(domain_name="discuss.ocaml.org")
logging.debug("Got cookies: %r" % ([c.name for c in cookiejar]))
@edwintorok
edwintorok / inxi.txt
Last active December 27, 2021 18:48
mmap populate test
CPU: 12-Core AMD Ryzen 9 3900X (-MT MCP-) speed/min/max: 3800/2200/3800 MHz Kernel: 5.15.11-200.fc35.x86_64 x86_64 Up: 3h 40m
Mem: 3884.9/64274.8 MiB (6.0%) Storage: 24.99 TiB (7.7% used) Procs: 506 Shell: Zsh inxi: 3.3.09
test_entropy alias tests/runtest
no CPU RNG available
test entropy OK
test_symmetric_runner alias tests/runtest
accel:
..............................................................................................................................................
Ran: 142 tests in: 0.54 seconds.
OK
test_random_runner alias tests/runtest
.........
@edwintorok
edwintorok / rdrand.c
Created January 11, 2021 23:13
gcc rdrand.c -O2 -o rdrand -fopenmp -Wall
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#if defined(__i386__) || defined(__x86_64__)
#include <cpuid.h>
#endif
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#if defined(__i386__) || defined(__x86_64__)
#include <cpuid.h>
#endif
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff -rwu chase-lev-deque/deque.c chase-lev-deque-bugfix/deque.c
--- chase-lev-deque/deque.c 2020-08-25 20:29:46.964661118 +0100
+++ chase-lev-deque-bugfix/deque.c 2020-08-25 20:29:46.963661116 +0100
@@ -50,7 +50,7 @@
for(i=top; i < bottom; i++) {
atomic_store_explicit(&new_a->buffer[i % new_size], atomic_load_explicit(&a->buffer[i % size], memory_order_relaxed), memory_order_relaxed);
}
- atomic_store_explicit(&q->array, new_a, memory_order_relaxed);
+ atomic_store_explicit(&q->array, new_a, memory_order_release);
printf("resize\n");
@edwintorok
edwintorok / codegen.ml
Last active August 23, 2020 20:42
ocaml code generator
let prologue =
{|
(* This code is automatically generated *)
let string_of_string x = x
|}
let epilogue =
{|
let print t = pp Format.std_formatter t
let prologue =
{|
{-# language DeriveGeneric #-}
module Parser where
import Data.Csv
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import GHC.Generics
import Control.Monad