Skip to content

Instantly share code, notes, and snippets.

View shukla2112's full-sized avatar
👋
Hi!

Nikunj Shukla shukla2112

👋
Hi!
View GitHub Profile
{
"thread_id": "ThreadId 33427876",
"worker_id": "8857d877-bfa8-42c5-bdf4-5ec9b64b1888",
"tenant_id": "4d3c722d-65f4-4f79-96e2-6c5e27655e3b",
"type": "query-log",
"timestamp": "2021-06-08T06:14:02.464+0000",
"level": "info",
"detail": {
"kind": "database",
"request_id": "053e5ab4fba673935c4085f1a35feee4",
@shukla2112
shukla2112 / node_exporter.sh
Created February 24, 2020 06:12
Install node exporter for the ubuntu machines
#!/bin/bash
useradd -m -s /bin/bash prometheus
# (or adduser --disabled-password --gecos "" prometheus)
# Download node_exporter release from original repo
curl -L -O https://github.com/prometheus/node_exporter/releases/download/v0.17.0/node_exporter-0.17.0.linux-amd64.tar.gz
tar -xzvf node_exporter-0.17.0.linux-amd64.tar.gz
mv node_exporter-0.17.0.linux-amd64 /home/prometheus/node_exporter
@shukla2112
shukla2112 / hpa_fix.sh
Last active March 31, 2020 03:26
fixes hpa issue while deployment is triggered
#!/bin/bash
set -e
# STEPS
# 1. Set the HPA max to current replicas
# 2. Set image
# 2.1 wait for deployment to be completed or 15 mins
# 3. Set max hpa to original number
@shukla2112
shukla2112 / preload.js
Created February 5, 2019 10:17
puppeteer with resident google chrome - working with high blocking sites
// overwrite the `languages` property to use a custom getter
Object.defineProperty(navigator, "languages", {
get: function() {
return ["en-US", "en"];
};
});
// overwrite the `plugins` property to use a custom getter
Object.defineProperty(navigator, 'plugins', {
get: function() {
@shukla2112
shukla2112 / cronsOps.sh
Created January 11, 2019 08:38
cron operations
# Comment out the root user cronjob
sudo crontab -l | sed '/\/usr\/local\/bin\/my-cron/s!^!#!' | sudo crontab -u root -
{
"_id" : ObjectId("5ba8b98e85bdad9c2ed3c200"),
"images" : [
"https://images-na.ssl-images-amazon.com/images/I/41o7vaHoIoL.jpg",
"https://images-na.ssl-images-amazon.com/images/I/41o7vaHoIoL._SY300_.jpg"
],
"features" : {
"blob" : "Lightweight and easy to move; Easy-to-clean laminated surfaces; Durable design especially for kids; Safe, soft, rounded edges; Leg boots to reduce noise and prevent rust",
"Item model number" : "FBA_AB7905PG"
},
@shukla2112
shukla2112 / mongodb_collection_sizes.js
Created July 6, 2018 06:49 — forked from joeyAghion/mongodb_collection_sizes.js
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
var collectionNames = db.getCollectionNames(), stats = [];
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
stats = stats.sort(function(a, b) { return b['size'] - a['size']; });
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); }
@shukla2112
shukla2112 / pgOpsGuide.md
Last active October 20, 2023 07:27
Postgresql operations

This guide includes queries for postgreql

misc/utility commands

Set pager off

\pset pager off
  1. Check when vaccum was run
@shukla2112
shukla2112 / redis_key_sizes.sh
Created July 27, 2017 09:56 — forked from epicserve/redis_key_sizes.sh
A simple script to print the size of all your Redis keys.
#!/usr/bin/env bash
# This script prints out all of your Redis keys and their size in a human readable format
# Copyright 2013 Brent O'Connor
# License: http://www.apache.org/licenses/LICENSE-2.0
human_size() {
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } '
}