Skip to content

Instantly share code, notes, and snippets.

View IwoHerka's full-sized avatar

Iwo Herka IwoHerka

View GitHub Profile
@IwoHerka
IwoHerka / reservations.md
Created April 21, 2024 20:06
AWS services which support reservations

The following AWS services support reservations to optimize costs:

  • Amazon EC2 Reserved Instances (RI): You can use Amazon EC2 Reserved Instances (RI) to reserve capacity and receive a discount on your instance usage compared to running On-Demand instances.

  • Amazon DynamoDB Reserved Capacity: If you can predict your need for Amazon DynamoDB read-and-write throughput, Reserved Capacity offers significant savings over the normal price of DynamoDB provisioned throughput capacity.

  • Amazon ElastiCache Reserved Nodes: Amazon ElastiCache Reserved Nodes give you the option to make a low, one-time payment for each cache node you want to reserve and, in turn, receive a significant discount on the hourly charge for that node.

  • Amazon RDS RIs: Like Amazon EC2 RIs, Amazon RDS RIs can be purchased using No Upfront, Partial Upfront, or All Upfront terms. All Reserved Instance types are available for Aurora, MySQL, MariaDB, PostgreSQL, Oracle, and SQL Server database engines.

// Objects -----------------------------------------------------------------------------
// --- Creating ---
let user = new Object(); // "object constructor" syntax
let user = {}; // "object literal" syntax
// --- Adding and reading properties ---
user = {
name: "John",
@IwoHerka
IwoHerka / well_architected.md
Created April 20, 2024 17:44
AWS Well-Architected Framework Design Principles

Operational excellence

  • Perform operations as code: In the cloud, you can apply the same engineering discipline that you use for application code to your entire environment. You can define your entire workload (applications, infrastructure, etc.) as code and update it with code. You can script your operations procedures and automate their process by launching them in response to events. By performing operations as code, you limit human error and create consistent responses to events.
@IwoHerka
IwoHerka / naming_guidelines.md
Last active April 1, 2024 15:39
Naming Guidelines

Naming guidelines

1. Syntax

1.1 Be consistent

Consistency in naming makes reading and memory retrieval much, much easier. Conversely, changing rules and mixing conventions are very confusing and significantly increase cognitive load. Follow language, company, and project conventions for names, even if you don't like them.

1.2 Follow conventions

exercises

syntax

  1. compute 1+1

  2. call the function get with arguments "ciao" and 1

  3. compute (3+4/5)*6

  4. define a vector with the elements 1, "hello" and true

  5. define a vector that contains the keywords :diff and :merge

@IwoHerka
IwoHerka / anf-cesk.rkt
Created October 26, 2020 21:21
Writing an interpreter, CESK-style
#lang racket
; Auxiliary functions:
; update : (a -> b) a b -> (a -> b)
(define (update f x y)
(λ (x*)
(if (equal? x x*)
y
(f x*))))
@IwoHerka
IwoHerka / exercises.py
Last active October 23, 2020 18:19
Python Exercises - Lab 1
# 1. "SUPERSIZE ME.... or rather, this integer!"
# Write a function that rearranges an integer into its largest possible value.
super_size(123456) == 654321
super_size(105) == 510
super_size(12) == 21
# If the argument passed through is single digit or is already the maximum
# possible integer, your function should simply return it.
#
@IwoHerka
IwoHerka / sudoku_validiator_exercise.py
Last active January 7, 2021 15:22
Sudoku Validator Exercise
# Sudoku Background
# Sudoku is a game played on a 9x9 grid. The goal of the game is to fill all
# cells of the grid with digits from 1 to 9, so that each column, each row,
# and each of the nine 3x3 sub-grids (also known as blocks) contain all of
# the digits from 1 to 9. (More info at: http://en.wikipedia.org/wiki/Sudoku)
#
# Sudoku Solution Validator
# Write a function validSolution/ValidateSolution/valid_solution() that
# accepts a 2D array representing a Sudoku board, and returns true if it is
# a valid solution, or false otherwise. The cells of the sudoku board may also
@IwoHerka
IwoHerka / clojure.clj
Created September 11, 2020 09:29
Clojure REPL Lightning Tutorial
; I. Comments ------------------------------------------------------------------
; Comments start with semicolons.
;; By conventions, sometimes two ; are used.
; II. Scalars ------------------------------------------------------------------
; Integers comprise the entire number set, both positive and negative. Any number
; starting with an optional sign or digit followed exclusively by digits is
; considered and stored as some form of integer, although several different
; concrete types are used depending on the circumstance.
42
function popRandom(arr) {
const index = Math.floor(Math.random() * arr.length);
const value = arr[index];
arr.splice(index, 1);
return value;
}
function playRandomStrategy(playerCards, bountyCard) {
const card = popRandom(playerCards);
console.log(`\tPlayer 0 plays: ${card}`);