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
$ hyperfine './so73816657-gcc 1 50000000' './so73816657-gcc 2 50000000' './so73816657-clang 1 50000000' './so73816657-clang 2 50000000' | |
Benchmark 1: ./so73816657-gcc 1 50000000 | |
Time (mean ± σ): 1.703 s ± 0.087 s [User: 1.501 s, System: 0.127 s] | |
Range (min … max): 1.586 s … 1.861 s 10 runs | |
Benchmark 2: ./so73816657-gcc 2 50000000 | |
Time (mean ± σ): 1.694 s ± 0.096 s [User: 1.516 s, System: 0.126 s] | |
Range (min … max): 1.601 s … 1.882 s 10 runs | |
Benchmark 3: ./so73816657-clang 1 50000000 |
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
$ hyperfine --show-output 'python3 so73815479.py' 'python3 so73815479.py multi' --max-runs 5 | |
Benchmark 1: python3 so73815479.py | |
multi_proc: False, data dur: 2.83, local dur: 2.31 | |
multi_proc: False, data dur: 2.61, local dur: 2.09 | |
multi_proc: False, data dur: 2.74, local dur: 2.22 | |
multi_proc: False, data dur: 2.75, local dur: 2.26 | |
multi_proc: False, data dur: 2.83, local dur: 2.58 | |
Time (mean ± σ): 5.180 s ± 0.256 s [User: 5.875 s, System: 0.196 s] | |
Range (min … max): 4.852 s … 5.551 s 5 runs |
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 random | |
from collections import Counter | |
py310_encodings = [ | |
'ascii', | |
'big5', | |
'big5hkscs', | |
'cp037', | |
'cp1006', | |
'cp1026', |
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
[Trigger] | |
Operation = Install | |
Operation = Upgrade | |
Type = Package | |
Target = nodejs | |
[Action] | |
Description = Blessing Node.js for Bluetooth | |
When = PostTransaction | |
Exec = /bin/bash -c '/usr/bin/setcap cap_net_raw+eip $(eval readlink -f `which node`)' |
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 () { | |
const svg = document.querySelector(".js-calendar-graph-svg"); | |
let filter = svg.querySelector("#qla"); | |
if (!filter) { | |
filter = document.createElement("filter"); | |
filter.id = "qla"; | |
svg.appendChild(filter); | |
} | |
filter.outerHTML = `<filter id="qla" primitiveUnits="objectBoundingBox"> | |
<feTurbulence type="turbulence" baseFrequency="0.05" numOctaves="2" result="turbulence"/> |
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 itertools | |
import math | |
import multiprocessing | |
import random | |
import tqdm | |
# Via Wikipedia | |
def de_bruijn(alphabet, n: int) -> str: | |
"""de Bruijn sequence for alphabet k |
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
// List and extract embedded files in a PDF document. | |
// extended from the example script | |
function usage() { | |
print("usage: mutool run pdf-portfolio.js input.pdf ['all' | index filename]"); | |
print( | |
" List embedded files, or extract an embedded file from a PDF document.", | |
); | |
quit(); | |
} |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
static uint64_t usecdiff(struct timeval *a, struct timeval *b) { | |
uint64_t sec_diff = b->tv_sec - a->tv_sec; | |
uint64_t usec_diff = b->tv_usec - a->tv_usec; | |
return sec_diff * 1000000 + usec_diff; | |
} |
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 make_immutable(v): | |
""" | |
Return an immutable representation of a mutable container. | |
The representation is only meant for machine use. | |
""" | |
if isinstance(v, (list, tuple)): | |
return (type(v), tuple(make_immutable(i) for i in v)) | |
if isinstance(v, (set, frozenset)): | |
return (type(v), frozenset(make_immutable(i) for i in v)) | |
if isinstance(v, dict): |
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
interface InitialGroup<K, T> { | |
key: K; | |
keyString: string; | |
items: T[]; | |
} | |
export interface HierarchicalGroup<K, T, A> extends InitialGroup<K, T> { | |
id: string; | |
level: number; | |
parent?: HierarchicalGroup<K, T, A>; |