Skip to content

Instantly share code, notes, and snippets.

View Kuo-TingKai's full-sized avatar
🏠
Working from home

Kuo Ting-Kai Kuo-TingKai

🏠
Working from home
View GitHub Profile
@sennajox
sennajox / Methods of disk io performance testing
Last active March 5, 2023 11:38
Methods of disk io performance testing
测试磁盘IO性能的几种方法
在磁盘测试中最关心的几个指标分别为:iops(每秒执行的IO次数)、bw(带宽,每秒的吞吐量)、lat(每次IO操作的延迟)。
当每次IO操作的block较小时,如512bytes/4k/8k等,测试的主要是iops。
当每次IO操作的block较大时,如256k/512k/1M等,测试的主要是bw。
1. 最简单的dd
dd是linux自带的磁盘读写工具,可用于测试顺序读写。
一般而言,磁盘读写有两种方式:BufferIO、DirectIO,DirectIO可以更好的了解纯磁盘读写的性能。
1.1 dd测试DirectIO
@qnighy
qnighy / S1B.v
Created August 24, 2014 14:13
HoTT : Construct a fiber bundle (fiber space = Bool, base space = S1), and prove the total space is homotopy equivalent to S1 itself.
Require Import Overture PathGroupoids Equivalences Trunc HProp HSet.
Require Import types.Unit types.Paths types.Sigma types.Forall types.Arrow.
Require Import types.Bool types.Universe Misc.
Require Import hit.Circle.
Local Open Scope path_scope.
Local Open Scope equiv_scope.
Instance isequiv_negb' : @IsEquiv@{Type Type} Bool Bool negb.
Proof.
refine (@BuildIsEquiv
@StuartGordonReid
StuartGordonReid / BinaryMatrixRank.py
Created August 25, 2015 15:57
Python implementation of the Binary Matrix Rank cryptographic test for randomness
def matrix_rank(self, bin_data: str, q=32):
"""
Note that this description is taken from the NIST documentation [1]
[1] http://csrc.nist.gov/publications/nistpubs/800-22-rev1a/SP800-22rev1a.pdf
The focus of the test is the rank of disjoint sub-matrices of the entire sequence. The purpose of this test is
to check for linear dependence among fixed length sub strings of the original sequence. Note that this test
also appears in the DIEHARD battery of tests.
:param bin_data: a binary string
@StuartGordonReid
StuartGordonReid / BinaryMatrix.py
Created August 25, 2015 15:59
A Python class for computing the rank of a binary matrix. This is used by the Binary Matrix Rank cryptographic test for randomness
class BinaryMatrix:
def __init__(self, matrix, rows, cols):
"""
This class contains the algorithm specified in the NIST suite for computing the **binary rank** of a matrix.
:param matrix: the matrix we want to compute the rank for
:param rows: the number of rows
:param cols: the number of columns
:return: a BinaryMatrix object
"""
self.M = rows
@StuartGordonReid
StuartGordonReid / ApproximateEntropy.py
Last active April 7, 2024 11:19
Python implementation of the Approximate Entropy cryptographic test for randomness
def approximate_entropy(self, bin_data: str, pattern_length=10):
"""
Note that this description is taken from the NIST documentation [1]
[1] http://csrc.nist.gov/publications/nistpubs/800-22-rev1a/SP800-22rev1a.pdf
As with the Serial test of Section 2.11, the focus of this test is the frequency of all possible overlapping
m-bit patterns across the entire sequence. The purpose of the test is to compare the frequency of overlapping
blocks of two consecutive/adjacent lengths (m and m+1) against the expected result for a random sequence.
:param bin_data: a binary string
@delta2323
delta2323 / brownian_bridge.py
Created March 13, 2016 11:23
Brownian Bridge sample code
#!/usr/bin/env python
import numpy
import six
from matplotlib import pyplot
seed = 0
N = 100
M = 10
@ArdWar
ArdWar / pen.m
Created October 12, 2016 13:23
WoWs Penetration calc
clear all; clc
% SHELL CONSTANTS %
C = 0.5561613; % PENETRATION
a = 9.81; % GRAVITY
T_0 = 288; % TEMPERATURE AT SEA LEVEL
L = 0.0065; % TEMPERATURE LAPSE RATE
p_0 = 101325; % PRESSURE AT SEA LEVEL
R = 8.31447; % UNIV GAS CONSTANT
M = 0.0289644; % MOLAR MASS OF AIR
@jw3126
jw3126 / so3.jl
Created October 5, 2018 12:51
Haar Measure of distance Ball SO(3)
# https://math.stackexchange.com/questions/1049788/haar-measure-of-an-angle-distance-ball-in-so3
using StatsBase
using LinearAlgebra
using StatPlots
using Plots
using Rotations
function sample_angles(N)
map(1:N) do _
@rmnshelest
rmnshelest / hott.md
Created November 27, 2018 20:02
Homotopy type theory in Python

https://abooij.github.io/wiwikwlhott/

  • univalence axiom
  • higher inductive types

"Both ideas are impossible to capture directly in classical set-theoretic foundations, but when combined in homotopy type theory, they permit an entirely new kind of "logic of homotopy types"." p13

invariance, homotopy

univalence foundations

@kailaix
kailaix / wave.jl
Last active July 28, 2022 11:05
Example of 1D Wave Equation with Absorbing Boundary Condition
# solve 1D wave equation with ABC
using PyPlot
using Plots
using LinearAlgebra
N = 100
x = LinRange(-1.,1.,N+1)
Δx = x[2]-x[1]
NT = 200