This script goes into /etc/kernel/postinst.d
. You have to make it executable by root, e.g. chown root:root /etc/kernel/postinst.d/00-signing ; chmod u+rx /etc/kernel/postinst.d/00-signing
. It assists you with automatically signing freshly installed kernel images using the machine owner key in a way similar to what dkms does. This is mainly useful if you want to use mainline kernels on Ubuntu on Secure Boot enabled systems. This needs shim-signed to be set up. If you have questions this one might help you: While I made this for Ubuntu 20.04, it should work on current Debian based distributions. YMMV.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |