From ebffcbed5b17022413f16581c82f17a4d4ca7746 Mon Sep 17 00:00:00 2001 From: madsenco Date: Mon, 10 Jan 2011 16:11:31 +0100 Subject: [PATCH] My stuff --- .stuff/.bash_profile | 2 + .stuff/.bashrc | 214 +++++++++++++++ .stuff/.cshrc | 139 ++++++++++ .stuff/.inputrc | 54 ++++ .stuff/.vimrc | 409 ++++++++++++++++++++++++++++ .stuff/.vimrc.priv | 168 ++++++++++++ .stuff/.vimrc.syntax | 26 ++ .stuff/bin/AUconsole | 8 + .stuff/bin/Glimpse | 20 ++ .stuff/bin/Make | 2 + .stuff/bin/MkIndex | 45 +++ .stuff/bin/Mkp | 8 + .stuff/bin/WheelEmulation | 7 + .stuff/bin/ampbackup | 27 ++ .stuff/bin/amppath | 11 + .stuff/bin/dn | 78 ++++++ .stuff/bin/doze | 14 + .stuff/bin/drange | 2 + .stuff/bin/hexdmp | 12 + .stuff/bin/ie6 | 3 + .stuff/bin/keyrenew | 20 ++ .stuff/bin/lua-agent | 4 + .stuff/bin/measure2date | 2 + .stuff/bin/openUrl | 3 + .stuff/bin/prnt | 3 + .stuff/bin/setTbird | 3 + .stuff/bin/unbind-ultranav-touchpad | 20 ++ .stuff/bin/upd-ssh-boxlists | 65 +++++ .stuff/bin/valgdb | 2 + .stuff/bin/valgrups | 2 + .stuff/bin/vi | 1 + .stuff/bin/view | 1 + .stuff/bin/virep | 60 ++++ .stuff/bin/xfce4 | 2 + 34 files changed, 1437 insertions(+) create mode 100644 .stuff/.bash_profile create mode 100644 .stuff/.bashrc create mode 100644 .stuff/.cshrc create mode 100644 .stuff/.inputrc create mode 100755 .stuff/.vimrc create mode 100644 .stuff/.vimrc.priv create mode 100644 .stuff/.vimrc.syntax create mode 100755 .stuff/bin/AUconsole create mode 100755 .stuff/bin/Glimpse create mode 100755 .stuff/bin/Make create mode 100755 .stuff/bin/MkIndex create mode 100755 .stuff/bin/Mkp create mode 100755 .stuff/bin/WheelEmulation create mode 100755 .stuff/bin/ampbackup create mode 100755 .stuff/bin/amppath create mode 100755 .stuff/bin/dn create mode 100755 .stuff/bin/doze create mode 100755 .stuff/bin/drange create mode 100644 .stuff/bin/hexdmp create mode 100755 .stuff/bin/ie6 create mode 100755 .stuff/bin/keyrenew create mode 100755 .stuff/bin/lua-agent create mode 100755 .stuff/bin/measure2date create mode 100755 .stuff/bin/openUrl create mode 100755 .stuff/bin/prnt create mode 100755 .stuff/bin/setTbird create mode 100755 .stuff/bin/unbind-ultranav-touchpad create mode 100755 .stuff/bin/upd-ssh-boxlists create mode 100755 .stuff/bin/valgdb create mode 100755 .stuff/bin/valgrups create mode 120000 .stuff/bin/vi create mode 120000 .stuff/bin/view create mode 100755 .stuff/bin/virep create mode 100755 .stuff/bin/xfce4 diff --git a/.stuff/.bash_profile b/.stuff/.bash_profile new file mode 100644 index 0000000..3ee72b9 --- /dev/null +++ b/.stuff/.bash_profile @@ -0,0 +1,2 @@ +PATH=~/bin:/usr/local/bin:$PATH +. $HOME/.bashrc diff --git a/.stuff/.bashrc b/.stuff/.bashrc new file mode 100644 index 0000000..abe5f5e --- /dev/null +++ b/.stuff/.bashrc @@ -0,0 +1,214 @@ +[ -n "$DISPLAY" ] && export TERM=xterm-color +SHELL=$BASH + +if [ -n "$PS1" ] ;then + [[ $0 != -* && $- != *l* ]] && . /etc/profile + [[ $BASH_COMPLETION ]] || . /etc/bash_completion + #. /etc/profile + + for p in ~/bin /usr/local/bin ;do + [[ $PATH != *${p}:* ]] && PATH=${p}:$PATH ;done + export SVN_EDITOR=vi + HISTCONTROL=ignoredups + IGNOREEOF=3 + HISTSIZE=2000 + HISTFILESIZE=50000 + + __col() { + [[ $TERM == xterm* || $TERM == linux ]] && echo -n '\[\e[3'${1}'m\]' + } + PS1="[$(__col 1)\h $(__col 2)\W$(__col 3)\$(exitrep)$(__col 9)]\\\$ " + eval `dircolors ~/.dircolors` + + [ -f /etc/rc.d/functions ] && USECOLOR=yes source /etc/rc.d/functions + + alias mark='echo -e "\n\n\n\n ${C_H2}---- `date` ----${C_CLEAR}\n\n\n\n"' + alias l=' less' + alias m=' mark' + alias df=' df -k' + alias ll=' ls -la' + alias ls=' ls --color=auto' + alias where='type -a' + alias grep='grep --color=auto' + alias svnhead="svnlog --limit=20" + alias sort='LC_ALL=C sort' + + export SVN=svn+ssh://ampsvn/srv/ampemb + svnlast() { if [[ $# -ge 1 ]] ;then svnlog -p -l 25 "$@" ;else svnlog -p -a $USER -l 25 ;fi; } + svnminfo() { svn mergeinfo $SVN/trunk/embedded \ + --show-revs ${@:-eligible} | \ + xargs -i svnlog '-{}' svn+ssh://ampsvn/srv/ampemb/trunk/embedded; } + + svnst() { svn st "$@" | grep -v '^[X?]'; } + lth() { ls -lat "$@" | head -20; } + alias open='kfmclient exec' + url() { kfmclient openURL "$*"; } + vimless() { vim --cmd 'let no_plugin_maps = 1 | let load_less = 1' \ + --cmd 'set readonly noswapfile' \ + -c 'set mouse=a' \ + -c 'runtime macros/less.vim' "${@:--}"; } + p() { "$@" | less;} + v() { if [[ $# -eq 1 && -e $1 ]] ;then vimless $1 ;else "$@" | vimless ;fi } + vis() { vi +set\ hlsearch $(which "$@"); } + _txt() { eval "file $*" | grep -w text | cut -d: -f1; } + vif() { vi -c set\ hlsearch "+/$*/" $(egrep -l "$*" $(_txt \*)); } + vdiff() { vi -g -f -d --cmd 'set columns=164' -c 'normal =' "$@"; } + mt() { xterm +tb -e sh -c "while multitail $@; do : ;done"; } + ToAURoot() { tar zcf - $2 | command ssh $1 tar zxvf - -C /flash/root/; } + Trace() { amp-backtrace.lua "$@" | less +/'ERROR=>' --jump-target=.5; } + psman() { man -aW "$@" | xargs zcat | groff -man -Tps -P-pa4 \ + | psnup -pa4 -2 -d1 | less;} + f() { awk -v N="$*" 'BEGIN {split(N, Nr, / |,/)} + {for (n in Nr) {printf("%s%s", (n>1) ? " " : "", $Nr[n])}; print ""}'; } + e() { lua -e "print($*)"; } + + __h() + { + local -a C + local -i I + local N + eval $(grep "$@" ~/.bash_history | uniq | command tail -10 | tac \ + | awk '{print "C[" I++ "]=\047" gensub("\047", "\047\\\\\047\047", "g", $0) "\047"}') + if [[ ${#C[@]} > 0 ]] ;then + for ((I=0; I<${#C[@]}; I++ )) ;do echo "$I: ${C[$I]}" > /dev/tty ;done + read -n 1 -p "Select command: " N /dev/tty + if [[ $N = [0-9] && ${#C[$N]} > 0 ]] ;then + echo " ... Running [$N]" >/dev/tty + echo "${C[$N]}" + else + echo '' >/dev/tty + fi + fi + } + h() { + local ___Very_UnL1leLy_7ar=$(__h "$@") + history -s $___Very_UnL1leLy_7ar + eval $___Very_UnL1leLy_7ar + } + alias hi="history|tail" + + case $TERM in + sun-cmd) stln() { printf "\033]l %s \033" "$*"; } ; itit() { :; } + ;; + xterm*) stln() { printf "\033]2;%s\007" "$*" ; } + itit() { printf "\033]1;%s\007" "$*" ; } + ;; + *) stln() { :; } ; itit() { :; } + ;; + esac + HostnTty=`uname -n | tr '[a-z]' '[A-Z]'`:`tty | cut -c9-` + Tty=`tty | cut -c10-` + stdir() { + local p=${PWD/$AMPROOT/@} + if [[ $p = @/* ]] ;then Path=${p:2}; else Path=""; fi + local p=${p/$HOME/\~} + local V='' + stln "-- $HostnTty ${TOOLCHAIN_PS1_LABEL/#tt/[tt${TARGET_PLATFORM/#V26/26}] }- $p --" + itit "$Tty - $(sed 's/\([a-zA-Z]\)[a-zA-Z]*/\1/g' <<< ${AMPROOT##*/}) - ${p##*/}" + } + + sshwrap() { + local Cmd Host CmdU + Cmd=$1 ; shift + Host=$(command ssh -o 'ProxyCommand=echo %h >/dev/fd/9' -o ControlPath=none "$@" 9>&1 2>&-) + CmdU=$(tr a-z A-Z <<<$Cmd) + itit "$Tty - $CmdU $Host" + command $Cmd "$@" + } + ssh() { sshwrap ssh "$@"; } + aussh() { sshwrap aussh "$@"; } + au-sshgw() { sshwrap au-sshgw "$@"; } + tail() { itit "$Tty - TAIL $@" ; command tail "$@"; } + cu() { itit "$Tty - CU $@" ; command cu "$@"; } + locate() + { + if [[ $# == 1 ]] ;then + command locate -b "$@" + else + command locate "$@" + fi + } + + timerep() { + local timeRep=$TIMESHOW ; [[ $timeRep ]] || timeRep=$TIMEREPORT + [[ ! -n $timeRep ]] && return + times > /tmp/.time$$ + local no timeStart cmd timeNow + timeNow=$(< /tmp/.time$$) + HISTTIMEFORMAT="%s " history 1 > /tmp/.time$$ + read no timeStart cmd < /tmp/.time$$ + if [[ -n $_timeprev ]] ;then + echo $_timeprev $timeNow | tr ms ' ' | awk ' + { + usrPrev = $5*60 + $6 + sysPrev = $7*60 + $8 + usrCur = $13*60 + $14 + sysCur = $15*60 + $16 + total = (usrCur + sysCur) - (usrPrev + sysPrev) + if (total >= timeRep) { + printf("%.3fu %.3fs %d:%02d %.1f%%\n", + usrCur - usrPrev, sysCur - sysPrev, + duration / 60, duration % 60, total / duration * 100.0) + } + }' timeRep=$timeRep duration=$(( $(date +%s) - $timeStart )) + fi + _timeprev=$timeNow + unset TIMESHOW + rm -f /tmp/.time$$ + } + TIMEREPORT=1 + tim() { TIMESHOW=0 ; "$@"; } + + exitrep() { + declare -a P=( ${PIPESTATUS[@]} ) + local Last=$((${#P[*]} - 1)) + [[ ${P[$Last]} -ne 0 ]] && echo " E:${P[$Last]}" + } + + profile_check() { + local curtime=$(stat -c %y $HOME/.bashrc) + if [[ $_profile_time && $_profile_time != $curtime ]] ;then + source $HOME/.bashrc + fi + _profile_time=$curtime + } + + PROMPT_COMMAND='history -a; stdir; timerep; profile_check' + if [[ -d ~/.keychain && "$UID" -ne 0 ]] ;then + #keychain --quiet ~/.ssh/id_dsa --timeout 1440 # 24 hours. + keychain --quiet ~/.ssh/id_dsa + . ~/.keychain/`uname -n`-sh + fi + + if [[ -f /opt/toolchain/toolchain-setup ]] ;then + tt() { unset TOOLCHAIN_HOME ;. /opt/toolchain/toolchain-setup>/dev/null; } + untt() { unset CROSS_COMPILE ARCH TOOLCHAIN_PS1_LABEL TOOLCHAIN_HOME + unalias make; } + tt; untt + fi + + amptree() { + if [ $# -eq 0 ] ;then echo $AMPROOT ; return ;fi + if [ $1 == --completions ] ;then + ( cd ~/amplex ; ls -1d */arm9 ) | cut -d/ -f1 | grep "^$3" + return + fi + local noCD="" + if [[ $1 == --nocd ]] ;then noCD=1; shift; fi + AMPROOT=~/amplex/$1 + CDPATH="" + for d in ~ $AMPROOT/{,arm9,arm9/agentframework/{,agents,libs},arm9/apps/{,drivers},arm9/utils,arm9/drivers} ~/{amplex,releases,src,abs,abs2} ;do + CDPATH=$CDPATH:$d + done + export LUA_CPATH="$AMPROOT/arm9/agentframework/lua/?.so" + if [[ ! -n $noCD ]] ;then + echo $AMPROOT/arm9 + cd $AMPROOT/arm9 + fi + } + complete -C 'amptree --completions' amptree + amptree --nocd embedded + complete -F _command -o filenames p v + complete -c vis env where +fi +# vim: set sw=3 sts=3 et: diff --git a/.stuff/.cshrc b/.stuff/.cshrc new file mode 100644 index 0000000..78a238e --- /dev/null +++ b/.stuff/.cshrc @@ -0,0 +1,139 @@ +# @(#)cshrc 1.11 89/11/29 SMI +umask 2 +set path = ( ~/bin /usr/local/bin $path ) +if ( $?prompt ) then + # source /etc/CciCshEnv + #foreach l ( "` env - PATH=/bin sh -c '. /etc/profile; env' | awk -f ~/.envtocsh`" ) + # eval "$l" + #end + set HostnTty = `uname -n | tr '[a-z]' '[A-Z]'` + set HostnTty = "$HostnTty":`tty | cut -c9-` + set cdpath = ( /var/abs/* ~ ) + if (`tty` !~ /dev/pts/*) then + set term = `tset -Q -` >&/dev/null + else if ( ! $?TERM) then + set term = vt100 + endif + eval `dircolors -c ~/.dircolors` + alias h history + alias more less + alias m more + alias df 'df -k' + alias ll 'ls -la' + alias ls 'ls --color=auto' + alias grep 'grep --color=auto' + alias lth 'ls -lat \!* | head -20' + alias open 'kfmclient exec' + alias url 'kfmclient openURL "\!:*"' + alias l less + alias p '\!* | l' + alias v '\!* | vi - +set\ nomodified' + alias vis 'vi +set\ hlsearch `/usr/bin/which \!*`' + alias vif 'vi -c set\ hlsearch +/\!*/ `egrep -l \!* *`' + alias prnt 'enscript -2 -r -j' + alias vdiff "vi -g -f -d --cmd 'set columns=164' -c 'normal =' \!:*" + alias mt 'xterm +tb -e sh -c "while multitail \!* ; do : ;done"' + alias ToAURoot 'tar zcf - \!:2 | ssh \!:1 tar zxvf - -C /flash/root/' + alias psman 'man -aW \!* | xargs zcat | groff -man -Tps -P-pa4 | psnup -pa4 -2 -d1 | less ' + alias autunnel 'ssh -L 22000:localhost:20532 -t ssh@gatekeeper ssh -p22\!:1 -L20532:localhost:22 root@localhost' + alias aetunnel 'ssh -L 22000:localhost:20532 -t amplex@172.23.0.230 ssh -L20532:localhost:22 root@\!:1' + + if ( $TERM == sun-cmd ) then + alias stln 'printf "\033]l %s \033\" \!*' + else if ( $TERM =~ xterm* ) then + alias stln 'printf "\033]2;%s\007\033]1;%s\007" \!* "$HostnTty"' + alias xtitle 'printf "\033]2;%s\007\033]1;%s\007" \!:1 \!:1' + printf "\033]1;%s\007" "$HostnTty" + else + alias stln 'echo "\!*" >/dev/null' + endif + alias stdir 'stln "-- $HostnTty - `/bin/pwd | sed s,^$HOME,~,` --"' + alias cd 'set old="$cwd"; chdir \!:*; stdir' + alias back 'set tmp="$cwd"; chdir "$old"; set old="$tmp" ; stdir' + alias cb back + + set history=200 + if ($?tcsh) then + setenv SHELL /bin/sh + set autolist + set visiblebell + set time = 2 + set histdup = prev + set printexitvalue + set ignoreeof = 2 + set echo_style = both + set matchbeep=nomatch + set color=ls-F + unset autologout + #bindkey -v + #bindkey  vi-cmd-mode + bindkey -e + bindkey [1\;2~ complete-word-fwd + bindkey [1\;6~ complete-word-back + bindkey [1\;4~ complete-word-raw + bindkey [1~ complete-word-fwd + bindkey ' ' magic-space + bindkey -b ^W backward-delete-word + bindkey -b ^G list-glob + bindkey -b M-G expand-glob + bindkey -b M-P dabbrev-expand + bindkey -k up history-search-backward + bindkey -k down history-search-forward + bindkey -b ^A spell-word + bindkey -b ^P dabbrev-expand + bindkey -b ^N normalize-path + bindkey -b ^K normalize-command + + alias _col ': \!:1' + + if ( $term =~ xterm* ) alias _col 'echo -n "%{^[[3\!:1m%}"' + if ($uid > 0) then + set prompt="`_col 1`%m`_col 9`.%h.`_col 2`%c`_col 9`> " + else + set prompt="`_col 1`%m`_col 9`.%h.`_col 2`%c`_col 9`# " + endif + + # Esoteric + complete find 'n/-fstype/(nfs ufs)/' 'n/-name/f/' \ + 'n/-type/(c b d f p l s)/' 'n/-user/u/' 'n/-exec/c/' \ + 'n/-ok/c/' 'n/-cpio/f/' 'n/-ncpio/f/' 'n/-newer/f/' \ + 'c/-/(fstype name perm prune type user nouser \ + group nogroup size inum atime mtime ctime exec \ + ok print ls cpio ncpio newer xdev depth)/' \ + 'n/*/d/' + complete dd 'c/conv=/(ascii ebcdic ibm block lcase ucase swab \ + noerror notrunc sync)/' \ + 'c/if=/f/' 'c/of=/f/' \ + 'p/*/(if of ibs obs bs cbs files skip iseek \ + oseek seek count conv)/=/' + + complete set 'p/1/s/' + complete setenv 'p/1/e/' + complete unset 'p/1/s/' + complete unsetenv 'p/1/e/' + complete vis 'p/1/c/' + complete p 'p/1/c/' + complete v 'p/1/c/' + complete man 'p/1/c/' + complete sudo 'p/1/c/' + complete Su 'p/1/c/' + complete alias 'p/1/a/' + complete unalias 'p/1/a/' + complete bindkey 'p/1/()' 'p/2/b/' + complete complete 'p/1/c/' + complete uncomplete 'p/1/C/' + complete which 'p/*/c/' + complete where 'p/*/c/' + complete cd 'p/1/d/' + endif + if ( "$USER" != "root" ) then + keychain --quiet ~/.ssh/id_dsa --timeout 1440 # 24 hours. + source ~/.keychain/`uname -n`-csh + endif + alias tt 'source ~/.cshrc.tt' + alias amptree 'setenv AMPROOT \!:1; set cdpath = ( ~ ~/{amplex,releases,src,abs,abs2} \!:1/{,arm9,arm9/agentframework/{,agents,libs},arm9/apps/{,drivers},arm9/utils,arm9/drivers} )' + amptree ~/amplex/embedded_ampcom + setenv SVN_EDITOR vi + + cd . +endif diff --git a/.stuff/.inputrc b/.stuff/.inputrc new file mode 100644 index 0000000..e1cb5f7 --- /dev/null +++ b/.stuff/.inputrc @@ -0,0 +1,54 @@ + +# Readline settings +set bell-style visible +set show-all-if-ambiguous on +set visible-stats on +set input-meta on +set convert-meta off +set output-meta on +set expand-tilde on +set completion-ignore-case on +set completion-query-items 10000 + +# Bindings - make it somewhat more like tcsh +"\C-r": redraw-current-line +"\C-d": delete-char-or-list + +# Menu completion on Shift-TAB go back with Shift-F1 +"\e[Z": menu-complete +"\e[1;2~": menu-complete +"\eO2P": "\e-\e[Z" + +# More line editing +$if Bash +" ": magic-space +$endif +"\d": forward-backward-delete-char +"\C-h": backward-delete-char +"\C-x\C-h": backward-kill-line +"\C-x\C-s": reverse-search-history +"\C-x\C-f": forward-search-history +"\C-s": reverse-search-history +"\C-w": unix-filename-rubout +"\ew": unix-word-rubout +"\eu": undo + +# CTRL Arrow up and down searches for what is typed so far +"\e[1;3A": history-search-backward +"\e[1;3B": history-search-forward +"\e[1;5A": history-search-backward +"\e[1;5B": history-search-forward + +"\e[1;3D": backward-char +"\e[1;3C": forward-char +"\e[D": backward-char +"\e[C": forward-char + +# Misc +"\C-xsk": dump-functions +# At least Rdlf has it +"\C-xsh": dump-history + +"\C-xkr": kill-region +"\C-xcr": copy-region-as-kill + diff --git a/.stuff/.vimrc b/.stuff/.vimrc new file mode 100755 index 0000000..0d572bc --- /dev/null +++ b/.stuff/.vimrc @@ -0,0 +1,409 @@ +" vim: set ts=3 sw=3 et: +""" +""" %Z%%E% %U%, %I% %P% +""" (C) Copyright 2000 CCI-Europe. Author : fma +""" +""" Revision History """ +""" End of Revisions """ +" +" My .vimrc file +" +if has("win32") + " Use CCI standard setup. This happens automatically on UNIX + if filereadable($VIM . "/vimrc") + source $VIM/vimrc + endif +endif + +syntax on +filetype plugin indent on +augroup filetype +autocmd BufEnter *.r set ft=xdefaults +augroup END + +set tags=tags,../tags,/opt/toolchain/include/tags +set path=.,include,../include,/opt/toolchain/include +let CurPath = getcwd() +while strlen(CurPath) > 3 + if filereadable(CurPath."/tags") + exe "set tags+=".CurPath."/tags" + endif + if strlen(glob(CurPath."/include")) + exe "set path+=".CurPath."/include" + endif + if strlen(glob(CurPath."/*.h")) + exe "set path+=".CurPath + endif + if !exists("g:GlimpsePath") && filereadable(CurPath."/.glimpse_index") + let g:GlimpsePath = CurPath + execute "set path+=".CurPath + endif + let CurPath = substitute(CurPath, '[/\\]\+[^/\\]*$', "", "") +endwhile + +if has("win32") + behave xterm + set directory=C:/temp/preserve// " Home of the swap files_ + if filereadable('C:\Programs\NT_SFU\Shell\grep.EXE') + set grepprg=grep\ -n " Use POSIX grep if available + endif + + " Let VIM know about VisualC++ include files + if exists("$include") + let more = substitute($include, ';', ',', 'g') + let more = substitute(more, ' ', '\\\\\\ ', 'g') + execute "set path+=" . more + let g:incdirs = g:incdirs.",".more + + let more = substitute($include, ';', '\\\\\\tags,', 'g') + execute "set tags+=" . substitute(more, ' ', '\\\\\\ ', 'g') . '\\tags' + unlet more + endif + + if exists("$SCCSHOME") + " Can not handle '/' to '\' conversion otherwise + let $SCCSHOME = $SCCSHOME . "/" + endif + + if has("gui_running") + set guifont=Courier_New:h9 + " System menu and quick minimize + map :simalt ~ + map :simalt ~n + " Size the GUI window. Delay positioning until window is created + set lines=50 + set columns=82 + augroup AutoPos + autocmd BufEnter * winp 200 50 | autocmd! AutoPos + augroup END + endif +else + if (&term == "cygwin") " This seem to have some quirks, work around some + set directory=/var/preserve/ + let &t_@7="\[4~" " Make work + let &t_kh="\[1~" " Make work + else + set directory=/var/preserve// + if has("gui_running") + set guifont=fixed + else + " Uncomment line below to use :emenu. Adds ~1 second to startup time + " source $VIMRUNTIME/menu.vim + + " Make work - Some options cannot be assigned to with 'let' + exe "set t_@7=\OF" + + " Must be _very_ slow to handle triple clicks + set mousetime=1500 + if &ttymouse == "xterm2" + " The xterm2 mode will flood us with messages + set ttymouse=xterm + endif + + " Save and restore the "shell" screen on enter and exit + let &t_te = "\[2J\[?47l\8" + let &t_ti = "\7\[?47h" + + " Make mappings work + exe "set t_kb=\x08" + exe "set t_kD=\x7f" + + exe "set t_Co=16" + + " Make shifted cursor keys work. + " For the necessary xmodmap commands, see :help hpterm + map + map! + map + map! + map + map! + map + map! + " To make the shift-Tab key work, also see :help suffixes + cmap [1~ + cmap [1;2~ + endif + endif + if has("gui_running") + let &guifont="Bitstream Vera Sans Mono 10" + endif +endif + +if has("gui_running") + set title icon + set titlestring=%F%(\ --\ %a%) + set iconstring=%f +else + set notitle noicon " Do _not_ mess with title string of my xterm +endif + +set showcmd " Show chars for command in progress on ruler +set exrc " Allow .vimrc in current dir +set hidden " Dont unload buffers BEWARE OF :q! and :qa! !!! +set backspace=indent,eol " Can ^H/^W/^U across lines in insert +set sidescroll=5 +set scrolloff=4 +set textwidth=100 +set whichwrap=h,l,<,>,[,] " Do not backspace/space across line boundaries +set autoindent +set winheight=10 " Make new windows this high +set cmdheight=2 " status line area height - higher for quickfix +set laststatus=2 " always with statusline +set showmatch +set autowrite " write files back at ^Z, :make etc. +set mouse=nv " Use xterm mouse mode in insert/cmdline/prompt +set clipboard=autoselect " Visual to/from clipboard +set fileformats=unix,dos,mac +set showbreak=________ " Show me where long lines break +set showfulltag " Insert function prototype in ^X^] +set incsearch nohlsearch " Search while typing, 'zx' toggles highlighting +set helpheight=100 " Maximize help windows +set shortmess=ato " Brief messages to avoid 'Hit Return' prompts +set formatoptions=crqlo " Comment handling / Dont break while typing +set history=100 +set viminfo='20,\"500 " Keep history listings across sessions +set wildmenu " Show completion matches on statusline +set wildmode=list:longest,full +set complete=.,w,b,u,d " The ,t,i from the default was too much, now ,d +set isfname-== " No = allows 'gf' in File= Constructs +set shiftwidth=4 +set softtabstop=4 +set expandtab +set spelllang=en_us +set equalprg=csb +set visualbell +set printfont=:h7.5 +set printoptions=number:y,duplex:off,left:5mm,top:5mm,bottom:5mm,right:5mm + +let c_gnu = 1 +let c_no_curly_error = 1 +"let &errorformat = + +" For running edit-compile-edit (quickfix) +nmap n :cnext +nmap l :clist +nmap c :cc +nmap p :cprevious +nmap m :make + +" Various utility keys +nmap ( :bprev +nmap ) :bnext +nmap F :files +nmap Q :bdelete +nmap !Q :bdelete! +nmap [f :bunload +nmap zx :set invhlsearch +nmap zs :set invspell +nmap zn :set invnumber +nmap zf :set invfoldenable +nmap [s :exe "g/".@/."/p" + + +" These seem to be suitable for hitting all keys in mapping within timeout +set timeoutlen=500 +set ttimeoutlen=50 + +" Make cursor keys jump out of insert. Your preference may differ +imap +imap +imap +imap +imap +imap +imap +imap + +" Movement with "2x3" block navigation keys. Customize to your liking +nnoremap +nnoremap +nnoremap +nnoremap +nnoremap +nmap [[z. +nmap ]]z. +nmap ]]z. +nmap { +nmap } + +" Insert some standard blobs +map :r $SCCSHOME/SccsHeaders/static.hdr + +" Always delete to left of cursor +inoremap +cnoremap + +" List multiple matches at CTRL-] +nmap :T +" Tag "preview" window +nmap :ptag +nmap :ptnext +nmap :ptprevious +nmap :ppop +nmap :ptag +nmap x :pclose + +" Some coloring. These are _my_ preferences +hi statusLine term=bold,reverse cterm=NONE ctermbg=7 gui=NONE guibg=grey +hi statusLineNC term=reverse cterm=NONE ctermbg=8 gui=NONE guibg=darkgrey +hi NonText ctermfg=lightgray +hi Visual cterm=Inverse ctermfg=grey ctermbg=black + +if &term == "ansi" || &term == "console" || &term == "linux" + set background=dark + hi statusLine ctermfg=black + hi statusLineNC ctermfg=black ctermbg=yellow +endif + +" Use :T instead of :ta to see file names in ^D complete-lists +command! -complete=tag_listfiles -nargs=1 T tjump | + \call histadd("cmd", "T ") + +" File type dependent settings +augroup Private + " Use smartindent in these files. + autocmd FileType tcl,postscr set nocindent smartindent|inoremap # X# + " Use cindent for C files. + autocmd FileType c,cpp set cindent cinoptions=(0,w1,u0,:1,=2|inoremap # # + " Autowrap while typing in other types of files + autocmd FileType * set formatoptions-=t|set formatoptions+=t + " NO autowrap while typing in source code files + autocmd FileType tcl,postscr,c,cpp set formatoptions-=t | call SetPathAdd() + + " These are for CCI source files + "autocmd BufRead * set ts=3 sts=3 sw=3 + " And _these_ are most sensible for VIM (ao. PD) source code + "autocmd BufRead */src* set sts=4 sw=4 cinoptions& + + " Handle global (non bufferspecific) options + autocmd BufEnter * call BufEnterGlobalOpts() +augroup end + +function! SetPathAdd() + let fpath = fnamemodify(expand(":p"), ":h") + let SccsPath = $SCCSPATH + let b:incdirs = "" + while strlen(SccsPath) > 0 + let spc = match(SccsPath, " ") + if spc >= 0 + let Part = strpart(SccsPath, 0, spc) + let SccsPath = strpart(SccsPath, spc + 1) + else + let Part = SccsPath + let SccsPath = "" + endif + if strlen(Part) > 0 + let b:incdirs = b:incdirs.",".$SCCSHOME."/".$REL.".".Part."/".fpath + endif + endwhile + if strlen(b:incdirs) > 1 + let b:incdirs = strpart(b:incdirs, 1) + else + unlet b:incdirs + endif +endfunc + +function! BufEnterGlobalOpts() + " Avoid '#-in-1.-column' problem with cindent & smartindent + if &filetype == 'c' || &filetype == 'cpp' + inoremap # # + " Dont highligh this as an error + hi link cCommentStartError Comment + else + inoremap # X# + endif + + " Set up path for private include files - w. help from SetPathAdd() + if exists("g:incdirs") + if exists("b:incdirs") + let &path = ".,".b:incdirs.",".g:incdirs + else + let &path = ".,".g:incdirs + endif + endif + + let fpath = expand(":p") + if fpath =~ '\f\/src\f' || fpath =~ '\f\/BUILD\f' || fpath =~ '\f-\d' + setlocal patchmode=.orig " Always save original file + else + setlocal patchmode& + endif +endfunc + + +" Pick a status line, or craft one yourself +" statusline #1, two expressions -- Use a continuation line & quote SCCS keys +set statusline=%<%f%=\ %([%1*%M\%*%n%R\%Y%{VarExists(',GZ','b:zipflag')} + \]%)\ %02c%V(%02B)C\ %3l/%LL\ %P +" statusline #2, zero expressions +"set statusline=%<%f%=\ %([%n%Xm%Xr%&,HL&h]%)\ %-19(%3l,%02c%'%o%)'%02Xb' +" statusline #3, the default one +"set statusline& + +" Coloring of the modified flag +highlight User1 cterm=bold ctermfg=red ctermbg=gray gui=bold guifg=red guibg=gray + +" Testing +"set title titlestring=%<%F%=%l/%L-%P titlelen=70 +"set rulerformat=%l,%c%_%t-%P + +function! VarExists(s,v) + if exists(a:v) + return a:s + else + return "" + endif +endfunction + +function! Show_g_CTRLG() + let col = col(".") + let vcol = virtcol(".") + let line = line(".") + let lline = line("$") + exe "normal $" + let cole = col(".") + let vcole = virtcol(".") + exe "normal " vcol . "|" + + let out_str = "Col " . col + if col != vcol + let out_str = out_str . "-" . vcol + endif + let out_str = out_str . " of " . cole + if cole != vcole + let out_str = out_str . "-" . vcole + endif + let out_str = out_str . "; Line " . line . " of " . lline + let out_str = out_str . " (" . (line * 100 / lline) . "%)" + let byte = line2byte(line) + col - 1 + let out_str = out_str . "; Char " . byte + let lbyte = line2byte(lline) + strlen(getline(lline)) + let out_str = out_str . " of " . lbyte . " (" . (byte * 100 / lbyte) . "%)" + echo out_str +endfunction +" This is _much_ faster than g on large files. And it is more verbose +map gK :call Show_g_CTRLG() + +function! Incr() + if ! exists("g:Incr") + let g:Incr = 0 + else + let g:Incr = g:Incr + 1 + endif + return g:Incr +endfunc + +if filereadable($HOME."/.vimrc.priv") + source $HOME/.vimrc.priv +endif + +if exists("load_less") + set directory= + set statusline=%3l/%LL\ %P\ %o/%{line2byte(line(\"$\")+1)-1}\ %=%<%f%a + set cmdheight=1 +endif + +let loaded_explorer=1 " Don't want plugin/explorer.vim +" echo "DONE sourcing" + diff --git a/.stuff/.vimrc.priv b/.stuff/.vimrc.priv new file mode 100644 index 0000000..1bf258e --- /dev/null +++ b/.stuff/.vimrc.priv @@ -0,0 +1,168 @@ +" +" Extra vim stuff +" + +nmap :call SetCHdr() + +map gy "*y +map gp "*p +map g]p "*]p +map g[P "*[P + +function! SetCHdr() + call append(0, ["/*", + \ " $Id$", + \ " (C) Copyright ".strftime("%Y")." Amplex, ".$USER."@amplex.dk", + \ "", + \ " ABSTRACT: ", + \ "*/"]) + call append(line('$'), ["", "// vim: set sw=3 sts=3 et:"]) + normal 5G$ + set sw=3 sts=3 et +endfunction + +function! TextEnableCodeSnip(filetype,start,end) abort + let ft=toupper(a:filetype) + let group='textGroup'.ft + if exists('b:current_syntax') + let s:current_syntax=b:current_syntax + " Remove current syntax definition, as some syntax files (e.g. cpp.vim) + " do nothing if b:current_syntax is defined. + unlet b:current_syntax + endif + execute 'syntax include @'.group.' syntax/'.a:filetype.'.vim' + try + execute 'syntax include @'.group.' after/syntax/'.a:filetype.'.vim' + catch + endtry + if exists('s:current_syntax') + let b:current_syntax=s:current_syntax + else + unlet b:current_syntax + endif + exe 'syntax region textSnip'.ft. + \ ' matchgroup=textSnip '. + \ ' start="'.a:start.'" end="'.a:end.'" '. + \ ' contains=@'.group.' containedin=ALL' + hi link textSnip SpecialComment +endfunction + +autocmd Private FileType sh call TextEnableCodeSnip('lua', '--LUA--', '--EOF--') | + \ call TextEnableCodeSnip('awk', '#AWK#', '#EOF#') + +nmap gmd :Glimpse NodeType. + +let vimrcdir = expand(":h")."/dot/usr/vim" +func! CciPostLoad(Pattern, File) + augroup CciAutoLoad + exe "autocmd BufNewFile ".a:Pattern "source ".g:vimrcdir."/".a:File + \ ." |let b:isNew = 1 | autocmd! CciAutoLoad BufNewFile ".a:Pattern + augroup CCIstart + exe "autocmd BufNewFile ".a:Pattern "let b:autohdr = 1" + augroup END +endfunc +call CciPostLoad("GLM::*", "srcmgr.vim") +call CciPostLoad("GLW::*", "srcmgr.vim") +delfunction CciPostLoad +exe "source ".expand(":h")."/dot/usr/vim/"."utils.vim" +"exe "source ".expand(":h")."/dot/usr/vim/"."newfmgr.vim" + +nmap gG :call OpenSpec("GLW::") +vmap gG :call VisualOpenSpec("GLM::") +command! -nargs=1 Glimpse call OpenSpec("GLM::") +command! -nargs=1 GlimpseW call OpenSpec("GLW::") + +func! OpenSpec(str) + let Str = a:str + exe "edit ".Str + call histadd("cmd", "edit ".Str) +endfunction + +func! VisualOpenSpec(Pre) + let Col1 = col("'<") + let Col2 = col("'>") + if line("'<") != line("'>") | return | endif + let Str = strpart(getline(line("'<")), Col1 - 1, Col2 - Col1) + let Str = substitute(Str, " ", ".", "g") + call OpenSpec(a:Pre.Str) +endfunc + +set statusline=%<%f%=\ %2*%{VimBuddy()}%*\ %([%1*%M\%*%n%R\%Y + \%{VarExists(',GZ','b:zipflag')}]%)\ %02c%V(%02B)C\ %3l/%LL\ %P +highlight User2 ctermfg=blue ctermbg=gray guifg=darkblue guibg=gray +" OK. So here is the infamous VimBuddy. You can delete it, if it is not +" referenced from your 'statusline' +function! VimBuddy() + " Take a copy for others to see the messages + if ! exists("s:vimbuddy_msg") + let s:vimbuddy_msg = v:statusmsg + endif + if ! exists("s:vimbuddy_warn") + let s:vimbuddy_warn = v:warningmsg + endif + if ! exists("s:vimbuddy_err") + let s:vimbuddy_err = v:errmsg + endif + if ! exists("s:vimbuddy_onemore") + let s:vimbuddy_onemore = "" + endif + + if g:actual_curbuf != bufnr("%") + " Not my buffer, sleeping + return "|-o" + elseif s:vimbuddy_err != v:errmsg + let v:errmsg = v:errmsg . " " + let s:vimbuddy_err = v:errmsg + return ":-(" + elseif s:vimbuddy_warn != v:warningmsg + let v:warningmsg = v:warningmsg . " " + let s:vimbuddy_warn = v:warningmsg + return "(-:" + elseif s:vimbuddy_msg != v:statusmsg + let v:statusmsg = v:statusmsg . " " + let s:vimbuddy_msg = v:statusmsg + let test = matchstr(v:statusmsg, 'lines *$') + let num = substitute(v:statusmsg, '^\([0-9]*\).*', '\1', '') + 0 + " How impressed should we be + if test != "" && num > 20 + let str = ":-O" + elseif test != "" && num + let str = ":-o" + else + let str = ":-/" + endif + let s:vimbuddy_onemore = str + return str + elseif s:vimbuddy_onemore != "" + let str = s:vimbuddy_onemore + let s:vimbuddy_onemore = "" + return str + endif + + if ! exists("b:lastcol") + let b:lastcol = col(".") + endif + if ! exists("b:lastlineno") + let b:lastlineno = line(".") + endif + let num = b:lastcol - col(".") + let b:lastcol = col(".") + if (num == 1 || num == -1) && b:lastlineno == line(".") + " Let VimBuddy rotate his nose + let num = b:lastcol % 4 + if num == 0 + let ch = '/' + elseif num == 1 + let ch = '-' + elseif num == 2 + let ch = '\' + else + let ch = '|' + endif + return ":" . ch . ")" + endif + let b:lastlineno = line(".") + + " Happiness is my favourite mood + return ":-)" +endfunction diff --git a/.stuff/.vimrc.syntax b/.stuff/.vimrc.syntax new file mode 100644 index 0000000..c26a80e --- /dev/null +++ b/.stuff/.vimrc.syntax @@ -0,0 +1,26 @@ + +if &background == "dark" + hi Comment term=bold ctermfg=Cyan guifg=#80a0ff + hi Type term=underline ctermfg=Magenta guifg=#ffa0a0 + hi Special term=bold ctermfg=LightRed guifg=Orange + hi Identifier term=underline cterm=bold ctermfg=Cyan guifg=#40ffff + hi Statement term=bold ctermfg=Yellow guifg=#ffff60 gui=bold + hi PreProc term=underline ctermfg=LightBlue guifg=#ff80ff + hi Constant term=underline ctermfg=LightGreen guifg=#60ff60 gui=bold + hi Ignore ctermfg=black guifg=bg +else + hi Comment term=bold ctermfg=DarkBlue guifg=DarkBlue + hi Type term=underline ctermfg=Brown gui=NONE guifg=DarkRed + hi Special term=bold ctermfg=DarkMagenta guifg=DarkMagenta + hi Identifier term=underline ctermfg=DarkCyan guifg=DarkCyan + hi Statement term=bold ctermfg=DarkRed guifg=DarkRed + hi PreProc term=underline ctermfg=DarkMagenta guifg=DarkMagenta + hi Constant term=underline ctermfg=DarkGreen guifg=DarkGreen gui=italic + hi Ignore ctermfg=white guifg=bg + hi NonText ctermfg=white + hi! link NonText Ignore +endif +hi Error term=reverse ctermbg=Red ctermfg=White guibg=Red guifg=White +hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow +au! Syntax postscr source /usr/local2/share/vim/syntax/postscr.vim + diff --git a/.stuff/bin/AUconsole b/.stuff/bin/AUconsole new file mode 100755 index 0000000..861cf89 --- /dev/null +++ b/.stuff/bin/AUconsole @@ -0,0 +1,8 @@ +#!/usr/bin/kermit + +set line /dev/ttyS0 +set speed 115200 +set flow none +set modem none +set carrier-watch off +show communications +connect diff --git a/.stuff/bin/Glimpse b/.stuff/bin/Glimpse new file mode 100755 index 0000000..ba91be0 --- /dev/null +++ b/.stuff/bin/Glimpse @@ -0,0 +1,20 @@ +#!/bin/bash +## +# $Id$ +# (C) Copyright 2009 Amplex, fm@amplex.dk +# +# ABSTRACT: Global grep with prebuilt index +## + +Dir=$(pwd) +while [ "$Dir" ] ;do + [ -f $Dir/.glimpse_index ] && break + Dir=${Dir%/*} +done +[ "$Dir" ] || { echo "No glimpse index in this directory branch" ; exit 1; } + +echo "-- Paths relative to: $Dir" +exec glimpse-tt -y -H $Dir "$@" + + +// vim: set sw=3 sts=3 et: diff --git a/.stuff/bin/Make b/.stuff/bin/Make new file mode 100755 index 0000000..f51da3e --- /dev/null +++ b/.stuff/bin/Make @@ -0,0 +1,2 @@ +#!/bin/sh +exec make $CROSS_COMPILE_MAKE_ARGS $TOOLCHAIN_MAKE_ARGS "$@" diff --git a/.stuff/bin/MkIndex b/.stuff/bin/MkIndex new file mode 100755 index 0000000..963e09a --- /dev/null +++ b/.stuff/bin/MkIndex @@ -0,0 +1,45 @@ +#!/bin/bash +Dir=. +[ $# -gt 0 ] && Dir=$1 +cd $Dir +rm -f .glimpse_filenames .glimpse_filenames_index .glimpse_filetimes \ + .glimpse_index .glimpse_messages .glimpse_partitions .glimpse_statistics +find . \ + -name .svn -prune -o -name rootdisk -prune -o -name shadows -prune -o -name \*-pak -prune -o \ + -name doxygen -prune -o -type f -print | cut -c3- \ + | /bin/grep -v -E '^tags$|\.glimpse_|\.pdf$|\.o$|\.so$|\.so\.|\.a$|/mapfile$' \ + | while read L ;do + read -n4 T < "$L"; [[ $T != ?ELF && $T != BZh* && $T != $'\x1f\x8b\x08'* ]] && echo "$L" + done \ + | glimpseindex-tt -n -F -H $Dir | awk '!/^Indexing /' +echo -n "Creating tags ... " +ctags --recurse --exclude=.svn --exclude=rootdisk --exclude=\*-pak \ + --sort=no --links=no --excmd=number -f - --extra=+fq --totals=yes \ +| { X=$(mktemp); rm -f $X; ctags -f $X /dev/null; cat $X -; rm -f $X; } \ +| gawk -F '\t' ' + /^!_TAG_FILE_SORTED/ {sub(/[0-9]/, "2")} + {print} + $NF == "F" && $1 ~ /\.h$/ { + file = $2 + #print "Searching " file " .." >"/dev/stderr" + lno = 0 + while (getline l "/dev/stderr"} + ' > tags +LC_ALL=C sort --ignore-case -o tags tags + +echo done diff --git a/.stuff/bin/Mkp b/.stuff/bin/Mkp new file mode 100755 index 0000000..3510cb9 --- /dev/null +++ b/.stuff/bin/Mkp @@ -0,0 +1,8 @@ +#!/bin/sh +# Mkp - Makepkg front for easy cleanup +# + +mkdir -p BUILD +cp `ls -1 | grep -v '^BUILD$'` BUILD +(cd BUILD; makepkg "$@"; rm PKGBUILD) + diff --git a/.stuff/bin/WheelEmulation b/.stuff/bin/WheelEmulation new file mode 100755 index 0000000..78a7bf8 --- /dev/null +++ b/.stuff/bin/WheelEmulation @@ -0,0 +1,7 @@ +#!/bin/sh +for DEV in "TPPS/2 IBM TrackPoint" "Synaptics Inc. Composite TouchPad / TrackPoint" ;do + xinput set-int-prop "$DEV" "Evdev Wheel Emulation" 8 1 + xinput set-int-prop "$DEV" "Evdev Wheel Emulation Button" 8 2 + xinput set-int-prop "$DEV" "Evdev Wheel Emulation Axes" 8 6 7 4 5 +done + diff --git a/.stuff/bin/ampbackup b/.stuff/bin/ampbackup new file mode 100755 index 0000000..6e7e00c --- /dev/null +++ b/.stuff/bin/ampbackup @@ -0,0 +1,27 @@ +#!/bin/bash + +declare -a BACKUP=( ampdev0 Backup ) + +if [[ $1 == "restore" ]] ;then + fname=$(cut -d: -f1 <<< $2) + pattern=$(cut -d: -f2 <<< $2) + ssh ${BACKUP[0]} "cd ${BACKUP[1]}; cat b-$fname.cpio.lzo" | lzop -d | cpio -ivBdum $pattern + exit 0 +fi + +#eval $(keychain --eval --quiet) + +BackupName=$1 +cd ~/amplex +for Dir in */backmeup */*/backmeup ;do + Dir=${Dir%/*} + [[ -d $Dir ]] || continue + FDir=${Dir//\//_} + (cd $Dir + svn status | grep '^[AM]' | cut -c9- > /tmp/fn$$ + cat /tmp/fn$$ | cpio -o --quiet | lzop \ + | ssh ${BACKUP[0]} "cd ${BACKUP[1]}; cat >b-$FDir-$BackupName.cpio.lzo" + scp -q /tmp/fn$$ ${BACKUP[0]}:${BACKUP[1]}/i-$FDir-$BackupName + rm -f /tmp/fn$$ + ) +done diff --git a/.stuff/bin/amppath b/.stuff/bin/amppath new file mode 100755 index 0000000..d678955 --- /dev/null +++ b/.stuff/bin/amppath @@ -0,0 +1,11 @@ +#!/usr/bin/env lua + +function system(command) + local fd = io.popen(command, "r") + string = fd:read("*all") + fd:close() + return (string.gsub(string, "\n$", "")) +end + +amppath = os.getenv("AMPROOT") or error("AMPROOT not defined") +print((string.gsub(arg[1] or system("pwd"), "^"..amppath, ""))) diff --git a/.stuff/bin/dn b/.stuff/bin/dn new file mode 100755 index 0000000..4fc0470 --- /dev/null +++ b/.stuff/bin/dn @@ -0,0 +1,78 @@ +#!/bin/sh +# +# This script is intended to be run as '~+flashboot.cu from inside cu(1) +# +# Contact the debug port with 'cu -s 115200 -l /dev/ttyS0' or equivalent +# You will of course need the cu(1) program (may be part of uucp). +# You will need chat (from ppp), lsx (lrzsz) and gkermit too. +# Devdump (for sn.txt) is in arm9/utils/devdump +# +# The file boot.bin must be in the current directory. +# Copy the 'Files' directory from the AUTester to support bootstrap mode. +# Create the file sn.txt as 7 numbers to have the serialnumber block programmed. +# + +TT=/opt/toolchain/utils/flash-scripts/files + +say() { echo "$@" 1>&2; } +die() { say "$@"; exit 1; } + +say "Checking for bootstrap mode ..." +if chat -t 3 -e CCC '\c' ;then + [ -f loader.bin ] && P="" || P="$TT/" + [ -f ${P}loader.bin ] \ + || die "Board is in bootstrap mode but no boot files here!" + + # Prepare for uboot + lsx ${P}loader.bin + + [ -f u-boot.bin ] && P="" || P="$TT/" + [ -f ${P}u-boot.bin ] \ + || die "Board is in bootstrap mode but no boot files here!" + + # Send uboot. + chat -t 5 -e CCC '\c' || die "Loader did not load" + lsx ${P}u-boot.bin + chat -e 'autoboot: ' '\rversion' || die "U-boot did not load" +fi +[ "$1" = "boot" ] && exit 0 + +chat -t 10 -e '' 'blah' 'boot>' 'loadb' || die "Not in u-boot mode" +gkermit --x -s boot.bin + +# Remove write protection for boot area in the flash chip +chat -t 10 -e 'boot>' "protect off 10000000 10003fff" \ + 'boot>' "erase 10000000 10003fff" \ + 'Erasing' '\c' ECHO OFF \ + 'Erased' '\c' ECHO ON ' 2 sectors' '\c' \ + || die "Could not erase flash sectors" + +# Copy boot.bin from SDRAM to flash. 0x21000000 ==> 0x10000000, 0x3D00 bytes +chat -t 10 -e 'boot>' "cp.b 21000000 10000000 3D00" \ + ' done' '\c' \ + || die "Could not write to flash" + +snSize=1c +if [ -f sn.txt ] ;then + # The sn.txt file is five decimal integers in 1 or more lines + dumpdev -if sn.txt -iformat D4 -of sn.bin -bs 28 + if [ -f eth.txt ] ;then + # The eth.txt file is six hex bytes in 1 or more lines + dumpdev -if eth.txt -iformat H1 -bs 6 >> sn.bin + snSize=22 + fi +fi +if [ -f sn.bin ] ;then + # Program the serial number block too (34/0x1C bytes) + chat -t 10 -e 'boot>' 'loadb' || die "Missing u-boot prompt ?!" + gkermit --x -s sn.bin + chat -t 10 -e 'boot>' "cp.b 21000000 10003D00 $snSize" \ + ' done' '\c' \ + || die "Could not write to flash" +fi + +# Reprotect the boot sectors in flash +chat -t 10 -e 'boot>' "protect on 10000000 10003fff" \ + 'Protected 2 sectors' 'blah' \ + || die "Could not reprotect flash" +# diff --git a/.stuff/bin/doze b/.stuff/bin/doze new file mode 100755 index 0000000..2d006c5 --- /dev/null +++ b/.stuff/bin/doze @@ -0,0 +1,14 @@ +#!/bin/sh -x + +/usr/share/wicd/scripts/50-wicd-suspend.sh +killall vpnc +/etc/rc.d/dnsmasq stop +rm -f /var/run/resolvconf/interfaces/* + +echo -n mem >/sys/power/state + +/etc/rc.d/dnsmasq start +/usr/share/wicd/scripts/80-wicd-connect.sh +sleep 2 +/etc/rc.d/tpfand restart +sh -c 'sleep 10 ; /home/fm/bin/unbind-ultranav-touchpad' & diff --git a/.stuff/bin/drange b/.stuff/bin/drange new file mode 100755 index 0000000..c1daa37 --- /dev/null +++ b/.stuff/bin/drange @@ -0,0 +1,2 @@ +#!/bin/sh +awk '$1 >= T1+0 && $1 <= T2+2' T1=`date -d "$1" +%s` T2=`date -d "$2" +%s` $3 diff --git a/.stuff/bin/hexdmp b/.stuff/bin/hexdmp new file mode 100644 index 0000000..9c747f3 --- /dev/null +++ b/.stuff/bin/hexdmp @@ -0,0 +1,12 @@ +#!/bin/sh +## +# $Id$ +# (C) Copyright 2006 Amplex, fm@amplex.dk +# +# ABSTRACT: Nice formatted hex dump in bytes, hex & ascii +## +exec hexdump -e '"%08.8_Ax\n"' \ + -e '"%08.8_ax " 8/1 "%02x " " " 8/1 "%02x "' \ + -e '" |" 16/1 "%_p" "|\n"' \ + "$@" + diff --git a/.stuff/bin/ie6 b/.stuff/bin/ie6 new file mode 100755 index 0000000..95c5923 --- /dev/null +++ b/.stuff/bin/ie6 @@ -0,0 +1,3 @@ +#!/bin/bash +cd +WINEPREFIX="/home/fm/.ies4linux/ie6" wine "/home/fm/.ies4linux/ie6/drive_c/Program Files/Internet Explorer/IEXPLORE.EXE" "$@" diff --git a/.stuff/bin/keyrenew b/.stuff/bin/keyrenew new file mode 100755 index 0000000..ec1c723 --- /dev/null +++ b/.stuff/bin/keyrenew @@ -0,0 +1,20 @@ +#!/bin/bash +export SSH_ASKPASS="/home/fm/bin/gksupass" +#export SSH_ASKPASS=/usr/bin/gnome-ssh-askpass2 +export DISPLAY=:0 + +keyFile=$HOME/.ssh/id_dsa +leaveTime=19:00:00 +leastMins=120 + +if [[ ! -f ~/.keychain/`uname -n`-lockf && + `/usr/bin/xscreensaver-command -time 2>&1` == *non-blanked* ]] +then + eval $(keychain --eval -q) + if [[ `ssh-add -l` != *$keyFile* ]] ;then + #mins=$(((($(date -d $leaveTime +%s) - $(date +%s)) / 60))) + [[ $mins -lt $leastMins ]] && mins=$leastMins + #keychain --lockwait 1 --quiet $keyFile --timeout $mins >/dev/null 2>&1 + keychain --lockwait 1 --quiet $keyFile >/dev/null 2>&1 + fi +fi diff --git a/.stuff/bin/lua-agent b/.stuff/bin/lua-agent new file mode 100755 index 0000000..646e7ff --- /dev/null +++ b/.stuff/bin/lua-agent @@ -0,0 +1,4 @@ +#!/bin/bash +LUADIR=${LUA_CPATH%/?.so} +LUADIR=${LUADIR##*;} +EXEC $VALGRIND ${LUADIR}/lua-agent "$@"DIR diff --git a/.stuff/bin/measure2date b/.stuff/bin/measure2date new file mode 100755 index 0000000..b497a2c --- /dev/null +++ b/.stuff/bin/measure2date @@ -0,0 +1,2 @@ +#!/bin/sh +grep -v ^time $1 | awk -F $'\t' '{print strftime("%d-%m-%y %T", $1), "\t", $0}' | cut -d$'\t' -f1,3- diff --git a/.stuff/bin/openUrl b/.stuff/bin/openUrl new file mode 100755 index 0000000..21e8fbd --- /dev/null +++ b/.stuff/bin/openUrl @@ -0,0 +1,3 @@ +#!/bin/sh +kfmclient openURL "$@" + diff --git a/.stuff/bin/prnt b/.stuff/bin/prnt new file mode 100755 index 0000000..766d18f --- /dev/null +++ b/.stuff/bin/prnt @@ -0,0 +1,3 @@ +#!/bin/sh +enscript --columns=2 --landscape --borders --highlight "$@" + diff --git a/.stuff/bin/setTbird b/.stuff/bin/setTbird new file mode 100755 index 0000000..3a58c1e --- /dev/null +++ b/.stuff/bin/setTbird @@ -0,0 +1,3 @@ +#!/bin/sh +dcop kded wmiface findAllWindows '' Thunderbird-bin '' '' '' 0 \ + | xargs -l dcop kded wmiface forceActiveWindow diff --git a/.stuff/bin/unbind-ultranav-touchpad b/.stuff/bin/unbind-ultranav-touchpad new file mode 100755 index 0000000..f3f3271 --- /dev/null +++ b/.stuff/bin/unbind-ultranav-touchpad @@ -0,0 +1,20 @@ +#!/bin/sh + +VENDOR=06cb +PRODUCT=0009 +IF=1.0 + +while read VENDOR PRODUCT ;do + for i in /sys/bus/usb/devices/* ; do + if [ -e $i/idVendor ] && [ `cat $i/idVendor` = $VENDOR ] && \ + [ -e $i/idProduct ] && [ `cat $i/idProduct` = $PRODUCT ] && \ + [ -e $i\:$IF/driver/unbind ] + then + echo -n `basename $i`\:$IF > $i\:$IF/driver/unbind + break + fi + done +done << EOF +06cb 0009 +0002 0007 +EOF diff --git a/.stuff/bin/upd-ssh-boxlists b/.stuff/bin/upd-ssh-boxlists new file mode 100755 index 0000000..cf2f554 --- /dev/null +++ b/.stuff/bin/upd-ssh-boxlists @@ -0,0 +1,65 @@ +#!/bin/bash + +HTTOOLS=$HOME/amplex/ampep/HtTools + +runBS() { + BSSERVER=$1 $HTTOOLS/bsTest $HTTOOLS/bsh/$2.bsh +} + +mkTemp() { + mktemp /tmp/.updssh-tmp.XXXXXXXXXX +} + +getList() { + local F=`mkTemp` + runBS $1 listBoxes > $F + if grep --silent ANNOT: $F ;then + awk '/\t/' $F | sort + else + return 1 + fi + rm $F +} + +updFile() { + local Ip=`au-sshgw $1 hostip` + local F=`mkTemp` + [[ $1 == *-stg ]] && Ip=${Ip}:8000 + echo -n "Updating list for $1 ($Ip) ... " + if getList $Ip > $2.tmp ;then + mv -f $2.tmp $2 + echo 'DONE' + else + rm -f $2.tmp + echo 'FAILED' + fi +} + +if [[ ! $1 ]] ;then + echo 'Usage: upd-ssh-boxlists {|UPDATE}' 1>&2 + exit +fi + +if [[ $1 == UPDATE ]] ;then + #sudo vpnc-disconnect + #sudo vpnc amp-ae + for i in `au-sshgw gwlist | grep ^ad-` ;do + File=/opt/toolchain/utils/sshgw/files/boxes-${i}.db + [[ -f $File ]] && updFile $i $File + done + #sudo vpnc-disconnect + #sudo vpnc amp-ain + for i in `au-sshgw gwlist | grep ^ain-` ;do + File=/opt/toolchain/utils/sshgw/files/boxes-${i}.db + [[ -f $File ]] && updFile $i $File + done + svn st /opt/toolchain/utils/sshgw/files + #sudo vpnc-disconnect + exit +fi + +for i ;do + getList $i +done + + diff --git a/.stuff/bin/valgdb b/.stuff/bin/valgdb new file mode 100755 index 0000000..7a8914c --- /dev/null +++ b/.stuff/bin/valgdb @@ -0,0 +1,2 @@ +#!/bin/sh +exec valgrind --db-attach=yes --db-command='clewn -ga "%f %p"' "$@" diff --git a/.stuff/bin/valgrups b/.stuff/bin/valgrups new file mode 100755 index 0000000..a2d90ef --- /dev/null +++ b/.stuff/bin/valgrups @@ -0,0 +1,2 @@ +#!/bin/sh +exec valgrind --db-attach=yes --db-command='ups %f %p' "$@" diff --git a/.stuff/bin/vi b/.stuff/bin/vi new file mode 120000 index 0000000..a1bf1f1 --- /dev/null +++ b/.stuff/bin/vi @@ -0,0 +1 @@ +/usr/bin/gvim \ No newline at end of file diff --git a/.stuff/bin/view b/.stuff/bin/view new file mode 120000 index 0000000..a1bf1f1 --- /dev/null +++ b/.stuff/bin/view @@ -0,0 +1 @@ +/usr/bin/gvim \ No newline at end of file diff --git a/.stuff/bin/virep b/.stuff/bin/virep new file mode 100755 index 0000000..d0bcd29 --- /dev/null +++ b/.stuff/bin/virep @@ -0,0 +1,60 @@ +#!/usr/bin/env lua + + +local function copyrec(s, d) + d = d or {} + for k,v in pairs(s) do d[k] = v end + return d +end + +local function findandset(line, pattern, ret) + local t = { line:find(pattern) } + return t[1] and copyrec({ start = t[1], stop = t[2], select(3, unpack(t)) }, ret) + or nil +end + +local function regsub_s(t, reg, sub) + local num + t.s, num = string.gsub(t.s, reg, sub, 1234567890) + return num > 0 +end + +local line,file,modified,pid,running +local pids = {} +local fd = io.popen("sh -c 'vi -r 2>&1'", "r") +while true do + local t = {} + + line = fd:read("*line") + if not line then break end + if findandset(line, "^ *In directory (.*)", t) then + io.write(t[1].."\n") + elseif findandset(line, "^ *file name: (.*)", t) then + file = t[1] + elseif findandset(line, "^ *modified: (%a*)", t) then + modified = t[1] ~= "no" + elseif findandset(line, "^ *process ID: (%d*)(.*)", t) then + pid = t[1] + tty = { s = "" } + if string.find(t[2], "(still running)", 1, true) ~= nil then + if pids["pid-"..pid] then + tty.s = pids["pid-"..pid] + else + local ifd = io.popen("ps --no-headers --format tty --pid " .. pid, "r") + tty.s = ":" .. ifd:read("*line") + ifd:close() + if regsub_s(tty, "tty", "") then + elseif regsub_s(tty, "pts/", "pt") then + elseif regsub_s(tty, "tts/", "t") then + end + pids["pid-"..pid] = tty.s + end + end + if file and modified ~= nil then + io.write(string.format("%s %5d%-5s %s\n", modified and "+" or "-", + pid, tty.s, file)) + end + line,file,modified,pid,running = nil + end +end + diff --git a/.stuff/bin/xfce4 b/.stuff/bin/xfce4 new file mode 100755 index 0000000..dbc1a03 --- /dev/null +++ b/.stuff/bin/xfce4 @@ -0,0 +1,2 @@ +#!/bin/sh +exec ck-launch-session startxfce4