Adam Monsen

January 31, 2012

Auto-update bind 9 zone database serial numbers

Filed under: Default — Tags: , , — adam @ 3:45 pm PDT

This post is helpful for configuring emacs to automatically update the “Serial” in bind zone databases. I wanted to do the same in Vim, but the solutions in the comments of that post didn’t work for me. Here’s a version that does. It’s yours for free under the Affero GPL v3 (or any later version, at your preference):

function s:BindZoneSettings()
    function s:UpdateBindZoneSerial(date, num)
        if (strftime("%Y%m%d") == a:date)
            return a:date . a:num+1
        endif
        return strftime("%Y%m%d") . '01'
    endfunction
 
    function s:ReplaceBindZoneSerialLine()
        :%s/\(2[0-9]\{7}\)\([0-9]\{2}\)\(\s*;\s*Serial\)/\=UpdateBindZoneSerial(submatch(1), submatch(2)) . submatch(3)/g
    endfunction
 
    autocmd BufWritePre /etc/bind/db.* call ReplaceBindZoneSerialLine()
endfunction

January 5, 2012

Get Back at those Fat Cats!

Filed under: Default — Tags: — adam @ 2:15 pm PDT

Fat Cats logo: purple cat in a business suit smoking a cigar

If you have an iPhone or iPad, check out the game Fat Cats!

Powered by WordPress