Skip to content

Instantly share code, notes, and snippets.

View gkhays's full-sized avatar

Garve Hays gkhays

View GitHub Profile
class Hello {
int test() {
String s = null;
return s == null ? 0 : s.length();
}
}
@gkhays
gkhays / setenv.sh
Created October 28, 2015 14:31 — forked from terrancesnyder/setenv.sh
./setenv.sh - example setenv.sh with defaults set for minimal time spent in garbage collection
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
@gkhays
gkhays / StringUtils.java
Created August 6, 2013 20:49
Quick and dirty C# style isNullOrEmpty helper for Java.
package org.test;
public class Utils
{
private Utils() {}
/**
* Determines whether or not the given string is null or contains an empty
* value.
* @param s
@gkhays
gkhays / ClientThread.java
Last active December 20, 2015 23:19
This is a set of classes used to test FIPS 140-2 and SSL communications in general. The OpenSSL s_server and s_client utilities are a great resource to use as partners in the testing process.
package org.gkh.net;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.logging.Logger;
@gkhays
gkhays / ec2.md
Last active March 4, 2016 20:10
DNS Settings for EC2

My instance ended up with no DNS resolution

nslookup facebook.com
dig +trace facebook.com

didn't work :(

So updated resolv.conf to the following:

@gkhays
gkhays / body.html
Created March 18, 2016 00:50 — forked from mattborn/body.html
Relative gist files
<h1>Hello world!</h1>
@gkhays
gkhays / JavaDocHowTo.java
Last active March 18, 2016 21:14
JavaDoc Common Usage
/**
* Represents the Microsoft Azure AD service. The methods to which you should
* pay attention are {@link #executeJSONChunkRequest(JSONObject, String, int)}
* and {@link #setConfigData(String, int, String, JSONObject)}. These are
* respectively where data requests from <code>DaaS</code> come and where the
* service is configured.
* <p>
* This is the class referenced by collector templates. E.g.
*
* <pre>
@gkhays
gkhays / Docker-Java.txt
Last active March 18, 2016 21:19 — forked from HennIdan/Docker-Java.txt
Installing Java from Oracle
# Download and unarchive Java
RUN mkdir /opt && curl -jksSLH "Cookie: oraclelicense=accept-securebackup-cookie"\
http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz \
| tar -xzf - -C /opt &&\
ln -s /opt/jdk1.7.0_79 /opt/jdk &&\
rm -rf /opt/jdk/*src.zip \
/opt/jdk/lib/missioncontrol \
/opt/jdk/lib/visualvm \
/opt/jdk/lib/*javafx* \
/opt/jdk/jre/lib/plugin.jar \
import java.io.*;
/**
* @see <a href="http://alvinalexander.com/java/edu/pj/pj010016">Running system commands in Java applications</a>
* /
public class JavaRunCommand {
public static void main(String args[]) {
String s = null;
@gkhays
gkhays / Pubnub.py
Created March 21, 2016 15:01 — forked from stephenlb/Pubnub.py
Python Echo Server - Example of Publish / Subscribe Python Echo Server without IP address binding.
## www.pubnub.com - PubNub Real-time push service in the cloud.
# coding=utf8
## PubNub Real-time Push APIs and Notifications Framework
## Copyright (c) 2014-15 Stephen Blum
## http://www.pubnub.com/
## -----------------------------------
## PubNub 3.5.3 Real-time Push Cloud API
## -----------------------------------