# HG changeset patch # User Tomas Zeman # Date 1319441873 -7200 # Node ID c61439c91a8a39de527f150e110d64f0476c4887 # Parent 5b37cf0009bd6ca5481294f93a33fc66a27bf1af# Parent 090b5c8705765b1d3f70af26fbac603eb43730bd branch merge (.ctags) diff -r 5b37cf0009bd -r c61439c91a8a config/.ctags --- a/config/.ctags Mon Oct 24 09:35:50 2011 +0200 +++ b/config/.ctags Mon Oct 24 09:37:53 2011 +0200 @@ -2,6 +2,7 @@ --langmap=scala:.scala --regex-scala=/^[ \t]*abstract class[ \t]+([a-zA-Z0-9_]+)/\1/c,abstract classes/ --regex-scala=/^[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\1/c,classes/ +--regex-scala=/^[ \t]*final class[ \t]+([a-zA-Z0-9_]+)/\1/c,classes/ --regex-scala=/^[ \t]*sealed trait[ \t]+([a-zA-Z0-9_]+)/\1/t,sealed traits/ --regex-scala=/^[ \t]*trait[ \t]+([a-zA-Z0-9_]+)/\1/t,traits/ --regex-scala=/^[ \t]*type[ \t]+([a-zA-Z0-9_]+)/\1/T,types/ @@ -15,4 +16,5 @@ --regex-scala=/^[ \t]*case object[ \t]+([a-zA-Z0-9_]+)/\1/o,objects/ --regex-scala=/^[ \t]*private def[ \t]+([a-zA-Z0-9_]+)/\1/pd,defs/ --regex-scala=/^[ \t]*protected def[ \t]+([a-zA-Z0-9_]+)/\1/pd,defs/ +--regex-scala=/^[ \t]*implicit def[ \t]+([a-zA-Z0-9_]+)/\1/id,implicit defs/ diff -r 5b37cf0009bd -r c61439c91a8a config/.vim/filetype.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/.vim/filetype.vim Mon Oct 24 09:37:53 2011 +0200 @@ -0,0 +1,5 @@ +" TXT files - default width +au BufNewFile,BufRead *.txt set tw=78 + +" INI file syntax +au BufNewFile,BufRead *.ini,*/.hgrc,*/.hg/hgrc setf ini diff -r 5b37cf0009bd -r c61439c91a8a config/.vim/syntax/ini.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/.vim/syntax/ini.vim Mon Oct 24 09:37:53 2011 +0200 @@ -0,0 +1,27 @@ +" Vim syntax file +" Language: Vim 7.2 script +" Filenames: *.ini, .hgrc, */.hg/hgrc +" Maintainer: Peter Hosey +" Last Change: Nov 11, 2008 +" Version: 7.2-02 + +" Quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +syn match iniSection skipwhite contains=iniRule "^\[.\+\]$" + +syn match iniRule "^[^=:]\{-1,}=" +syn match iniRule "^[^:=]\{-1,}:" + +syn match iniComment skipwhite "^[#;].*" + +" Highlighting Settings +" ==================== + +hi def link iniSection Keyword +hi def link iniRule Identifier +hi def link iniComment Comment + +let b:current_syntax = "ini" diff -r 5b37cf0009bd -r c61439c91a8a kermit/cisco-ios-connect --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kermit/cisco-ios-connect Mon Oct 24 09:37:53 2011 +0200 @@ -0,0 +1,85 @@ +#!/usr/bin/env -S kermit + +# +# Author: Tomas Zeman +# This script belongs to public domain. Use it as you wish. +# +# Connects to a Cisco box via SSH and displays IOS version and running config. +# Handles --More-- prompt accordingly. +# Command session is printed to stdout, error and trace messages to stderr. +# +# Invocation: +# ./connect <> +# +# Environment: +# SSH_USER - ssh user +# SSH_PASS - password +# ENA_PASS - enable password +# + +define waitfor { + while true { + minput \%1 {\%2} {--More--} + if fail die_error \%3 \%4 + reinput 0 {--More--} + if ok { + output { } + } else { + reinput 0 {\%2} + if ok break + reinput 0 {\%2 } + if ok break + } + clear input + } +} + +define log_trace { + write error TRACE: \%1\{10} +} + +define die_error { + write error ERROR: \%2\{10} + exit \%1 +} + +define cmd { + log_trace {Executing command: \%4} + lineout \%4 + waitfor \%1 \%2 \%3 \%4 +} + +# globals +set network directory "" +set exit on-disconnect on +set exit warning off +set input case ignore + +log_trace {Connecting to \%1} +set host /pty ssh -e none -o 'StrictHostKeyChecking no' -l \$(SSH_USER) \%1 +if fail die_error 1 {Connection to \%1} + +log_trace {Waiting for password} +waitfor 5 {assword: } 2 {Password timeout} +lineout \$(SSH_PASS) +log_trace {Waiting for command prompt} +waitfor 5 {>} 2 {Command prompt} + +lineout enable +waitfor 5 {assword: } 2 {Enable password timeout} +lineout \$(ENA_PASS) +log_trace {Waiting for command prompt (enable mode)} +waitfor 5 {\#} 2 {Command prompt} + +local declare \&a +.wc := \fsplit(\v(input), &a, \{10}) +.prompt := \&a[\&a[0]] + +cmd 10 \m(prompt) 3 {show version} +cmd 20 \m(prompt) 3 {show run} + +pause 1 +lineout exit +log_trace {Exiting & disconnecting} +input 3 {\{10}} +log_trace {Done} +exit diff -r 5b37cf0009bd -r c61439c91a8a zfs/zynk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zfs/zynk Mon Oct 24 09:37:53 2011 +0200 @@ -0,0 +1,55 @@ +#!/bin/sh -e +# Based on: http://www.cuddletech.com/blog/pivot/entry.php?id=989 +# +# This script differs from original Zynk that uses -R and destination dataset, +# not filesystem. +# +## ZYNK: The Zuper Zimple ZFS Sync (Replication) Tool +## Form: zynk local/dataset root@remote.host destination/dataset + +# Please note: The reason this is so simple is because there is no error +# checking, reporting, or cleanup. +# +# In the event that something goes wonkey, you'll manually need to fix the +# snapshots and modify or remove the run datafile which contains the most +# recent snapshot name. +# +# Furthermore, this absolutely relies on the GNU version of 'date' in order to +# get epoch time. +# +# Before using, make sure you've: +# 1. distributed your SSH key to the remote host and can ssh without +# password; +# 2. delegated zfs rights to the user performing zynk. +# + +if [ -z "$3" ]; then + echo "Usage: zynk local/dataset remote.host destination/dataset" + exit 1 +fi + +DATE=`date +%s` +if [ "$DATE" = "%s" ]; then + echo "Must use GNU Date, please install and modify script." + exit 2 +fi + +LOCALFS=$1 +HOST=$2 +REMOTEFS=$3 +RUNF=`echo $LOCALFS-$HOST-$REMOTEFS|sed -e 's{[@/]{-{g'` +CUR=`date '+%F-%H%M'` + +TYPE="Full" +SEND_OPTS="" + +if [ -e $RUNF ]; then + TYPE="Incremental" + SEND_OPTS="-i $LOCALFS@`cat $RUNF`" +fi + +echo "$TYPE started at `date`" +zfs snapshot -r $LOCALFS@$CUR +zfs send -v -R $SEND_OPTS $LOCALFS@$CUR | ssh $HOST zfs recv -F -d $REMOTEFS +echo $CUR > $RUNF +echo "$TYPE complete at `date`"