Skip to content

Instantly share code, notes, and snippets.

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

Dmytro Kaharlytskyi kagarlickij

🏠
Working from home
View GitHub Profile
@kagarlickij
kagarlickij / set-CloudWatchAlarms.ps1
Last active March 11, 2023 05:51
This one is for setting CloudWatch Alarms & actions
Import-Module -Name AWSPowerShell
$sns = "arn:aws:sns:eu-west-1:851073832283:Monitoring-ops"
$instance_id = (Invoke-Restmethod -uri http://169.254.169.254/latest/meta-data/instance-id)
$volume_id = (@(get-ec2volume) | Where-Object { $_.Attachments.InstanceId -eq $instance_id}).VolumeId
$DimensionInstance = New-Object 'Amazon.CloudWatch.Model.Dimension'
$DimensionInstance.Name = 'instance_id'
$DimensionInstance.Value = $instance_id
@kagarlickij
kagarlickij / get-currentJiraSprint.sh
Last active March 3, 2023 16:37
This one is to get current Jira sprint number
#!/bin/bash
# This one is to be executed once to figure out rapidBoardId
#curl -u kagarlickij:Password -X GET -H "Content-Type: application/json" 'https://kagarlickij.atlassian.net/rest/greenhopper/1.0/rapidviews/list'
curl -u USER:PASSWORD -X GET -H "Content-Type: application/json" \
'https://JIRA.DOMAIN.NAME/rest/greenhopper/1.0/sprintquery/17?includeFutureSprints=true&includeHistoricSprints=false' \
| /usr/local/bin/jq '.sprints[] | select(.name | contains("PROJECTNAME")) | select(.state == "ACTIVE") | .name' | sed 's/[^0-9]*//g' > currentSprint.txt
echo "Current Sprint number in Jira is $(cat currentSprint.txt)"
#!/bin/bash
echo "Installing SqlCmd.."
if [[ $(sqlcmd | grep Version) != *"13."* ]]; then {
repoPrConf="/etc/yum/pluginconf.d/priorities.conf"
rm -f ${repoPrConf}
cat >> ${repoPrConf} << EOF
[main]
enabled = 0
@kagarlickij
kagarlickij / README.md
Created November 18, 2021 12:04
Clean history of Git branch

git checkout --orphan TEMP_BRANCH
git add -A
git commit -am "cleanup"
git branch -D master
git branch -m master
git push -f origin master

@kagarlickij
kagarlickij / pylint.svg
Last active June 28, 2020 11:46
Created via API
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kagarlickij
kagarlickij / send_email.py
Created April 18, 2020 15:20
Python snippet to send email
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
import sys
import os
smtpLogin = sys.argv[1]
smtpPassword = sys.argv[2]
smtpServer = sys.argv[3]
smtpPort= sys.argv[4]
@kagarlickij
kagarlickij / EXEC_CMD.md
Created January 24, 2020 10:45
Sample Ansible playbook that uses Windows hostname for creating file and running command

ansible-playbook -vvvv -i hosts playbook.yml --extra-vars='ansible_user=ansible ansible_password=A****0+ ansible_connection=winrm ansible_winrm_server_cert_validation=ignore var1=value1'

@kagarlickij
kagarlickij / s3.py
Created December 16, 2019 09:05
Snippet creates AWS S3 bucket using Python with Boto3
# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.create_bucket
import json
import boto3
from botocore.exceptions import ClientError
# Default values
aws_region = 'eu-west-1'
client_name = 'kag'
environment = 'sbx'
@kagarlickij
kagarlickij / .zshrc
Last active August 12, 2019 10:47
This is ZSH config file located in ~/
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/kagarlickij/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="powerlevel9k/powerlevel9k"
@kagarlickij
kagarlickij / powerlevel9k.zsh-theme
Last active May 29, 2019 17:02
This is my config for Powerlevel9k theme for ZSH located in ~/.oh-my-zsh/custom/themes/powerlevel9k
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
################################################################
# powerlevel9k Theme
# https://github.com/bhilburn/powerlevel9k
#
# This theme was inspired by agnoster's Theme:
# https://gist.github.com/3712874
################################################################
################################################################