Skip to content

Instantly share code, notes, and snippets.

View vithalreddy's full-sized avatar
🔥

Vithal Reddy vithalreddy

🔥
View GitHub Profile
/*
JSON-to-Go
by Matt Holt
https://github.com/mholt/json-to-go
A simple utility to translate JSON into a Go type definition.
*/
function jsonToGo(json, typename) {
let data;
let scope;
@vithalreddy
vithalreddy / cursortable.js
Created May 6, 2022 10:10 — forked from nmoinvaz/cursortable.js
Antd Cursor Paginated Table Component
import React, { useEffect, useState } from "react";
import { Table, Button, Space, Row, Col } from "antd";
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
const CursorPagination = ({ lastEvaluatedKey, onChange, size }) => {
/* Use stack to keep track of which evaluated keys have been previously seen */
const [ prevEvaluatedKeys, setPrevEvaluatedKeys ] = useState([]);
/* Keep track of the current evaluated key */
const [ currentEvaluatedKey, setCurrentEvaluatedKey ] = useState(null);
@vithalreddy
vithalreddy / mysql - kill all sleeping connections
Created January 11, 2022 07:33 — forked from lucashungaro/mysql - kill all sleeping connections
MySQL - kill command for all idle queries
SELECT GROUP_CONCAT('kill ',id SEPARATOR '; ') AS kill_list
FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE command='Sleep';
@vithalreddy
vithalreddy / cloudwatch_log_insights_mysql_slow_query_examples.md
Created November 8, 2021 12:15 — forked from grocky/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
@vithalreddy
vithalreddy / mongo_db_recover_delete_record.py
Created May 7, 2018 09:13 — forked from egguy/mongo_db_recover_delete_record.py
Recover deleted data from mongo DB database
"""A little script to recover deleted recording of a mongoDB db file
There's no optimization but it work and has saved me
"""
import struct
import bson
import pymongo
import sys
@vithalreddy
vithalreddy / roles_invesitgation.md
Created February 23, 2018 06:23 — forked from facultymatt/roles_invesitgation.md
Roles and permissions system for Nodejs
@vithalreddy
vithalreddy / directives.js
Created October 29, 2017 13:34 — forked from elizabeth-young/directives.js
Some Angular validation directives
'use strict';
var directives = angular.module('app', []);
// override the default input to update on blur
directives.directive('input', function () {
return {
restrict: 'E',
require: 'ngModel',
link: function (scope, elm, attr, ngModelCtrl) {
if (attr.type === 'radio' || attr.type === 'checkbox') return;