This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// org.w3c.dom.Node | |
org.w3c.dom.bootstrap.DOMImplementationRegistry registry = org.w3c.dom.bootstrap.DOMImplementationRegistry.newInstance(); | |
org.w3c.dom.ls.DOMImplementationLS impl = (org.w3c.dom.ls.DOMImplementationLS) registry.getDOMImplementation("XML 3.0 LS 3.0"); | |
org.w3c.dom.ls.LSSerializer serializer = impl.createLSSerializer(); | |
((org.w3c.dom.DOMConfiguration) serializer).setParameter("xml-declaration", Boolean.FALSE); | |
java.io.StringWriter out = new java.io.StringWriter(); | |
org.w3c.dom.ls.LSOutput output = impl.createLSOutput(); | |
output.setCharacterStream(out); | |
serializer.write(this, output); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.io.StringWriter sw = new java.io.StringWriter(); | |
java.io.PrintWriter pw = new java.io.PrintWriter(sw); | |
printStackTrace(pw); | |
sw.toString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This file should be installed in the remote repository as: | |
# - <path-to-bare-repo.git>/hooks/update if you have a bare repository | |
# - <path-to-regular-repo>/.git/hooks/update if you have a regular repository | |
set -e | |
refname="$1" | |
oldrev="$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="java-members" deleted="false" description="Add logger decl" enabled="true" name="logger">${:importStatic(org.slf4j.Logger,org.slf4j.LoggerFactory.getLogger)}private static final Logger LOGGER = getLogger(${enclosing_type}.class);</template><template autoinsert="true" context="java" deleted="false" description="toString, hashCode, equals using reflection" enabled="true" name="the">${:importStatic(org.apache.commons.lang3.builder.EqualsBuilder.reflectionEquals,org.apache.commons.lang3.builder.HashCodeBuilder.reflectionHashCode,org.apache.commons.lang3.builder.ToStringBuilder.reflectionToString)} | |
@Override | |
public boolean equals(final Object obj) { | |
return reflectionEquals(this, obj, true); | |
} | |
@Override | |
public int hashCode() { | |
return reflectionHashCode(this, true); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
pipe { | |
tags => [ "sar", "loadavg" ] | |
command => "env LANG=C sar -q 5" | |
} | |
pipe { | |
tags => [ "sar", "cpu" ] | |
command => "env LANG=C sar -u 5" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tomcat tomcat = new Tomcat() { | |
@Override | |
public Host getHost() { | |
if (host == null) { | |
host = new StandardHost() { | |
@Override | |
public void addChild(final Container child) { | |
if (child instanceof StandardContext) { | |
setupContextWithNonpersistentSessionManager(child); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: curlum <username> <password> <curl args...> | |
curlum () { | |
user="$1" | |
pass="$2" | |
shift 2 | |
curl --config /dev/fd/3 "$@" 3<<EOF | |
--user $user:$pass | |
EOF | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
username=<user> ; echo -n "xauth add `xauth list :${DISPLAY#*:}`" | sudo su - $username ; sudo su - $username ; echo -n "xauth remove :${DISPLAY#*:}" | sudo su - $username |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ ! -d .git ]; then | |
echo ERROR: Please run this in the root of the git repository | |
exit 1 | |
fi | |
cat > .gitignore <<'EOF' | |
# CVS global ignores | |
RCS |