Skip to content

Instantly share code, notes, and snippets.

View denzhel's full-sized avatar
🇺🇦

Dennis Zheleznyak denzhel

🇺🇦
View GitHub Profile
@denzhel
denzhel / frigate_telegram_notification.yaml
Last active February 21, 2024 10:32 — forked from NdR91/frigate_telegram_notification.yaml
Frigate - Telegram Notification
blueprint:
name: Frigate - Telegram Notification
description: Create automations to receive Snapshots and Clips from Frigate
domain: automation
input:
camera:
name: Frigate Camera
description: The name of the camera as defined in your frigate configuration (/conf.yml).
target_chat:
name: Target
@denzhel
denzhel / atlassian_ip_ranges.md
Created December 25, 2022 20:50
get IP addresses of atlassian services

To get the IP ranges for a specific service in Atlassian cloud, use this:

curl -s https://ip-ranges.atlassian.com | jq -r '.items[] | select(.product[]=="statuspage") | select (.mask_len<32) | .cidr'
@denzhel
denzhel / aws_ip_addresses.md
Created December 25, 2022 20:48
aws IP addresses for a specific server

To get the IP ranges for a specific service in a specific region, use this:

curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.region=="us-west-1") | select(.service=="S3") | .ip_prefix'
@denzhel
denzhel / snowflake_delete_table.md
Created December 11, 2022 22:08
snowflake delete table privilege

To allow roles to delete talbes in a specific database.schema:

grant DELETE TABLE on <dbName>.<schmeaName> to role <roleName>;
@denzhel
denzhel / snowflake_create_db.md
Created December 11, 2022 22:06
snowflake create database privilege

To grant other roles to be able to create databases privilege:

grant CREATE DATABASE on account to role <roleName>;
@denzhel
denzhel / snowflake_execute_task.md
Created December 11, 2022 22:04
snowflake execute task privilege

If you're getting this error:

Cannot execute task , EXECUTE TASK privilege must be granted to owner role`

You should grant the following privilege using an ACCOUNTADMIN role or similar:

GRANT EXECUTE TASK ON ACCOUNT TO ROLE <roleName>;
@denzhel
denzhel / aws_decode_err_msg.md
Created August 17, 2022 21:51
decode AWS encoded error message

When you get this kind of message:

"code": "UnauthorizedOperation",
       "message": "You are not authorized to perform this operation. Encoded authorization failure message: Q92aQ6....

Make sure you have the proper set of IAM rights, I simply use an assumable administrator role:

eval $(aws sts assume-role \
--role-arn arn:aws:iam::1234567:role/mgmt-assumable-role \
--role-session-name test | \
@denzhel
denzhel / tf_iam_user_rotate.md
Created August 10, 2022 17:52
rotate iam user key with terraform
# create a pair of access key id and access secret key for the user above
resource "aws_iam_access_key" "active" {
  user   = aws_iam_user.travis_ci.name
  status = "Active"
}
# create a pair of rotated access key id and access secret key for the user above
resource "aws_iam_access_key" "rotated" {
  count = var.key_rotation ? 1 : 0
  user  = aws_iam_user.travis_ci.name
@denzhel
denzhel / curl_query_rabbitmq_api.md
Created July 28, 2022 10:42
query rabbitmq's API with curl

To query rabbit's API using curl(e.g list all queues):

curl -u '<user>:<password>' -i -H "content-type:application/json" -X GET "http://127.0.0.1:15672/api/queues"
  1. I’ve identified we have a problem in one of our elasticsearch clusters -> it reached the low water mark - 87%
  2. Shards are not allocated to the nodes who passed the water mark - a couple of them
  3. I’ve increased water marks:
  • low - 95%
  • high - 97%
  • flood - 99%
  1. In the meantime we discussed on our plan and strategy and decided to scale out the cluster by 3 nodes
  2. I’ve created 3 nodes using Terraform
  3. I’ve deployed elasticsearch one by one using Ansible
  4. Decreased the water marks back to default to encourage the cluster to rebalance the