Skip to content

Instantly share code, notes, and snippets.

View hfukada's full-sized avatar

Hiroshi Fukada hfukada

View GitHub Profile
Background
Simplifying somewhat, each word of English is composed of a string of sounds, called "phones"/"phonemes". For example, "cat" has the phones /k/, /a/, /t/.
Some phones are more "confusable" with other phones--it's easier to mishear /m/ (as in "ram") as /n/ (as in "ran") than /t/ (as in "rat"). I happen to have a phone-to-phone confusion matrix, which tells me the probability of confusing any phone as any other phone.
If I want to calculate how easy it is to confuse one string of phones with another of equal length (e.g., hearing "ram" as "rat"), I simply multiply the probability of hearing each phone in the first string as the corresponding phone in the second string. E.g., P(/r/|/r/) * P(/a/|/a/) * P(/t/|/m/). Like I said, I get these probabilities from my confusion matrix.
" Settings
"set nosmoothscroll
set noautofocus " The opposite of autofocus; this setting stops
" sites from focusing on an input box when they load
set typelinkhints
let searchlimit = 20
let scrollstep = 50
let barposition = "top"
let hintcharacters = "asdfjkl"
let completionengines = ["google", "amazon"]
def gen_nonce():
"""Generates a random string of bytes, base64 encoded"""
length = 64
string = base64.b64encode(os.urandom(length), altchars=b'-_')
b64len = 4 * min(length, 3)
if length % 3 == 1:
b64len += 2
elif length % 3 == 2:
b64len += 3
return string[0:b64len].decode()
### Keybase proof
I hereby claim:
* I am hfukada on github.
* I am hiroshf (https://keybase.io/hiroshf) on keybase.
* I have a public key whose fingerprint is 2E52 8A40 D052 B98C 3AE7 E119 9DE5 5147 A170 3CCE
To claim this, I am signing this object: