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
A visualization of perhaps the most inefficient algorithm - the recursive Levenshtein distance. | |
ks | |
ksi | | |
ksit ___/ | |
ksitt ____/ | |
ksitti _____/ | |
ksittin ______/ | |
ksitting _______/ |
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
Better recursion tree visualization | |
\____cd | |
cdo___/ | |
cdog____/ | |
cdoge_____/ | |
\____cd | |
cdo___/ | |
cdog____/ | |
\____cd |
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 agFileSearch() { | |
ag "$1" -l | xargs open | |
} | |
alias agfiles='agFileSearch' | |
# .. usage: | |
# agfiles 'mytext' |
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
$('[data-datatable]').each(function(k, table){ | |
// data_vars is a json encoded string embedded in html as a | |
// data-* attribute. This allows declarative programming with complex | |
// overrides, without coupling to the javascript. | |
var data_vars = $(this).data('datatable-opts'); | |
var opts = $.extend(window.DATATABLES_OPTS, data_vars); | |
$(this).dataTable(opts); | |
}); |
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 checkVisibility(color1, color2) { | |
// http://www.w3.org/TR/AERT#color-contrast | |
// Color brightness is determined by the following formula: | |
// ((Red value X 299) + (Green value X 587) + (Blue value X 114)) / 1000 | |
// Note: This algorithm is taken from a formula for converting RGB values to | |
// YIQ values. This brightness value gives a perceived brightness for a color. |
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 namebot import techniques as nb | |
from random_words import RandomWords | |
# https://pypi.python.org/pypi/RandomWords/0.1.5 | |
rw = RandomWords() | |
# https://github.com/Automotron/namebot | |
test = rw.random_words(count=10) | |
print(nb.make_portmanteau_default_vowel(test)) |
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
# https://en.wikipedia.org/wiki/Catalan_number | |
import math | |
prod = 1 | |
for n in range(2, 100): | |
prod = math.factorial((2 * n)) // ( | |
math.factorial((n + 1)) * math.factorial(n)) | |
print(prod) |
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
https://github.com/christabor/MoAL/blob/master/MOAL/maths/applied/computational/cryptography/ciphers/historical/transposition/railfence.py | |
Encoded with 2 rows: IAEVRBGERTHVAEYISCE | |
I . V . V . Y . G . C . T | |
H . E . E . B . S . R | |
A . A . R . I . E . E | |
Encoded with 3 rows: IVVYGCTHEEBSRAARIEE | |
I . E . R . G . R |
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 random import randrange as rr | |
# Use with: http://mlpy.sourceforge.net/docs/3.5/dtw.html#id3 | |
def random_timesequence(start, end, steps=3): | |
seq = [] | |
for n in range(start, end): | |
# Randomize the number of sub-steps, | |
# but maintain the bounds and monotonicity |
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
vowels = ['a', 'e', 'i', 'o', 'u'] | |
with open('/usr/share/dict/words') as words: | |
_words = [] | |
with open('/Users/ctabor/Desktop/words.txt', 'wb+') as wordfile: | |
for word in words: | |
if len(word) > 3 and len(word) < 8: | |
word = word.strip().lower() | |
if word[1] in vowels: | |
if word[2] in vowels: |