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 / 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
@Voronenko
Voronenko / aws_authorize_runner_dynamic.sh
Last active March 26, 2024 13:49
Example on dynamically authorize access to machine ssh port for the deployment
#!/bin/bash
public_ip_address=$(wget -qO- http://checkip.amazonaws.com)
echo "this runner public ip address is $public_ip_address"
VPC_ID=$(aws ec2 describe-vpcs --filters Name=tag:Name,Values=${env}-main-vpc --query "Vpcs[].VpcId" --output text)
GROUP_ID=$(aws ec2 describe-security-groups --filter Name=vpc-id,Values=$VPC_ID Name=group-name,Values=${env}-public-sg --query 'SecurityGroups[*].[GroupId]' --output text)
aws ec2 authorize-security-group-ingress --group-id $GROUP_ID --ip-permissions "[{\"IpProtocol\": \"tcp\", \"FromPort\": 22, \"ToPort\": 22, \"IpRanges\": [{\"CidrIp\": \"${public_ip_address}/32\"}]}]"
...
#!/usr/bin/env bash
activation_file=${UNITY_ACTIVATION_FILE:-./unity3d.alf}
if [[ -z "${UNITY_USERNAME}" ]] || [[ -z "${UNITY_PASSWORD}" ]]; then
echo "UNITY_USERNAME or UNITY_PASSWORD environment variables are not set, please refer to instructions in the readme and add these to your secret environment variables."
exit 1
fi
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \