Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Madhur Ahuja madhur

🎯
Focusing
View GitHub Profile
@madhur
madhur / my2.sql
Last active Jun 14, 2020
MySQL Stats collector
View my2.sql
-- Create Database, Tables, Stored Routines and Jobs for My2 dashboard
create database IF NOT EXISTS my2;
use my2;
CREATE TABLE IF NOT EXISTS status (
VARIABLE_NAME varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT '',
VARIABLE_VALUE varchar(1024) CHARACTER SET utf8 DEFAULT NULL,
HOST varchar(128) CHARACTER SET utf8 DEFAULT 'MyHost', -- concat(@@hostname, ':', @@port),
TIMEST timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB;
@madhur
madhur / javacert.sh
Created Mar 7, 2020
Import certificate into java keystore
View javacert.sh
#!/usr/bin/env bash
# Exit on error
set -e
# Ensure script is running as root
if [ "$EUID" -ne 0 ]
then echo "WARN: Please run as root (sudo)"
exit 1
fi
View pmd-rules.xml
<?xml version="1.0" ?>
<ruleset name="Custom Rules" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>
Tesseract custom rules
</description>
<rule ref="category/java/bestpractices.xml/AbstractClassWithoutAbstractMethod" />
<rule ref="category/java/bestpractices.xml/AccessorClassGeneration" />
@madhur
madhur / checks.xml
Created Jan 26, 2020
Checkstyle configuration
View checks.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the Google coding conventions from Google Java Style
that can be found at https://google.github.io/styleguide/javaguide.html.
Checkstyle is very configurable. Be sure to read the documentation at
@madhur
madhur / docker-compose.yml
Last active Sep 11, 2019
graphite-statsd docker
View docker-compose.yml
version: '3'
services:
graphite-statsd:
image: graphiteapp/docker-graphite-statsd
ports:
- 2003-2004:2003-2004
- 2023-2024:2023-2024
- 8125:8125/udp
View longestplaindromic.java
class Solution {
public String longestPalindrome(String str) {
int index1=0;
int index2=0;
boolean isPalin = true;
if(str.length()==0) {
return str;
}
if(str.length()==1) {
View mergeinterval.java
// java.util.* and java.util.streams.* have been imported for this problem.
// You don't need any other imports.
public static ArrayList<Interval> insertRange(ArrayList<Interval> intervalsList, Interval insert) {
ArrayList<Interval> merged = new ArrayList<Interval>();
if(intervalsList.size() == 0) {
merged.add(insert);
View makechange2.java
public static int makeChange(int[] coins, int amount) {
if (coins != null && coins.length > 0 && amount >= 0)
return makeChange(coins,amount,0);
return 0;
}
public static int makeChange(int[] coins, int amount, int current_coin_index) {
int next_coin_index;
if (current_coin_index < coins.length - 1){
//If the coin index is less than the last index, increment the index.
View makechange.java
// java.util.* and java.util.streams.* have been imported for this problem.
// You don't need any other imports.
public static int makeChange(int[] coins, int amount) {
int counter = 0;
int currentCoinIndex = 0;
Integer[] answer = new Integer[1];
answer[0] = 0;
View ipmatching.java
// java.util.* and java.util.streams.* have been imported for this problem.
// You don't need any other imports.
public static ArrayList<String> generateIPAddrs(String s) {
Stack<IpLevelNode> st = new Stack<>();
ArrayList<String> answer = new ArrayList<>();
Character c = s.charAt(0);
Integer numValue = Character.getNumericValue(c);
You can’t perform that action at this time.