initial checkin
[zsh-lovers.git] / zsh_people / strcat / zshmisc
1 #  ,----
2 #  | [dope@painless:~]% ulimit -a
3 #  | -t: cpu time (seconds)         2000
4 #  | -f: file size (blocks)         500000
5 #  | -d: data seg size (kbytes)     100000
6 #  | -s: stack size (kbytes)        8192
7 #  | -c: core file size (blocks)    0
8 #  | -m: resident set size (kbytes) unlimited
9 #  | -u: processes                  1791
10 #  | -n: file descriptors           1024
11 #  | -l: locked-in-memory size (kb) 50000
12 #  | -v: address space (kb)         unlimited
13 #  | -N 10: file locks              unlimited
14 #  | [dope@painless:~]%
15 #  `----
16 #
17 # Note: This settings protect *not* against 'fork'-bombs like
18 #  $ (){ :|:&};:
19 #  $ perl -e 'while(1){ fork();}'
20 # but i don't care a pap for it. Trust me. I know what I'm doing. See
21 # zshbuiltins(1) /ulimit for details.
22 ulimit -c 0       # prevent core files from being written at al
23 ulimit -d 100000  #  100 MB  data segment
24 ulimit -f 500000  #  500 MB  file size
25 ulimit -l unlimited 
26 #ulimit -l 50000   #   50 MB  locked memory
27 ulimit -n 1024    # 1024 open files
28 ulimit -s 8192    #    8 kb stack size
29 ulimit -t 2000    #  200 sec CPU time
30
31 # An array (colon separated list) containing the suffixes of files to
32 # be ignored during filename completion. However, if completion only
33 # generates files with suffixes in this list, then these files are
34 # completed anyway.
35 # Note: U can use ``ls **/*~*(${~${(j/|/)fignore}})(.)'' to list all
36 #       plain files that do not have extensions listed in `fignore'
37 fignore=( ,v .aux .toc .lot .lof .blg .bbl .bak .BAK .sav .old .o .trace .swp \~)
38
39 # Setting abbreviation like 'iab' with Vim.. YES! Zsh _IS_ evil *hr*. I
40 # use this instead of "global aliases".
41 #  $ Igr<Space>
42 # will be expanded to
43 #  $ groff -s -p -t -e -Tlatin1 -mandoc
44 typeset -A myiabs
45 myiabs=(
46         "Im"    "| more"
47         "Ig"    "| grep"
48         "Ieg"   "| egrep"
49         "Iag"   "| agrep"
50         "Igr"   "groff -s -p -t -e -Tlatin1 -mandoc"
51         "Ip"    "| $PAGER"
52         "Ih"    "| head"
53         "It"    "| tail"
54         "Is"    "| sort"
55         "Iv"    "| $EDITOR"
56         "Iw"    "| wc"
57         "Ix"    "| xargs"
58 )
59 my-expand-abbrev() {
60     local MATCH
61     LBUFFER=${LBUFFER%%(#m)[_a-zA-Z0-9]#}
62     LBUFFER+=${myiabs[$MATCH]:-$MATCH}
63     zle self-insert
64 }
65
66 #--------------------------------------------------
67 # Now in ~/.zsh/zshbindings
68 # bindkey     " "        my-expand-abbrev 
69 #-------------------------------------------------- 
70
71 # Set the "umask" (see "man umask"):
72 # ie read and write for the owner only.
73 # umask 002 # relaxed   -rwxrwxr-x
74 # umask 022 # cautious  -rwxr-xr-x
75 # umask 027 # uptight   -rwxr-x---
76 # umask 077 # paranoid  -rwx------
77 # umask 066 # bofh-like -rw-------
78 umask 066
79
80 # If root set unmask to 022 to prevent new files being created group and world writable
81 if (( EUID == 0 )); then
82     umask 022
83 fi
84
85 # fucking "dead.letter" *narf*
86 if [ -e ~/dead.letter ]; then
87          mv ~/dead.letter ~/.dead_letter.`date +%Y%m%d-%R`
88 fi
89
90 # >painless< is a "what happend if< - box (OpenBSD -current) and *.core -
91 # files is a matter of course :>
92 if [ "$HOSTNAME" = painless ]; then
93         if
94                 [ -e ${HOME}/{mutt,xmms,zsh,irssi,perl,fvwm,opera}.core ]; then
95                 zmv -M '(*).core' ~/.Core-Files/'$1.core-`date +%Y%m%d-%S`' && echo "Checkout ~/.Core-Files"
96         fi
97 fi
98
99 # 'hash' often visited directorys
100 #   Note: That's *not* variables or aliase!
101 #    ,----
102 #    | $ hash -d M=~/.mutt
103 #    | $ M
104 #    | ~/.mutt
105 #    | $ echo $M
106 #    |
107 #    | $ pwd
108 #    | /home/dope/.mutt
109 #    | $ 
110 #    `----
111 hash -d D=~/download/                                   # there are my downloads
112 hash -d F=/usr/local/share/zsh/$ZSH_VERSION/functions   # ZSH functions (OpenBSD)
113 hash -d F=/usr/share/zsh/$ZSH_VERSION/functions/        # ZSH functions (Slackware)
114 hash -d FD=/backups/Documentations                      # usefull documentations
115 hash -d FDD=/backups/Downloads                          # /new/ software an own make packages/ports
116 hash -d FF=/backups/Files                               # Pics, movies, ..
117 hash -d FS=/backups/System                              # my local backups
118 hash -d H=/backups/                                     # Backups from this host
119 hash -d HJ=~/.jed                                       # $JED_ROOT (${HOME})
120 hash -d I=~/.irssi/                                     # Files for Irssi
121 hash -d J=/usr/local/jed/                               # $JED_ROOT (Change it!)
122 hash -d L=~/.slang/                                     # Files for Slrn
123 hash -d M=~/.mutt/                                      # Files for Mutt
124 hash -d P=~/homepage/                                   # My personal webpage
125 hash -d RC=/etc/rc.d/                                   # executed files from init (Slackware)
126 hash -d S=~/scripts/                                    # (Un)tested local hacks
127 hash -d SO=/backups/Source                              # Mutt, Slrn, Vim, ..
128 hash -d U=/usr/src/linux/                               # Linux-Kernel
129 hash -d V=~/.vim/                                       # Files for Vim
130 hash -d VL=/var/log                                     # often visited ;)
131 hash -d Z=~/.zsh/                                       # "setupfiles" for ZSH
132 hash -d _S=~/.sigs/                                     # My signature collection