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
{"th": 0.03309640905197913, "he": 0.03289597993942979, "pr": 0.002746850084321499, "ro": 0.005424830253317676, "oj": 8.741181560521646e-05, "je": 0.0003752527437597676, "ec": 0.00287222864811888, "ct": 0.002534942652551277, "gu": 0.0005968725994861245, "ut": 0.005476041215995479, "te": 0.009365425536611424, "en": 0.012622619352446206, "nb": 0.00012891035432688487, "be": 0.007778768641231889, "er": 0.023745110677485717, "rg": 0.0005032801504542766, "eb": 0.00018630195043131993, "bo": 0.0023371623828990704, "oo": 0.004796171539066018, "ok": 0.002003408177860971, "of": 0.008637876687533663, "da": 0.0015663490998348887, "av": 0.003626265926167919, "vi": 0.001449800012361267, "id": 0.005190849130738056, "co": 0.006384594329710305, "op": 0.0019883980681105803, "pp": 0.0020528532452740228, "pe": 0.004910071783642512, "rf": 0.0011416512886620695, "fi": 0.0026135249918327343, "ie": 0.003583884439813875, "el": 0.006230961441676894, "ld": 0.005101671419868088, "hi": 0.010678368665954422, "is": 0.009714189851399914, "fo" |
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 | |
# coding: utf-8 | |
""" splits.py | |
Usage: | |
./splits .in,cr.. | |
This will print out all known words that match both patterns with fixed | |
letters per dot. In the above example, one answer pair would be: |
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
// This is a depth-first traversal function with a few nice features. | |
// | |
// * Call this function as depthFirstTraverse(root, tree, fn) | |
// `tree` is an object whose properties are nodes in a tree; the | |
// values are arrays of that node's child nodes. | |
// `root` is the starting point for the traversal; a property in `tree`. | |
// `fn` is called as in fn(node, depth, childNum) for each node. | |
// childNum is the index of node as a child of its parent; | |
// as a special case, the childNum of `root` is undefined. | |
// `depth` is 0 for the root, and in general indicates how |
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
/* printTree.js | |
* | |
* A little function to print out a tree via console.log(). | |
* | |
* The tree is expected to be an object whose keys (aka properties) are | |
* treated as nodes; each node mapping to an array of its children. | |
* Leaf nodes don't need to be present as keys. | |
* | |
* Here is an example tree with root element 'a': | |
* t = {a: ['b', 'c'], b: ['d'], c: ['e'], d: ['f', 'g'], g: ['h']} |
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
// Print out a simple table with right-justified columns of strings. | |
// This can handle some columns having fewer entries than others. | |
// (For mid-table missing entries, provide empty strings.) | |
// The `cols` value is an array of arrays of strings, the columns of the table. | |
// The optional `topSep` is a string the indicates the separator to use in the | |
// top row only. If you don't provide topSep, a single space is used. | |
function showTableWithColumns(cols, topSep) { | |
if (topSep === undefined) topSep = ' '; |
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
// This will sort the values in `inputArr` according to the comparison data | |
// provided by calls to `inputCmp()`, which is expected to return the values '=' | |
// (a string), '<', '>', or null; where a null indicates that the comparison | |
// value is undetermined, and that those two elements may go in any order. | |
// This function attempts to reduce the number of calls to inputCmp() in several | |
// ways: | |
// * It memorizes given return values. | |
// * It assumes that if a < b then also b > a (otherwise what is happening?). | |
// * It builds a tree to infer transitive comparisons, and tries to maximize | |
// the use of that tree. |
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
// The inputArr is an array of any kind of values. | |
// The inputCmp() function accepts two values, x and y; with the return | |
// value indicating the relationship as such: | |
// | |
// If: then cmp(x, y) returns: | |
// x < y '<' | |
// x > y '>' | |
// x = y '=' | |
// x ? y null | |
// |
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 | |
""" toggle | |
Usage: | |
toggle start | |
toggle getip | |
toggle stop | |
""" |
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/bash | |
if [ -z "$1" ]; then | |
echo Usage: ./fix_aspect.sh '<img_file>' | |
echo | |
echo This will create a new image file with the word 'fixed' appended before | |
echo the filename extension. Eg, myimg.jpg will become myimg.fixed.jpg. | |
exit | |
fi |
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
""" reservoir.py | |
This is an example implementation of an efficient | |
reservoir sampling algorithm -- this algorithm is useful | |
when you have a data stream, possibly of unknown length, | |
and you'd like to maintain an incrementally updated | |
random subset of fixed size k. This algorithm works by | |
occasionally adding a new data point from the stream | |
into the 'reservoir,' which is simply a length-k list | |
of data points. |
NewerOlder