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 / drop_all_tables.sql
Last active April 18, 2024 14:07
Drop all tables in mysql database
SET @tables = NULL;
SET GROUP_CONCAT_MAX_LEN=1048576;
SELECT GROUP_CONCAT('`', table_schema, '`.`', table_name, '`' SEPARATOR ',') INTO @tables
FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE());
SELECT IF(@tables IS NULL,
'SELECT NULL FROM (SELECT NULL) AS `empty` WHERE 0=1',
CONCAT('DROP TABLE IF EXISTS ', @tables)) INTO @tables;
entryPoints:
web:
address: ":80"
websecure:
address: ":443"
http:
routers:
myrouter:
rule: "Host(`bchain.example.in`)"
# https://github.com/dannysteenman/aws-toolbox
#
# License: MIT
#
# This script deletes all inactive task definitions in the ECS service in all AWS Regions.
import boto3
def get_inactive_task_definition_arns(region):
@Voronenko
Voronenko / docker-compose-spark.yml
Created July 3, 2023 18:56
Quick local spark instance
version: '3'
services:
spark-master:
image: bde2020/spark-master:3.3.0-hadoop3.3
container_name: spark-master
ports:
- "8080:8080"
- "7077:7077"
environment:
- INIT_DAEMON_STEP=setup_spark
@Voronenko
Voronenko / cloudwatch_log_insights_mysql_slow_query_examples.md
Created June 23, 2023 12:38 — forked from qiangxue/cloudwatch_log_insights_mysql_slow_query_examples.md
CloudWatch Log Insights query examples for MySQL slow query log.

Filtering queries

Find slowest write queries

parse @message /Query_time: (?<queryTime>.*?) Lock_time: (<?lockTime>.*?) Rows_sent: (?<rowsSent>.*?) Rows_examined: (?<rowsExamined>.*?)\s(?<query>.*?)$/
  | filter @message like /(?i)insert/
  | sort queryTime desc
  | limit 10
@Voronenko
Voronenko / slow_query_log_dump.py
Created June 23, 2023 12:36 — forked from diafygi/slow_query_log_dump.py
Script to transform Amazon RDS slow log table into the MySQL slow query log format
"""
Queries the slowlog database table maintained by Amazon RDS and outputs it in
the normal MySQL slow log text format. Modified version of the script by
memonic (Thanks!) at https://gist.github.com/1481025
Things to change in this script for your own setup:
<root_user> to your mysql root user (e.g. "root")
<root_pass> to your mysql root password (e.g. "hunter2")
<host_domain> to your mysql root password (e.g. "prod-01.w3rfs2.us-east-1.rds.amazonaws.com")
@Voronenko
Voronenko / .env1
Last active May 2, 2023 13:18
traefik behind traefik
MY_DOMAIN1=<domain for Traefik1's dashboard>
TRAEFIK1_NET=traefik1_net
CF_API_EMAIL=<your CF API email>
CF_ZONE_API_TOKEN=<your Zone API Token>
CF_DNS_API_TOKEN=-<your DNS token>
TRAEFIK2_DNS_MAPPER=traefik2:<static ip of traefik2 in NET1>
TAEAFIK2_HOST_SNI=`traefik.<Traefik2's dashboard domain>`
TRAEFIK2_NET1_ADDRESS=traefik2:443
ufw allow from 192.168.3.0/24 proto tcp to any port 2376
ufw allow from 192.168.3.0/24 proto tcp to any port 2377
ufw allow from 192.168.3.0/24 proto tcp to any port 7946
ufw allow from 192.168.3.0/24 proto udp to any port 7946
ufw allow from 192.168.3.0/24 proto udp to any port 4789
@Voronenko
Voronenko / aws_cli_v1_dirty.sh
Created January 18, 2023 14:58
dummy snippet to dirty get aws cli v1 in python container
#!/bin/bash
curl -O https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py --user
echo "export PATH=~/.local/bin:$PATH" > ~/.bash_profile
source ~/.bash_profile
pip3 install awscli --upgrade --user
#!/bin/bash
for user in $(aws iam list-users --query 'Users[*].UserName' --output text); do
echo $user;
echo "======================";
aws iam list-access-keys --user $user --query "AccessKeyMetadata[].AccessKeyId" --output text
done