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 | |
if [ $# -lt 1 ]; then | |
echo usage: "$0 <perl> [<file1> ...]" | |
exit 1 | |
fi | |
sed="$1" | |
shift |
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
FirefoxBinary firefox = new FirefoxBinary(); | |
// allow user to specify which DISPLAY to use if running e.g. Xephyr | |
String display = System.getProperty("firefoxDisplay"); | |
if (display != null) { | |
firefox.setEnvironmentProperty("DISPLAY", display); | |
} | |
WebDriver driver = new FirefoxDriver(firefox, null); |
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
<?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
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
# NOTE: In order to change state, you need to run all three commands for the wanted state | |
# in given order to get the desired effect | |
# Charge battery, and use usb power to power phone (default state after powering up the phone) | |
chmod u+w /sys/class/power_supply/usb/charger_disable | |
echo 0 > /sys/module/pm8921_charger/parameters/disabled | |
echo 0 > /sys/class/power_supply/usb/charger_disable | |
# don't charge battery, but use usb power to power phone | |
chmod u+w /sys/class/power_supply/usb/charger_disable |
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
... | |
#include "myclass.h" | |
... | |
int main(int argc, char *argv[]) | |
{ | |
qmlRegisterType<myclass>("harbour.myapp.myclass", 1, 0, "myclass"); | |
... | |
} |
OlderNewer