Skip to content

Instantly share code, notes, and snippets.

View pkutaj's full-sized avatar

pavol kutaj pkutaj

View GitHub Profile
@pkutaj
pkutaj / publish.py
Created October 11, 2024 04:11
Python Script to Publish to dev.to
import webbrowser
import requests
import json
import os
import sys
headers_dev = {
"Content-Type": "application/json",
"api-key": os.environ["DEV_API_KEY"],
}
NR Type Description Volume Example
1 alias shell alias 0/varies alias ls='ls -l'
2 keyword shell reserved word 19/constant for, if, while, case
3 function shell function 0/varies function hello() { echo 'Hello, world!'; }
4 builtin shell builtin 58/constant cd, echo, read
5 file disk file hundreds/varies /bin/ls, /usr/bin/python
NR Command Description Example
01 . Executes commands from a file. .bashrc (loads the bash configuration file)
02 : Does nothing (useful as a placeholder). true ; echo "This will be printed" (only the second command executes)
03 [ (or test ) Evaluates expressions for conditional statements. [ -f filename ] && echo "File exists" (checks if a file exists)
04 alias Creates or manages aliases (shorter names for commands). `alias l
NR Keyword Description Example
01 if Introduces a conditional statement to execute code based on a condition. if [ $x -gt 0 ]; then echo "Positive number"; fi (checks if x is positive)
02 then Follows the if keyword and marks the beginning of the code to execute if the condition is true. Refer to if example.
03 else Provides an optional block of code to execute if the condition in the if statement is false. if [ $x -gt 0 ]; then echo "Positive"; else echo "Non-positive"; fi (prints based on x value)
04 elif Introduces an additional condition to check within an if state
NR Full Name Shortcut default Description
01 allexport -a off Export all variables to the environment when a new shell is started.
02 braceexpand -B on Enable brace expansion (e.g., {a,b} expands to a b).
03 emacs -e on Use Emacs-style line editing (default).
04 errexit -e off Exit immediately if any command fails (also known as "set -e").
05 errtrace -E off Trap errors in functions and subshells.
@pkutaj
pkutaj / 2023-10-18-Explaining-Diffs-between-Apache-Kafka-and-AWS-Kinesis.md
Created October 18, 2023 09:13
2023-10-18-Explaining-Diffs-between-Apache-Kafka-and-AWS-Kinesis.md
Kafka AWS Kinesis
Operational Model System of brokers (servers that store and process messages) Managed service provided by AWS
Data Writing Writes data to disk, I/O operations carried out by OS Synchronously brokers data streams, writes and replicates ingested data into three different AWS machines
Configurability More control to the operator Machine configuration is ab
@pkutaj
pkutaj / TF1-04.08-Working-with-State-Data4.md
Created October 5, 2023 08:12
TF1-04.08-Working-with-State-Data4.md
STEP CONFIG_FILE STATE_FILE TARGET_ENV(AWS)
#1 aws_instance.nginx remove > empty id-8675366
#2 aws_instance.nginx empty add_additional => id-8675366, id-314777
#3 aws_instance.nginx add > aws_instance.nginx = id-314777 id-8675366, id-314777
@pkutaj
pkutaj / TF1-04.08-Working-with-State-Data.md
Created October 5, 2023 08:12
TF1-04.08-Working-with-State-Data.md
STEP CONFIG_FILE STATE_FILE TARGET_ENV(AWS)
manual remove > empty aws_instance.nginx = id-8675366 id-8675366
apply #1 empty aws_instance.nginx = id-8675366 destroy => empty
apply #2 empty remove => empty empty
@pkutaj
pkutaj / TF1-04.08-Working-with-State-Data2.md
Created October 5, 2023 08:12
TF1-04.08-Working-with-State-Data2.md
STEP CONFIG_FILE STATE_FILE TARGET_ENV(AWS)
manual aws_instance.nginx aws_instance.nginx = id-314122 destroy > no resource
apply #1 aws_instance.nginx aws_instance.nginx = id-314122 add > id-8675366
apply #2 aws_instance.nginx change > aws_instance.nginx = id-8675366 id-8675366
@pkutaj
pkutaj / TF1-04.08-Working-with-State-Data1.md
Created October 5, 2023 08:11
TF1-04.08-Working-with-State-Data1.md
STEP CONFIG_FILE STATE_FILE TARGET_ENV(AWS)
manual add > aws_instance.nginx empty no resource
apply #1 aws_instance.nginx empty add id-314122
apply #2 aws_instance.nginx add aws_instance.nginx = id-314122 id-314122