Skip to content

Instantly share code, notes, and snippets.

View antoniomaria's full-sized avatar

Antonio Maria Sanchez Berrocal antoniomaria

View GitHub Profile
@antoniomaria
antoniomaria / .bash_profile
Created January 9, 2023 08:15
Development environment bash_profile
export BASH_SILENCE_DEPRECATION_WARNING=1
export LANG=en_US.UTF-8
export LC_ALL=$LANG
genpasswd() { pwgen -Bs $1 1 |pbcopy |pbpaste; echo “Has been copied to clipboard”
}
@antoniomaria
antoniomaria / ExponentialMovingAverage.java
Created December 3, 2024 09:09
Java Algorithm for Rolling or Moving Average
public class ExponentialMovingAverage {
private double alpha; // Smoothing factor 0-1. 1 calculate the average as latest value.
private Double average;
public ExponentialMovingAverage(double alpha) {
this.alpha = alpha;
}
public void add(double value) {
if (average == null) {
average = value; // Initialize average with the first value