Skip to content

Instantly share code, notes, and snippets.

View darko-mesaros's full-sized avatar
🎯
Focusing

Darko Mesaros darko-mesaros

🎯
Focusing
View GitHub Profile
@darko-mesaros
darko-mesaros / 100_doc_rust_day8.rs
Created January 12, 2024 21:22
100 Days of Code - Rust. Day 8, doing magic with Vectors!
// Given a list of integers use vector and return:
// - mean (average value of all elements)
// - median (middle of the vector)
// - mode (the value that occurs most often).
use rand::Rng;
use std::collections::HashMap;
// function to generate x amount of random numbers
fn generate_rand_vector(num: u32) -> Vec<u32> {
@darko-mesaros
darko-mesaros / HolidayBasic.bas
Created December 23, 2022 18:06
Commodore 64 BASIC Christmas tree and snowflakes
0 gosub 10: print chr$(147)chr$(5):sys59749
1 print chr$(19)chr$(13)chr$(13)spc(rnd(.)*38)"*";
2 print chr$(19):sys59777:goto 1
10 print chr$(147): poke53280,0: poke 53281,0
20 v=53248
30 poke v+37,5: rem multicolor 1
40 poke v+38,1: rem multicolor 2
50 poke v+21,255 : rem set all 8 sprites visible
60 for x=12800 to 12800+63: read y: poke x,y: next x: rem sprite generation
@darko-mesaros
darko-mesaros / tmux.conf
Created April 4, 2021 09:16
My tmux configuration file
# B A S I C S
## Replace c-B with c-A
unbind C-b
set -g prefix C-a
bind-key -r C-a send-prefix
# O P T I O N S
## Set 256 color mode
@darko-mesaros
darko-mesaros / tmux.conf
Created September 3, 2020 18:33
My tmux configuration
# B A S I C S
## Replace c-B with c-A
unbind C-b
set -g prefix C-a
bind-key -r C-a send-prefix
# O P T I O N S
## Set 256 color mode
@darko-mesaros
darko-mesaros / secrets_manager_commands.sh
Created September 3, 2020 17:25
Commands used on the AWS Secrets Manager Stream
# Get all Latest Windows AMIs
aws ssm get-parameters-by-path \
--path /aws/service/ami-windows-latest
# Get all regions where Cloud9 is available inj
aws ssm get-parameters-by-path \
--path /aws/service/global-infrastructure/services/cloud9/regions --output json \
| jq .Parameters[].Value | sort
# Get all services available in the af-south-1 region
@darko-mesaros
darko-mesaros / codeshots-cdk-testpipeline.ts
Last active July 28, 2020 13:35
CDK - Testing bit of CodePipeline where we setup a testing stage to test CloudFormation templates with Lambda
// --- test stage and actions ---
const prepTestChanges = new codepipeline_actions.CloudFormationCreateReplaceChangeSetAction({
actionName: 'PrepTestChanges',
stackName: stageStackName,
changeSetName: stageChangeSetName,
adminPermissions: true,
parameterOverrides: {
"Environment":
@darko-mesaros
darko-mesaros / cfn-single-ec2-instance.yml
Created July 28, 2020 08:08
A CloudFormation template that creates a simple EC2 instance
AWSTemplateFormatVersion: "2010-09-09"
Description: >
This is my template that creates a simple EC2 instance
# Parameters
Parameters:
InstanceName:
Type: String
Description: Name your EC2 instance - dont
KeyPair:
figlet -c -f ~/.local/share/fonts/figlet-fonts/3d.flf $argv | lolcat
@darko-mesaros
darko-mesaros / appconfig.yml
Created June 15, 2020 07:57
Create AppConfig configuration in Parameter Store
AWSTemplateFormatVersion: "2010-09-09"
Description: >
https://twitch.tv/ruptwelve
Parameters:
NumOfRows:
Type: String
Description: Number of Rows for your config
Default: please-change-me
Resources:
### PARAMETER STORE ###
@darko-mesaros
darko-mesaros / cdk-asg-userdata.ts
Created June 8, 2020 08:50
AWS CDK - Launch an EC2 Autoscaling Group with userdata read of disk
// VPC
const vpc = new ec2.Vpc(this, 'VPC');
// Security group
const webSg = new ec2.SecurityGroup(this, 'WebSG',{
vpc: vpc,
allowAllOutbound: true,
description: "Web Server Security Group"
});
webSg.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(8080), 'Web from anywhere')