This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const ArenaAllocator = std.heap.ArenaAllocator; | |
const ArrayHashMap = std.AutoArrayHashMap; | |
const ArrayList = std.ArrayList; | |
const WriteError = std.os.WriteError; | |
const is_prime = @import("test.zig").is_prime; | |
const seg_sieve = @import("sieve.zig").seg_sieve; | |
// Could use a better name... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from base64 import b32encode | |
from hashlib import sha3_256 | |
TLD = '.onion' | |
def calculate_checksum(pubkey: bytes, version: bytes = b'\x03') -> bytes: | |
constant = b'.onion checksum' | |
return sha3_256(constant + pubkey + version).digest()[:2] | |
def generate_onion_address(pubkey: bytes, version: bytes = b'\x03') -> str: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use-modules (gnu) (guix packages) (srfi srfi-1)) | |
(use-system-modules locale) | |
(use-service-modules avahi cups desktop linux networking pm xorg) | |
(use-package-modules android gnome linux radio shells wm) | |
(define %my-udev-rules | |
(let ((unauthorize | |
(lambda (subsystem product) | |
(string-append | |
"SUBSYSTEM==\"" (symbol->string subsystem) "\", " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
from itertools import chain | |
from math import isclose | |
from dateparser import parse as dateparse | |
def parse_date(*args, **kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numpy.typing as npt | |
# TODO https://arxiv.org/abs/2108.06828 | |
def xicor(x: npt.ArrayLike, y: npt.ArrayLike) -> np.float_: | |
x, y = np.asanyarray(x), np.asanyarray(y) | |
assert x.ndim == 1 and y.ndim == 1, "arrays must be one-dimensional" | |
assert len(x) == len(y), "arrays must have the same length" | |
# XXX Checking if every value of y is the same (NaN)? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
LAST_NAME= | |
KEYWORD= | |
LICENCE_NUM= | |
POS_ID= | |
EXAM_TYPE= | |
EXAM_DATE= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def levenshtein_distance(s1: str, s2: str) -> int: | |
if s1 == s2: | |
return 0 | |
if not s1: | |
return len(s2) | |
if not s2: | |
return len(s1) | |
prev, curr = None, range(len(s2) + 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import logging | |
import re | |
from collections import defaultdict | |
from io import FileIO | |
from itertools import count | |
from pathlib import Path | |
from typing import Callable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function* tarjan(graph) { | |
let index = 0; | |
const stack = []; | |
function* strongConnect(v) { | |
v.index = index, v.lowlink = index, v.onStack = true; | |
index += 1; | |
stack.push(v); | |
for (let w of v.successors.map(i => graph[i])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.ArrayDeque; | |
import java.util.Arrays; | |
import java.util.PriorityQueue; | |
/** | |
* @author Abdelhakim Qbaich | |
*/ |
NewerOlder