Skip to content

Instantly share code, notes, and snippets.

View rcabreras's full-sized avatar
🏠
Working from home

Raul Cabrera rcabreras

🏠
Working from home
View GitHub Profile
// Built with IMPACT - impactjs.org
(function (window) {
"use strict";
Number.prototype.map = function (istart, istop, ostart, ostop) {
return ostart + (ostop - ostart) * ((this - istart) / (istop - istart));
};
Number.prototype.limit = function (min, max) {
return Math.min(max, Math.max(min, this));
};
Number.prototype.round = function (precision) {
@raadk
raadk / excelFinance.R
Last active September 11, 2023 10:01
Excel's PMT, IPMT, PPMT implemented in R
#' Excel: PMT (should make result data frame, but need to change propertyAnalysis())
#'
#' Returns the payment amount for a loan based on a constant interest rate and a constant payment schedule.
#' The payment returned by PMT includes principal and interest but no taxes,
#' reserve payments, or fees sometimes associated with loans.
#' Outgoing payments are displayed by negative numbers and
#' incoming payments by positive numbers.
#' #http://support2.microsoft.com/kb/214005#appliesto
#' @param rate Required. The interest rate per period. Needs to be defined as the same periods as nper.
#' @param per Required. The period for which you want to find the interest and must be in the range 1 to nper.
@jpbarto
jpbarto / process_cognito_users.py
Last active January 12, 2024 13:13
Simple script to read users in a Cognito user pool, check them for failed logins, and put those failed logins to CloudWatch logs
#!/usr/bin/env python3
"""
The following script demonstrates how to use the AWS Boto3 SDK to iterate through
all of the users in an AWS Cognito User Pool and examine the events associated
with each user.
If any failed authentication events are found the script formats them as messages
and logs them to CloudWatch logs.
This script could easily be modified to run periodically as a Lambda function