Skip to content

Instantly share code, notes, and snippets.

View konstantinvlasenko's full-sized avatar
☁️

Konstantin Vlasenko konstantinvlasenko

☁️
View GitHub Profile
@konstantinvlasenko
konstantinvlasenko / rds-backup-replica-lag.yaml
Last active September 24, 2025 21:42
Records difference between Now and Latest Restorable Time of a replicated RDS backup. Creates CLoudWatch custom metric.
AWSTemplateFormatVersion: '2010-09-09'
Description: Records difference between Now and Latest Restorable Time of a replicated RDS backup
Parameters:
MetricNamespace:
Type: String
Description: Metric namespace
Mappings:
Configuration:
@konstantinvlasenko
konstantinvlasenko / kms-cloudwatch-metrics.yaml
Created September 24, 2025 21:35
Detects AWS CloudTrail event for the ScheduleKeyDeletion operation. Creates CloudWatch custom metric
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::LanguageExtensions
Description: Detects AWS CloudTrail event for the ScheduleKeyDeletion operation
Parameters:
MetricNamespace:
Type: String
Description: Metric namespace
Mappings:
@konstantinvlasenko
konstantinvlasenko / rds-snapshot-tags-replication.yaml
Created September 24, 2025 21:31
Automates RDS automated backup tags replication to another AWS Region. Deploy in target region.
AWSTemplateFormatVersion: '2010-09-09'
Description: Brings tags from a source
Mappings:
Configuration:
log:
RetentionInDays: 90
Resources:
Role:
@konstantinvlasenko
konstantinvlasenko / index.js
Created January 11, 2020 23:51
Climbing Stairs
/**
* @param {number} n
* @return {number}
*/
let stack = {};
var climbStairs = function(n) {
if (n > 1)
return stack[n] || ( stack[n] = climbStairs(n - 1) + climbStairs(n - 2))
return 1;
};
@konstantinvlasenko
konstantinvlasenko / index.js
Created January 11, 2020 23:14
3Sum JavaScript
/**
* @param {number[]} nums
* @return {number[][]}
*/
var threeSum = function(nums) {
nums.sort((a, b) => { return a - b; });
const result = [];
for (let i = 0; i < (nums.length-2); i ++) {
const a = nums[i];
if (a > 0) return result; // all other numbers to the right are positive as we are working with sorted array
Invoke-WebRequest 'http://download.microsoft.com/download/C/F/F/CFF3A0B8-99D4-41A2-AE1A-496C08BEB904/WebPlatformInstaller_amd64_en-US.msi' -OutFile "$($env:TEMP)/WebPlatformInstaller_amd64_en-US.msi"
Start-Process "$($env:TEMP)/WebPlatformInstaller_amd64_en-US.msi" '/qn' -PassThru | Wait-Process
cd 'C:/Program Files/Microsoft/Web Platform Installer'; .\WebpiCmd.exe /Install /Products:'UrlRewrite2,ARRv3_0' /AcceptEULA
function New-Farm($name, $accessName, $port)
{
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter 'webFarms' -name . -value @{name=$name}
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "/webFarms/webFarm[@name='$name']" -name . -value @{address='127.0.0.1'}
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "/webFarms/webFarm[@name='$name']/server[@address='127.0.0.1']" -name applicationRequestRouting -value @{httpPort=$port}
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter 'system.webServer/rewrite/