Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Nauroth cnauroth

View GitHub Profile
@cnauroth
cnauroth / .bash_profile
Last active Sep 30, 2016
EC2 Hadoop Build Environment Login Greeting
View .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
#export JAVA_HOME=/etc/alternatives/java_sdk_1.7.0_openjdk
View xmllint-xpath-query-sample.sh
#!/bin/bash
# Enter XML as a heredoc, pipe it to xmllint, and run an XPath query.
cat <<EOF | xmllint --xpath /catalog/product[@type=\"cloths\"] -
<?xml version="1.0"?>
<!DOCTYPE catalog SYSTEM "catalog.dtd">
<catalog>
<product type="cloths" product_image="cardigan.jpg">
<catalog_item gender="Men's">
@cnauroth
cnauroth / game
Created Dec 31, 2015
Game JSON schema for jsonschema2pojo StackOverflow question.
View game
{
"javaType": "model.Game",
"properties": {
"data": {
"id": "data",
"properties": {
"about_the_game": {
"id": "about_the_game",
"type": "string"
},
@cnauroth
cnauroth / gist:7ff52e9f80e7d856ddb3
Created Jun 11, 2015
Hadoop NameNode JMX REST Query for NameNodeStatus
View gist:7ff52e9f80e7d856ddb3
> curl 'http://172.20.11.177:50070/jmx?qry=Hadoop:service=NameNode,name=NameNodeStatus'
{
"beans" : [ {
"name" : "Hadoop:service=NameNode,name=NameNodeStatus",
"modelerType" : "org.apache.hadoop.hdfs.server.namenode.NameNode",
"State" : "active",
"NNRole" : "NameNode",
"HostAndPort" : "localhost:19000",
"SecurityEnabled" : false,
"LastHATransitionTime" : 0
@cnauroth
cnauroth / JavaFloatingPointBug.java
Created Aug 20, 2011
demonstration of Java floating point parsing infinite loop bug discovered in 1/2011
View JavaFloatingPointBug.java
// This causes certain versions of the JVM to enter an infinite loop.
// For more details, see:
// http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
// http://www.exploringbinary.com/fpupdater-fixes-the-java-2-2250738585072012e-308-bug/
public class JavaFloatingPointBug {
public static void main(String[] args) {
System.out.println("Test:");
double d = Double.parseDouble("2.2250738585072012e-308");
System.out.println("Value: " + d);