Skip to content

Instantly share code, notes, and snippets.

View Voronenko's full-sized avatar
turning coffee into code since late 90s

Vyacheslav Voronenko

turning coffee into code since late 90s
View GitHub Profile
@Voronenko
Voronenko / dirty_helm_patch.sh
Created October 19, 2022 19:50
Dirty helm patch
yq e ".appVersion = \"${FINAL_BUILD_REF_SLUG}-${FINAL_COMMIT_SHORT_SHA}\"" -i ./your-local-chart/Chart.yaml
helm upgrade your-deployment ./your-local-chart --install --set image.tag=${FINAL_BUILD_REF_SLUG} --namespace yournamespace --create-namespace
kubectl rollout restart deployment your-deployment --namespace yournamespace
@Voronenko
Voronenko / gitlab_previous_branch.sh
Created October 19, 2022 11:20
Gitlab getting merged branch name
- MR_BRANCH_LAST_COMMIT_SHA=$(
curl -s \
--header "PRIVATE-TOKEN: $CI_PRIVATE_TOKEN" \
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/repository/commits/$CI_COMMIT_SHA" |\
jq -r '.parent_ids | del(.[] | select(. == "'$CI_COMMIT_BEFORE_SHA'")) | .[-1]'
)
- MR_BRANCH_NAME=$(
curl -s \
--header "PRIVATE-TOKEN: $CI_PRIVATE_TOKEN" \
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/repository/commits/$MR_BRANCH_LAST_COMMIT_SHA/merge_requests" |\
@Voronenko
Voronenko / unused_sg_group_candidates.sh
Created September 26, 2022 10:42
DOES NOT take into consid. LB
#!/usr/bin/bash
# all groups
aws ec2 describe-security-groups \
| jq --raw-output '.SecurityGroups[] | [.GroupName, .GroupId] | @tsv' \
| sort > /tmp/sg.all
# groups in use
aws ec2 describe-network-interfaces \
| jq --raw-output '.NetworkInterfaces[].Groups[] | [.GroupName, .GroupId] | @tsv' \
@Voronenko
Voronenko / circleci_conditions.md
Created July 29, 2022 11:46
CIRCLECI CONDITIONS

With the recent addition of advanced logic in a config file, the option to conditionally trigger steps in a job or to conditionally trigger a workflow is now available.

Specific logic statements can be used to create multiple nested conditions, that will always at the top level result in true or false -- which in turn determines if the workflow or steps are triggered.

Type Arguments true if Example
YAML literal None is truthy true/42/"a string"
YAML alias None resolves to a truthy value *my-alias
@Voronenko
Voronenko / borg-borgmatic.markdown
Created July 18, 2022 08:37 — forked from BoxedBrain/borg-borgmatic.markdown
Install Borg-Backup & Borgmatic

Install Borg-Backup & Borgmatic

update packages

sudo apt update

Borg installation

go to tmp folder

cd /tmp/
nmcli -g name,type connection show --active | awk -F: '/ethernet|wireless/ { print $1 }' | while read connection
do
nmcli con mod "$connection" ipv6.ignore-auto-dns yes
nmcli con mod "$connection" ipv4.ignore-auto-dns yes
nmcli con mod "$connection" ipv4.dns "8.8.8.8 8.8.4.4"
nmcli con down "$connection" && nmcli con up "$connection"
done
@Voronenko
Voronenko / cluster-autoscaler-priority-expander.yaml
Created June 10, 2022 10:41
Example of preference for scaling
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-autoscaler-priority-expander
namespace: kube-system
data:
priorities: |-
10:
- .*
20:
@Voronenko
Voronenko / curl_to_ses.sh
Created March 17, 2022 13:15
dummy script to send file via SES
#!/bin/bash
sesAccess='AKIAXXXXXXXXXXXXXXXX' sesSecret='Bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
sesFromName="Joe McJones"
sesFromAddress="[email protected]"
sesToName="Mary McMary"
sesToAddress="[email protected]"
sesSubject="Test Email from Script"
sesSMTP="email-smtp.us-east-1.amazonaws.com"
sesPort="465"
@Voronenko
Voronenko / S3_to_email.py
Created March 17, 2022 12:14
dummy lambda to send file uploaded to email
import os.path
import boto3
import email
from botocore.exceptions import ClientError
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
s3 = boto3.client("s3")
@Voronenko
Voronenko / aws_subnets.ps1
Created February 7, 2022 21:21
AWS subnets PS1
# For AWS services, you can get the IP addresses using the following URL:
# https://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html
#You can also filter the IP address using the APIs. I am sharing one such example for filtering with power shell:
Get-AWSPublicIpAddressRange -ServiceKey AMAZON -Region ap-south-1 | where {$_.IpAddressFormat -eq "Ipv4"} | select IpPrefix