Skip to content

Instantly share code, notes, and snippets.

View cnauroth's full-sized avatar

Chris Nauroth cnauroth

View GitHub Profile
@cnauroth
cnauroth / gist:7ff52e9f80e7d856ddb3
Created June 11, 2015 15:18
Hadoop NameNode JMX REST Query for NameNodeStatus
> 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 / xmllint-xpath-query-sample.sh
Created December 31, 2015 22:04
xmllint xpath query sample
#!/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 / .bash_profile
Last active September 30, 2016 22:20
EC2 Hadoop Build Environment Login Greeting
# .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
@cnauroth
cnauroth / game
Created December 31, 2015 16:24
Game JSON schema for jsonschema2pojo StackOverflow question.
{
"javaType": "model.Game",
"properties": {
"data": {
"id": "data",
"properties": {
"about_the_game": {
"id": "about_the_game",
"type": "string"
},
@cnauroth
cnauroth / JavaFloatingPointBug.java
Created August 20, 2011 20:22
demonstration of Java floating point parsing infinite loop bug discovered in 1/2011
// 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);