Skip to content

Instantly share code, notes, and snippets.

View iassael's full-sized avatar

Yannis Assael iassael

View GitHub Profile
@danoneata
danoneata / fisher_vector.py
Last active December 6, 2023 06:25
Fisher vectors with sklearn
import numpy as np
import pdb
from sklearn.datasets import make_classification
from sklearn.mixture import GaussianMixture as GMM
def fisher_vector(xx, gmm):
"""Computes the Fisher vector on a set of descriptors.
require 'nn'
require 'stn'
------
-- Prepare your localization network
local localization_network = torch.load('your_locnet.t7')
------
-- prepare both branches of the st
local ct = nn.ConcatTable()
@bshillingford
bshillingford / arxiv_bash_aliases.sh
Last active July 9, 2020 10:09
useful arxiv tools for bash
function arxiv-authors() {
if [ $# -ne 1 ]; then
echo "Usage: arxiv-authors arxiv_url_or_id"
echo "Prints authors' names, one per line."
else
if [[ $1 == http* ]]; then
url=$1
else
url=http://arxiv.org/abs/$1
fi
@dzhuang
dzhuang / strip_comments.py
Last active April 16, 2023 18:14 — forked from amerberg/strip_comments.py
A script to remove comments from LaTeX source
import ply.lex, argparse, io
# modified from https://gist.github.com/amerberg/a273ca1e579ab573b499
#Usage
# python stripcomments.py input.tex > output.tex
# python stripcomments.py input.tex -e encoding > output.tex
# Modification:
# 1. Preserve "\n" at the end of line comment
@iassael
iassael / Fifo.gs
Last active July 29, 2024 15:57
FIFO for Investments Inventory Accounting [Google Sheets - Apps Script]
/**
* Calculates the remaining inventory, current average buy price, total cost and total gains using FIFO (First In First Out) method.
* The function expects three parameters: transactionsType, transactionQuantities and transactionPrices sorted by date.
*
* Inspired by: https://www.allstacksdeveloper.com/2022/09/fifo-stock-portfolio-google-sheets.html
*
* @param {string[] | string} transactionsType - An array or a single string representing transaction types. Each string should be either 'B' for buy or 'S' for sell.
* @param {number[] | number} transactionQuantities - An array or a single number representing the quantities for each transaction.
* @param {number[] | number} transactionPrices - An array or a single number representing the prices for each transaction.
* @throws Will throw an error if transactionPrices and transactionQuantities are not arrays or if their lengths are not equal.