Skip to content

Instantly share code, notes, and snippets.

@cryptocoinserver
cryptocoinserver / AnkiCardSimilarity.py
Last active May 19, 2024 21:48
This script checks for similar cards in a deck and adds tags to them. It uses TF-IDF and cosine similarity to calculate the similarity between cards. It connects to the Anki collection with ankipandas. Anki needs to be closed while running it. For the changes to show in Anki "Tools" > "Check database" before "Browse".
import os
import re
import sqlite3
import zipfile
import numpy as np
import pandas as pd
import spacy
from ankipandas import Collection
from sklearn.feature_extraction.text import TfidfVectorizer
@cryptocoinserver
cryptocoinserver / fast_volatility.py
Last active June 14, 2022 22:06
Volatility Features
import numba
import numpy as np
@numba.njit
def sliding_window_view(a, w):
s = a.strides[0]
shape = a.shape[0] - w + 1, w
return np.lib.stride_tricks.as_strided(a, shape, (s, s))
@numba.njit
@cryptocoinserver
cryptocoinserver / keyboard-attach.directive.ts
Created January 24, 2017 16:47 — forked from Manduro/keyboard-attach.directive.ts
Ionic 2 Keyboard Attach Directive
import { Directive, ElementRef, Input } from '@angular/core';
import { Content, Platform } from 'ionic-angular';
import { Keyboard } from 'ionic-native';
/**
* @name KeyboardAttachDirective
* @description
* The `keyboardAttach` directive will cause an element to float above the
* keyboard when the keyboard shows. Currently only supports the `ion-footer` element.