Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Török Edwin edwintorok

💭
I may be slow to respond.
View GitHub Profile
View gist:44363badc311587175ffba1d9498c039
#!/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
View inxi.txt
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
View dune runtest mirage-crypto riscv
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
View rdrand.c
/* 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>
View rdrand.c
/* 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>
View gist:139ed75a283e3e6bbab59ebfd033ccbe
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
View codegen.ml
let prologue =
{|
(* This code is automatically generated *)
let string_of_string x = x
|}
let epilogue =
{|
let print t = pp Format.std_formatter t
View codegen.ml
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
View jbuildfmt.ml
open Sexplib
let reformat sexp = sexp
let vparens pp ppf = Fmt.pf ppf "@[<v1>(%a)@]" pp
let slist = Fmt.(list ~sep:sp)
let spair = Fmt.(pair ~sep:sp)
let canonicalize_set = List.sort_uniq (*Sexp.*)compare
View keybase.md

Keybase proof

I hereby claim:

  • I am edwintorok on github.
  • I am edwintorok (https://keybase.io/edwintorok) on keybase.
  • I have a public key whose fingerprint is B32F 9BE2 E22D 4615 ABD2 CE8E 814A 3A7A 06AA 1295

To claim this, I am signing this object: