Skip to content

Instantly share code, notes, and snippets.

@vsraptor
vsraptor / piped_wordnet.ipynb
Last active Jun 27, 2021
Easy way to explore Wordnet !!!
View piped_wordnet.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vsraptor
vsraptor / keyvi-index.ipynb
Created Jun 25, 2021
Keyvi Index KV store
View keyvi-index.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vsraptor
vsraptor / one-writer-many-readers.py
Last active Jun 22, 2021
Concurent or Single process : data access to ONE-writer, MULTIPLE-readers Store with RAY
View one-writer-many-readers.py
"""
This example shows how can you handle a data store that can have only ONE WRITER, but MULTIPLE READERS.
KV stores and SQLite come to mind. Also Text files, right ?
There are Three scenarios not TWO :
1. Writer writes directly
@vsraptor
vsraptor / parallel-text-processing.py
Last active Jun 22, 2021
Parallel text processing ++
View parallel-text-processing.py
"""
Three things :
1. Processing text file via memory-mapped generator ... two birds with one stone
- great for large files
- great if file is used in multiple processes
2. Process lazily iterator, range or list in CHUNKS, you can use this to pass the data in chunks
3. Use (1) and RAY to process files asyncrously in Parallel
I use this to compare every line of one file with every other line of the same file.
@vsraptor
vsraptor / naive-skip-encoder.py
Created Mar 1, 2021
Encoder for HTM ecosystem that can be used to skip Spatial Pooler
View naive-skip-encoder.py
import math
import numpy as np
from isdp import *
from iutils import spaORnbits
from ilexicon import iLexicon
"""
The normal procedure is to Encode the values and then pass it trough Spatial Pooler,
but it is expensive operation. What if we can encode directly and skip SP.
@vsraptor
vsraptor / bin-tree.rs
Last active Apr 27, 2022
Rust : Binary tree
View bin-tree.rs
//based on the discussion here https://gist.github.com/aidanhs/5ac9088ca0f6bdd4a370
// Binary tree implementation (simplified)
#![allow(dead_code)]
use std::string::String;
use std::cmp::PartialEq;
use std::cmp::PartialOrd;
struct BinTree<T> {