2007-08-21

freebsd: setuid core

$ sysctl kern.sugid_coredump=1
kern.sugid_coredump: 0 -> 1
$ sysctl kern.corefile="/var/coredumps/%N/%P.core"
kern.corefile: /var/coredumps/%N/%P.core -> /var/coredumps/%N/%P.core
$ mkdir /var/coredumps/[process name]
$ chown [process owner] /var/coredumps/[process name]

%N = process name
%P = process id

from core

9 ways to count to 10

$ i=1;while [ $i -lt 11 ];do echo $i; i=$(($i+1));done
$ i=1;until [ $i -eq 11 ];do echo $i; i=$(($i+1));done
$ seq 1 10
$ python -c 'for i in xrange(1,11): print i'
$ perl -e 'for $i (1 .. 10){ print "$i\n";}'
$ ruby -e '(1..10).each {|i| print i,"\n"}'
$ ruby -e '1.upto(10) {|i| puts i}'`
$ ruby -e 'for i in 1..10 do print i, "\n" end'
$ lua -e 'for i=1,10 do print(i) end'