Skip to content

Instantly share code, notes, and snippets.

View urjitbhatia's full-sized avatar

Urjit Singh Bhatia urjitbhatia

View GitHub Profile
@urjitbhatia
urjitbhatia / get-dind-sibling-ip
Created August 14, 2020 00:53
Fetch the ip address of a sibling container from a docker-in-docker run
$(docker inspect my-sibling-dind-container --format '{{ .NetworkSettings.IPAddress }}')
-- Make sure both run on the same "network" (bridge by default in most cases)
@urjitbhatia
urjitbhatia / mysql_delete_chunked.sql
Created April 20, 2021 00:56
Aurora mysql delete in chunk
--- Simple table to keep track of delete chunks
create table _delete_log
(
log varchar(200) null,
createdAt timestamp null
);
------------ Stored proc definition ---------------
DROP PROCEDURE IF EXISTS delete_chunks;
DELIMITER $$
@urjitbhatia
urjitbhatia / ptonline.sh
Created April 21, 2021 23:16
pt-online-schema-change
# Command to run pt online schema change
pt-online-schema-change \
D=<dbname>,t=<table_name>,h=<hostname>,u=<username> \
--alter="<alter sql>" \
--ask-pass \
--execute \
--max-load 100 \
--critical-load 120
@urjitbhatia
urjitbhatia / dnsquerylogger.sh
Last active May 19, 2021 18:52
easy way to continuously log dns queries
#!/bin/bash
# replace any with a specific interface you want to monitor or just use any to capture all interfaces
tcpdump -i any 'dst port 53' >> /var/log/dnsqueries.log
#### If using supervisord, use this template for setting up the program entry:
# [program:dnsworker]
# command=bash dnsquerylogger.sh
# autostart=true
# autorestart=true