Skip to content

Instantly share code, notes, and snippets.

View oxc's full-sized avatar

Bernhard Frauendienst oxc

  • Munich, Germany
  • 00:59 (UTC +02:00)
View GitHub Profile
@oxc
oxc / BugDemo.java
Last active August 29, 2015 14:20
Eclipse 4.4.2 does not recognize trait Interfaces on scala singleton objects in Java code
/**
* This class demonstrates that Eclipse 4.4.2 for some reason does not recognize
* that the Scala singleton object for the class Implementor does in fact
* implement the interface Interface<String>.
*
* Instead, it shows the error markers mentioned in the comments.
*
* However, the code compiles fine (by the Eclipse compiler!), and in fact
* running this class' main method prints:
*
@oxc
oxc / actual output (bash 4.3.33)
Last active August 29, 2015 14:19
bash process substitution scoping
$ ./procsubtest.sh
Bash version: 4.3.33(1)-release
grep: /dev/fd/63: No such file or directory
grep: /dev/fd/63: No such file or directory
grep: /dev/fd/63: No such file or directory
grep: /dev/fd/63: No such file or directory
grep: /dev/fd/63: No such file or directory
@oxc
oxc / UpdateDNSSerial.vim
Created December 5, 2013 14:46
VIM script for updating serials in bind zone files Put this in your .vimrc to bind the command to F4: map <F4> :call UpdateDNSSerialZone()<CR>
function! s:ParseSerial()
"Search for a line that start with a year and contains the word Serial
let numberOfLine = search('\(19\|20\)\d\d\(0[1-9]\|1[012]\)\(0[1-9]\|[12][0-9]\|3[01]\)\d\d.*[Ss]erial.*')
if numberOfLine == 0
echo "No bind serial found ! so not updating the file"
return { 'lineNo': 0 }
else
"Get the line contents
let line = getline(numberOfLine)
"Extract the serial number