Skip to content

Instantly share code, notes, and snippets.

@adutra
adutra / gist:2823578
Created May 29, 2012 09:46
Idea to get localhost
public static InetAddress getLocalHost() throws UnknownHostException {
InetAddress ret = InetAddress.getLocalHost();
if (!ret.isLoopbackAddress()) {
//getLocalHost() did not return the loopback address
ret = InetAddress.getByName("localhost");
if (!ret.isLoopbackAddress()) {
_logger.severe("" + ret.getHostAddress() + " is not a loopback address");
}
}
// _logger.log(Level.SEVERE,"LoopbackAddress: "+ret.isLoopbackAddress());
@adutra
adutra / NamedOutputStreamProcessor.java
Created May 29, 2012 09:39
Changes to enable to plug a log framework
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@adutra
adutra / HtmlUtils.java
Created February 10, 2012 08:50
HtmlCleaner ITagInfoProvider implementation that handles whitespace gracefully
package org.htmlcleaner;
public class HtmlUtils{
/**
* @see "http://www.w3.org/TR/html401/struct/text.html#h-9.1"
* ASCII space (&#x0020;)
* ASCII tab (&#x0009;)
* carriage return (&#x000D;)
* line feed (&#x000A;)
#!/bin/bash
# Argument = -h -v -i groupId:artifactId:version -c classifier -p packaging -r repository
#shopt -o -s xtrace
# Define Nexus Configuration
NEXUS_BASE=http://repository.example.com:8081/nexus
REST_PATH=/service/local
ART_REDIR=/artifact/maven/redirect