View .vimrc
syntax enable
colorscheme monokai
set number
set ruler
set swapfile
set dir=~/tmp
set tabstop=4
View exchange_rates.py
import random
import copy
def make_exchange_matrix(N=3, seed=2017):
'''In this function, we make an exchange matrix
for testing purposes by randomly picking exchange
rates from the first currency to all the other
currencies. '''
View grid_zero.py
import random
import numpy as np
#from cvxpy import *
def p(M):
"""Method to pretty print our matrix. """
for i in range(len(M)):
print(' '.join([str(num) for num in M[i]]))
def generate_M(N=3, max_touches=2):
View heap.py
import random
class Node():
def __init__(self, data=None):
self.data = data
self.parent = None
self.left = None
self.right = None
self.load = 1 # Assumed to be a leaf when initialized.
View bloom_filter_example.py
import random
import math
from hashlib import md5
class MyHashTable(object):
def __init__(self, hash_functions, len_table):
self.hash_functions = hash_functions
self.len_table = len_table
self.table = [-1]*self.len_table
View RainbowTable.py
#!/usr/bin/python3
# author: @ijkilchenko
# MIT License
import math
import hashlib
import random
from collections import defaultdict
def base10_to_baseB(num, B):
View words_over_vocab.py
# author: @ijkilchenko
# MIT License
def words_over_vocab(vocab, n):
return _words_over_vocab(vocab, '', n)
def _words_over_vocab(vocab, word, n):
if len(word) == n:
yield word
else: