Skip to content

Instantly share code, notes, and snippets.


Jonas Berlin xkr47

View GitHub Profile
xkr47 / flowdock-new.css
Created Dec 12, 2012 — forked from anonymous/flowdock-new.css
New flowdock line-compress css for use with "Stylish" plugin in Firefox, v2
View flowdock-new.css
@namespace url(;
@-moz-document domain("") {
.chat-message, .comment-message, .action-message, .line-message, .status-message, .file-message, .error-message {
padding-top: 0 !important;
padding-bottom: 0 !important;
font-family: Ubuntu,Tahoma,sans-serif !important;
font-size: 10px !important;
xkr47 / diff_-u_colors
Last active Dec 12, 2015
Colorify "diff -u" output
View diff_-u_colors
use File::Temp qw/ :mktemp /;
my @params = grep(/^-/,@ARGV);
@ARGV = grep(!/^-/,@ARGV);
my $tmp = $ENV{"TMP"};
$tmp = "/tmp" unless(defined($tmp));
($tmpfh, $tmpfile) = mkstemp($tmp."/diff_u.XXXXXX");
xkr47 / PPFConfig.xml
Created Jun 17, 2013
snippet for configuring PPF 1.0.0 and newer to use UTF-8 for output and input, falling back to some other charset if utf-8 decoding fails
View PPFConfig.xml
xkr47 / pom.xml
Created Aug 13, 2013
pom.xml: When using slf4j, make sure we don't accidentally depend on commons-logging
View pom.xml
xkr47 /
Created Aug 29, 2013
log4j configuration with different colors for different log levels - also works with Eclipse Ansi Console:
# Default level is INFO
# and for com.some.package.* log everything
xkr47 / firefox
Last active Dec 28, 2015
~/bin/firefox wrapper script for using custom (older) firefox version only when running Robot Framework tests
View firefox
if [ "$1" = "-profile" ]; then
exec ${HOME}/firefox-20.0/firefox "$@"
echo Failed to start Firefox
exit 1
exec /usr/bin/firefox "$@"
xkr47 / setup-readonly-git-remote-with-checkout
Last active Jul 6, 2018
How to set up a remote (non-bare) Git repository with read-only checkout of some branch to automatically update on push. This assumes you have already created a regular repository in the remote location already; typically just "git init".
View setup-readonly-git-remote-with-checkout
cat > .git/hooks/post-receive <<EOF
set -e
cd ..
unset GIT_DIR
git reset --hard HEAD --
# put any additional cleanup/reload commands here
chmod ug+rx .git/hooks/post-receive
xkr47 /
Last active May 13, 2019
Make Tomcat shut down automatically if any component fails to start up (written for tomcat version 7.0.47)
import static org.apache.catalina.Lifecycle.*;
import static org.apache.catalina.LifecycleState.*;
import org.apache.catalina.*;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
// ...
tomcat.getServer().addLifecycleListener(new LifecycleListener() {
public void lifecycleEvent(final LifecycleEvent event) {
xkr47 / git-mvs
Created Feb 24, 2014
Rename all *.sh files to *.pl: git mvs 's/\.sh$/.pl/' *.sh
View git-mvs
if [ $# -lt 1 ]; then
echo usage: "$0 <perl> [<file1> ...]"
exit 1
xkr47 /
Created Mar 14, 2014
How to set up webdriver to optionally use alternative DISPLAY setting for browser
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);
You can’t perform that action at this time.