.bashrc: Better perl random seed.

This commit is contained in:
Ole Tange 2020-11-29 01:20:13 +01:00
parent 3bb1f40623
commit 5537111e0d

View file

@ -2,6 +2,9 @@
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples # for examples
PATH=$HOME/bin:$PATH:/sbin:/usr/sbin:$HOME/.local/bin:$HOME/.cargo/bin
export PATH
# If not running interactively, skip the rest # If not running interactively, skip the rest
[ -z "$PS1" ] && return [ -z "$PS1" ] && return
@ -25,7 +28,7 @@ fi
set_color_prompt() { set_color_prompt() {
_colorcombos() { _colorcombos() {
PERL_HASH_SEED=109 perl -MB -e ' PERL_HASH_SEED=9 perl -MB -e '
use B; use B;
# color combinations that are readable (e.g. no red on red) # color combinations that are readable (e.g. no red on red)
@c =(map { "$_\n0\n" } @c =(map { "$_\n0\n" }
@ -34,7 +37,8 @@ set_color_prompt() {
1..9,12..13,16..45,52..81,88..116,124..151,153,160..180, 1..9,12..13,16..45,52..81,88..116,124..151,153,160..180,
182..185,187..189,196..214,232..252,255..254); 182..185,187..189,196..214,232..252,255..254);
for(@ARGV) { for(@ARGV) {
print @c[hex(B::hash($_)) % $#c]; srand(hex(B::hash($_))+$ENV{PERL_HASH_SEED});
print @c[rand()* ($#c+1)];
} }
' "$@" ' "$@"
} }
@ -51,14 +55,14 @@ xterm-color)
xterm-256color) xterm-256color)
set_color_prompt set_color_prompt
;; ;;
screen-256color)
set_color_prompt
;;
*) *)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
;; ;;
esac esac
# Comment in the above and uncomment this below for a color prompt
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# If this is an xterm set the title to user@host:dir # If this is an xterm set the title to user@host:dir
case "$TERM" in case "$TERM" in
xterm*|rxvt*) xterm*|rxvt*)
@ -73,9 +77,9 @@ esac
# ~/.bash_aliases, instead of adding them here directly. # ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package. # See /usr/share/doc/bash-doc/examples in the bash-doc package.
#if [ -f ~/.bash_aliases ]; then if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases . ~/.bash_aliases
#fi fi
# enable color support of ls and also add handy aliases # enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then if [ "$TERM" != "dumb" ]; then
@ -85,11 +89,6 @@ if [ "$TERM" != "dumb" ]; then
#alias vdir='ls --color=auto --format=long' #alias vdir='ls --color=auto --format=long'
fi fi
# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
# enable programmable completion features (you don't need to enable # enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc). # sources /etc/bash.bashrc).
@ -100,10 +99,8 @@ fi
LS_COLORS='no=00:fi=00:di=01;34:ln=01;35:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;31:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:'; LS_COLORS='no=00:fi=00:di=01;34:ln=01;35:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;31:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:';
export LS_COLORS export LS_COLORS
#PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$  ' EDITOR=em
#export PS1 export EDITOR
PATH=$HOME/bin:$PATH:/sbin:/usr/sbin:$HOME/.local/bin:$HOME/.cargo/bin
VISUAL=em VISUAL=em
export VISUAL export VISUAL
LESS=-Mqnfr LESS=-Mqnfr
@ -134,11 +131,6 @@ ssha() {
ssha ssha
#export MOZ_NO_REMOTE=1 #export MOZ_NO_REMOTE=1
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME
export ORACLE_SID=XE
export PATH
LC_ALL=en_US.UTF-8 LC_ALL=en_US.UTF-8
bind 'set convert-meta off' bind 'set convert-meta off'
@ -176,7 +168,9 @@ alias y=idok
# gqview ui? # gqview ui?
#export QT_SCALE_FACTOR=2 #export QT_SCALE_FACTOR=2
MANPATH=$MANPATH:$HOME/share/man MANPATH=$MANPATH:$HOME/share/man
export mysqlrootpass=RjQ+-ErFj4Ld if [ -f ~/.mysqlrootpassword ]; then
export mysqlrootpass=$(cat ~/.mysqlrootpassword)
fi
cat <<EOF | bash 2>/dev/null >/dev/null cat <<EOF | bash 2>/dev/null >/dev/null
( (
@ -238,8 +232,12 @@ IO() {
perl -ne 'BEGIN { $| = 1; $string = shift } perl -ne 'BEGIN { $| = 1; $string = shift }
s/(........)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)/$1$3$9$21/ s/(........)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)/$1$3$9$21/
|| ||
s/(........)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)/$1$4$5$16/; s/(........)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)(\s+\S+)/$1$4$5$16/;
/Device/ and print and next; /Device/ and print and next;
m^$string^ and print; m^$string^ and print;
' $string; ' $string;
} }
ORACLE_HOME=/usr/lib/oracle/19.6/client64
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME
export ORACLE_SID=XE