Skip to content

Instantly share code, notes, and snippets.

View iassael's full-sized avatar

Yannis Assael iassael

View GitHub Profile
@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.
@iassael
iassael / azure-vm-create.py
Created March 2, 2017 17:25
Azure CLI create VM
import numpy as np
import subprocess
import string
import random
import csv
import json
import pprint
ips = []
passwords = []