X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=.bashrc;h=7a125a3204078574fada06f8ceab449e1a33c6e2;hp=842e9548fca8170722c09c7a2b7ffa0d50d70888;hb=db298625c333db7c7a382cd29d718a8045303ed1;hpb=2dea7f4f436546bb422f59911f406d500985d01f diff --git a/.bashrc b/.bashrc index 842e954..7a125a3 100644 --- a/.bashrc +++ b/.bashrc @@ -146,12 +146,18 @@ eval ' function cvsignoresallrm { cvsutil --ignores --workings --rm "$@"; } function svnignoresall { svn status |sed -n "s/^[?] //p" "$@"; } function svnignoresallrm { svn status |sed -n "s/^[?] //p"|tr "\n" "\0"|xargs -0 rm -rf "$@"; } + function ignores { find -name "*.orig" -o -name ".#*" -o -name "*~" "$@"; } + function ignoresrm { ignores "$@" | xargs rm -f; } + function ignoresall { ignores -o -name "*.rej" "$@"; } + function ignoresallrm { ignoresall "$@" | xargs rm -f; } function disass { objdump -D --target=binary --architecture=i386 "$@"; } function cal {(unset cal; ( cal -m "$@"; ); );} function vncreadonly { vncviewer -FullColor -Shared -ViewOnly "$@"; } function diff {(unset diff; ( diff -up "$@"; ); );} - function rpmbuildlocal { nice rpmbuild --define "_topdir $PWD" --define "_builddir $PWD" --define "_rpmdir $PWD" --define "_sourcedir $PWD" --define "_specdir $PWD" --define "_srcrpmdir $PWD" --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" "$@"; } + function rpmbuildlocal { nice rpmbuild --define "_topdir $PWD" --define "_builddir $PWD" --define "_rpmdir $PWD" --define "_sourcedir $PWD" --define "_specdir $PWD" --define "_srcrpmdir $PWD" --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" "$@"; rmdir &>/dev/null BUILDROOT; } function gdbn { gdb -nx --command=~/.gdbinit "$@"; } + function hd { od -Ax -tx1; } + function wget {(unset wget; ( wget --no-check-certificate "$@"; ); );} ' export IGNOREEOF=10 @@ -167,7 +173,7 @@ for file in $HOME/.bookmarks.html;do done export GREP_OPTIONS="--binary-files=without-match --directories=skip" if echo x|GREP_OPTIONS="--exclude=y" grep -q x 2>/dev/null;then - export GREP_OPTIONS="$GREP_OPTIONS --exclude=tags --exclude=TAGS --exclude=CVS --exclude=ChangeLog*" + export GREP_OPTIONS="$GREP_OPTIONS --exclude=tags --exclude=TAGS --exclude=CVS --exclude=ChangeLog* --exclude=*.svn-base --exclude=*~" # FIXME: grep(1) ignores subdirectories for --exclude. #export GREP_OPTIONS="$GREP_OPTIONS --exclude=testsuite --exclude=.pc --exclude=.svn" fi @@ -183,6 +189,13 @@ export HISTSIZE=100000 export HISTFILESIZE="$HISTSIZE" export GDBHISTFILE="$HOME/.gdb_history" export CVS_RSH="ssh" +export TZ=":/usr/share/zoneinfo/Europe/Prague" +MAKEFLAGS= +cpus="`getconf _NPROCESSORS_ONLN`" +if [ -n "$cpus" ];then + MAKEFLAGS="$MAKEFLAGS -j$[$cpus+1]" +fi +unset cpus # Do not: grep -w "$TERM" /etc/termcap >/dev/null || export TERM=vt220 # as Sun workaround as Debian misses: /etc/termcap # expects: $uname_p @@ -255,8 +268,8 @@ function debuginfo { if test -n "$*";then echo "$*";else cat;fi \ |xargs rpm -qf|xargs rpmquery --qf '%{SOURCERPM}\n'|sed 's/-[^-]*-[^-]*[.]src[.]rpm$/-debuginfo/'|sort -u; } function ipcsrmall { ipcs|awk '/- Shared Memory/{x="-m"}/- Semaphore/{x="-s"}/^0x/{print "ipcrm "x" "$2}'; } function eog {(unset eog; touch /tmp/eog.$$;eog "$@" {,,,,,,,,,}/tmp/eog.$$;rm -f /tmp/eog.$$; );} -function diffc { diff -u "$@"|grep -v '^\(Only in \|Binary files\)'; } -function diffi { diffc -X ~/.diffi.list "$@"; } +function diffc { diff -up "$@"|grep -v '^\(Only in \|Binary files\)'; } +function diffi { diffc -X ~/.diffi.list "$@" | diffdecvs; } function cvs {(unset cvs local _opts _opts_d _now _line _o _opts_d="-d" @@ -277,6 +290,36 @@ function cvs {(unset cvs cvs $_line $_opts "$@" ); } function perlrpm { repoquery -q --whatprovides $(for i in "$@";do echo "perl($i)";done|sed -e 's/\//::/g' -e 's/[.]pm//g'); } +# `-u' limits the search to $UID. +function pidof +{(unset pidof + if [ "$1" = "-u" ];then + shift + local r="$(pidof "$@")" + local space="" + local p + for p in $r;do + if grep -q "$(echo -e "^Uid:\t$UID\t")" "/proc/$p/status";then + echo -n "${space}$p" + space=" " + fi + done + echo + else + pidof "$@" + fi +)} +function sumlog { find "$@" ! -name config.log -name "*.log" -o -name "*.sum"; } +function gdbcvscheckout {(set -ex + test -d cvs || test -d gdb-cvs || (set +x;cvs -z3 -d :pserver:anoncvs:@sourceware.org:/cvs/src checkout gdb) + mv src gdb-cvs + cd gdb-cvs + (set +x;cvs update) + #(set +x;cvsignoresall) + (set +x;ignoresall) + );} +function uri_escape { perl -MURI::Escape -le '$_=<>;chomp;print uri_escape $_;'; }; +function uri_unescape { perl -MURI::Escape -le '$_=<>;chomp;print uri_unescape $_;'; }; ulimit -S -c 0 set +H