Skip to content

Instantly share code, notes, and snippets.

@hang321
hang321 / verifyMySqlOpenFileLimit.sh
Last active December 1, 2018 04:55
verify open file limit on tomcat and mysql
#!/bin/bash
# check mysql file open limit
#
# Assumption:
# 1) ssh without password to host
# 2) mysql connection to remote host
# === configuration here ====
ALL_HOSTS="qadb1 qadb2 qadb3 stagedb1 stagedb2 stagedb3 proddb1 proddb2 proddb3"
SSH_USER="ops"
Guava is just better with JMX
@hang321
hang321 / UrlFailoverRequestInterceptor.java
Created September 13, 2016 01:28
Spring REST client failover to host
package net.hang321.http.client;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.URI;
import java.util.LinkedHashSet;
import java.util.Set;
import org.slf4j.Logger;
@hang321
hang321 / formattedDateTimeInUTC
Created May 12, 2015 04:51
Groovy script for uncommon date time format
def dateTimeFormat = "yyyy-MM-dd HH:mm:ss 'GMT'"
def timeZone = TimeZone.getTimeZone("UTC")
def dateTimeFormatter = new java.text.SimpleDateFormat(dateTimeFormat)
dateTimeFormatter.setTimeZone(timeZone)
def msgTime = dateTimeFormatter.format(new java.util.Date())
println(msgTime)