if [[ -n $_IS_GENTOO ]]; then # Nice mappings to restart/... the services Start Stop Reload Restart () { local SUDO [[ $UID != 0 ]] && SUDO="sudo" $SUDO /etc/init.d/$1 ${0:l} } fi # Calculator autoload -U zcalc function = { zcalc -e "$*" } aliases[=]='LC_NUMERIC=C noglob =' # Quick find f() { echo "find . -iname \"*$1*\"" find . -iname "*$1*" } # zman -- easier browsing of zsh manpage # from zsh-users list, enhanced zman() { PAGER="less -g -s '+/(?i)^ "$1"'" man zshall } check_libs() { local libs found=0 for i in $(ps -A -o 'pid='); do libs=$(pmap -q $i | grep '(deleted)' | grep -v '\\|\[aio\]\|SYSV0\|\' | tr -s ' ' | cut -d' ' -f4 | sort -u) if [[ -n $libs ]]; then (($found)) && echo #newline between entries found=1 echo $libs echo ' ↳' $(ps -o 'args=' $i) fi done return $found } menc() { local p read -rs "p?Password: " echo echo "Loading ~/schreiben/" echo $p | encfs --stdinpass ~/.enc/schreiben/ ~/schreiben/ unset p } # list the current enabled gcc flags # based on a script by mv list_cc_flags() { local funcname=${0##*/} _Usage_$0 () { printf '%s\n' "Usage: $funcname c|o [gcc-Flags e.g. -march=native -O2] Show which compile|optimization flags are selected when you chose gcc-Flags" return ${1:-1} } case "${1}" in c) shift gcc -v -c -Q "${@}" -o /dev/null -x c - 2>&1 <&1;; *) _Usage_$0;; esac } if [[ -n $_IS_GENTOO ]]; then # Change to the directory of a specific package _cdu () { cd ${1:h} } # unpacks a specific package _unpack () { ebuild $1 clean unpack } # set job count to 1 if there is only one package to install emerge() { if [[ $# < 3 ]]; then command emerge --jobs=1 $@ else command emerge $@ fi } # keyword a specific package using flaggie # relies on the $_kw variable set in .zshenv kw() { if [[ -z $1 ]]; then echo "Error: Need the package" return 1 fi if whence flaggie NOE; then # use 'flaggie' flaggie $1 "+$_kw" else echo "Error: flaggie not installed" echo "Do it yourself!" return 1 fi } fi