#! /bin/tcsh -f # {{{ Versioning and license info # # $Id: setup,v 1.13 2006/08/21 15:55:14 proclus Exp $ # Many thanks to Robert L. Campbell # Copyright (C) 2006 Michael L. Love # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # or find it at: http://www.gnu.org/copyleft/gpl.html # # }}} # {{{ Variable definitions setenv BOLD "" setenv UNBOLD "" setenv PREMARK "[01;" setenv POSTMARK "m" setenv UNMARK "" # cleanup ansi here ;-} # setenv UNMARK "" setenv UNMARK "" setenv UNMARK "" setenv UNMARK "" setenv LTGREY ${PREMARK}0${POSTMARK} setenv UNLTGREY ${UNMARK} setenv UNDERLINE ${PREMARK}4${POSTMARK} setenv UNUNDERLINE ${UNMARK} setenv BLINK ${PREMARK}5${POSTMARK} setenv UNBLINK ${UNMARK} setenv BLOCK ${PREMARK}7${POSTMARK} setenv UNBLOCK ${UNMARK} setenv GREY ${PREMARK}30${POSTMARK} setenv UNGREY ${UNMARK} setenv YELLOW ${PREMARK}33${POSTMARK} setenv UNYELLOW ${UNMARK} setenv GREEN ${PREMARK}32${POSTMARK} setenv UNGREEN ${UNMARK} setenv BLUE ${PREMARK}34${POSTMARK} setenv UNBLUE ${UNMARK} setenv CYAN ${PREMARK}36${POSTMARK} setenv UNCYAN ${UNMARK} setenv RED ${PREMARK}31${POSTMARK} setenv UNRED ${UNMARK} setenv MAGENTA ${PREMARK}35${POSTMARK} setenv UNMAGENTA ${UNMARK} setenv WHITE ${PREMARK}37${POSTMARK} setenv UNWHITE ${UNMARK} setenv BLOCKYELLOW ${PREMARK}43${POSTMARK} setenv UNBLOCKYELLOW ${UNMARK} setenv BLOCKGREEN ${PREMARK}42${POSTMARK} setenv UNBLOCKGREEN ${UNMARK} setenv BLOCKBLUE ${PREMARK}44${POSTMARK} setenv UNBLOCKBLUE ${UNMARK} setenv BLOCKCYAN ${PREMARK}46${POSTMARK} setenv UNBLOCKCYAN ${UNMARK} setenv BLOCKRED ${PREMARK}41${POSTMARK} setenv UNBLOCKRED ${UNMARK} setenv BLOCKMAGENTA ${PREMARK}45${POSTMARK} setenv UNBLOCKMAGENTA ${UNMARK} setenv BLOCKWHITE ${PREMARK}47${POSTMARK} setenv UNBLOCKWHITE ${UNMARK} # }}} # {{{ Set some basic/general values # determine operating system (architecture) setenv OS `uname -s` setenv OS_VERSION `uname -r` setenv MACHINE `uname -m` if ( -f /etc/debian_version ) then setenv DISTRO Debian else if ( -f /etc/fedora-release ) then setenv DISTRO FedoraCore else setenv DISTRO endif # make some big programs run better! if ( ${OS} != 'Darwin' && ${OS_VERSION} != '7.0.0' ) then unlimit stacksize limit coredumpsize 0 endif # }}} setenv pathDepth `echo $0 | sed s/'^\.'// | sed s/'^\/'// | sed s/'\/'/'\t'/g | wc -w` setenv progName `echo $0 | sed s/'^\.'// | sed s/'^\/'// | sed s/'\/'/'\t'/g | cut -f${pathDepth}` alias necho 'echo > /dev/null' alias printHeader 'necho' #alias printHeader 'echo' printHeader printHeader Welcome to ${GREEN}${progName}${UNGREEN} printHeader printHeader "Your OS is: ${CYAN}${DISTRO}${UNCYAN} " printHeader " ${BLUE}${OS}${UNBLUE} " printHeader " ${MAGENTA}${OS_VERSION}${UNMAGENTA} " printHeader " ${RED}${MACHINE}${UNRED} " printHeader if ( $#argv != 0 ) then goto $1 else setenv theGoto `echo | grep $progName` if ( ${theGoto} != '' ) then goto ${theGoto} endif endif # # scrypto # some shell based crypto by Michael L. Love (GPL) # Wed Sep 5 14:42:02 EDT 2007 # date --version > /dev/null if ( $? != 0 ) then echo this only works with GNU date exit endif which rungnu > /dev/null if ( $? == 0 ) then setenv SEED '.'`( rungnu 'date +%N' ) | cut -f2 -d' ' | sed s/'000$'//g | tr -d '\n'` setenv ARRAY 400 setenv SCALE 4 setenv WIDTH `(echo scale=${SCALE} && echo 'sqrt ('${ARRAY}')') | bc | sed s/'\\'//g | tr -d '\n' | cut -f1 -d'.'` setenv SEEDARRAY `(echo scale=${SCALE} && echo ${SEED}'*'${ARRAY}) | bc | sed s/'\\'//g | tr -d '\n' | cut -f1 -d'.'` setenv SEEDWIDTH `(echo scale=${SCALE} && echo 2+${SEED}'*'${WIDTH}) | bc | sed s/'\\'//g | tr -d '\n' | cut -f1 -d'.'` else setenv SEED `(echo scale=6 && date +%N | cut -b1-6 | sed s/'$'/'\/999999'/) | bc | sed s/'\\'//g | tr -d '\n'` sleep ${SEED} setenv SEED `(echo scale=6 && date +%N | cut -b1-6 | sed s/'$'/'\/999999'/) | bc | sed s/'\\'//g | tr -d '\n'``echo ${SEED} | sed s/'\.'// ` sleep ${SEED} setenv SEED `(echo scale=6 && date +%N | cut -b1-6 | sed s/'$'/'\/999999'/) | bc | sed s/'\\'//g | tr -d '\n'``echo ${SEED} | sed s/'\.'// ` #setenv ARRAY ${1} setenv ARRAY 400 setenv WIDTH `(echo scale=22 && echo 'sqrt ('${ARRAY}')') | bc | sed s/'\\'//g | tr -d '\n' | cut -f1 -d'.'` setenv SEEDARRAY `(echo scale=22 && echo ${SEED}'*'${ARRAY}) | bc | sed s/'\\'//g | tr -d '\n' | cut -f1 -d'.'` setenv SEEDWIDTH `(echo scale=22 && echo 2+${SEED}'*'${WIDTH}) | bc | sed s/'\\'//g | tr -d '\n' | cut -f1 -d'.'` endif setenv RANDARRAY1 `echo ${SEED} | rev | cut -b1` setenv RANDARRAY2 `echo ${SEED} | rev | cut -b2-3` setenv RANDARRAY3 `echo ${SEED} | rev | cut -b4-7` printHeader the seed is $SEED printHeader the array size is $ARRAY printHeader the width size is $WIDTH printHeader the seed array size is $SEEDARRAY printHeader the seed width size is $SEEDWIDTH cat - | tr -s ' ' | tr -s '\t' |\ rs | rs ${SEEDARRAY} | tac |\ rs | rs -t 213 \ rs | rs -t ${WIDTH} | tac |\ rs | rs 101 \ rs | rs -t ${SEEDWIDTH} | tac |\ rs | rs -t ${RANDARRAY3} | tac |\ rs | rs 51 \ rs | rs -t ${RANDARRAY2} | tac |\ rs | rs -t 6 \ rs | rs -t ${RANDARRAY1} | tac |\ rs | rs -t 9 \ rs | rs -t 8 \ rs | rs -t 5 \ rs | rs 4 \ rs | rs -t 7 \ rs | rs -t 5 \ rs | rs -t 3 \ rs | rs 2 \ rs | rs -t 1 \ rs | rs -t 3 \ rs | rs -t 2 \ rs | rs -t 4 \ rs | rs -t 1 \ exit commands: echo echo The following ${GREEN}${progName}${UNGREEN} commands are available: echo grep -a -H ':$' $0 | sed s/:/' '/g echo exit