Skip to content

Instantly share code, notes, and snippets.

@vsraptor
vsraptor / piped_wordnet.ipynb
Last active June 27, 2021 18:19
Easy way to explore Wordnet !!!
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 June 25, 2021 01:06
Keyvi Index KV store
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 June 22, 2021 01:54
Concurent or Single process : data access to ONE-writer, MULTIPLE-readers Store with RAY
"""
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 June 22, 2021 01:09
Parallel text processing ++
"""
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 March 1, 2021 22:40
Encoder for HTM ecosystem that can be used to skip Spatial Pooler
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 June 22, 2023 16:46
Rust : Binary tree
//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> {