Archive for category General Information
Default server build
Posted by Darrell in General Information on October 23, 2009
default server build
munin-node nagios-nrpe-server nagios-plugins nagios-plugins-basic nagios-plugins-standard ldap-auth-client postfix rdist
ln -s /bin/bash /usr/local/bin/bash
ln -s /usr/bin/rdist /usr/local/bin/rdist
vi /etc/auth-client-config/profile.d/open_ldap
###################################################################
[open_ldap]
nss_passwd=passwd: files ldap
nss_group=group: files ldap
nss_shadow=shadow: files ldap
nss_netgroup=netgroup: files ldap
pam_auth=auth required pam_env.so
auth sufficient pam_unix.so likeauth nullok
#the following line (containing pam_group.so) must be placed before pam_ldap.so
#for ldap users to be placed in local groups such as fuse, plugdev, scanner, etc …
auth required pam_group.so use_first_pass
auth sufficient pam_ldap.so use_first_pass
auth required pam_deny.so
pam_account=account sufficient pam_unix.so
account sufficient pam_ldap.so
account required pam_deny.so
pam_password=password sufficient pam_unix.so nullok md5 shadow
password sufficient pam_ldap.so use_first_pass
password required pam_deny.so
pam_session=session required pam_limits.so
session required pam_unix.so
session optional pam_ldap.so
##################################################################
auth-client-config -a -p open_ldap
Perl One-Liners
Posted by Darrell in General Information on April 21, 2009
Perl one liners I hate having to search for everytime I need it.
# the always present hello world program
perl -e 'print "Hello World!\n"'
# rename in each file name the string aaa by bbb
ls | perl -ne 'chomp; next unless -e; $o = $_; s/aaa/bbb/; next if -e; rename $o, $_';
# add first and last column in each line of file foo.txt and print it out
perl -lane 'print $F[0] + $F[-1]' foo.txt
# print lines 15 to 17 of file foo.txt
perl -ne 'print if 15 .. 17' foo.txt
# a second way to print lines 3 to 5 of file foo.txt
perl -pe 'exit if 3<$. && $.<5' foo.txt
# change all words "foo"s to "bar"s in every .c file and keep backups
perl -p -i.bak -e 's/\bfoo\b/bar/g' *.c
# the same but without backup. Remember the flags: "eat the pie"
perl -p -i -e 's/foo/bar/g' *.c
# changes ^M newline characters to newlines
perl -p -i -e 's/\012?\015/\n/g' $1
# the same but with all files with name filename
perl -p -i -e 's/foo/bar' `find . -name "filename"`
# substitution can also be applied to binary files like test.ppm
perl -p -i -e 's/255/127/g' test.ppm
# substitute "xyz.math" to "abc.math" in every .html file and keep backups
perl -p -i.bak -e 's/xyz\.math/abc\.math/g' *.html
# insert department name after each title and keep backup
perl -p -i.bak -e 's#<title>#<title>Harvard .: #i' *.html
# delete first 10 lines in foo.txt and keep backup foo.txt.bak
perl -i.bak -ne 'print unless 1 .. 10' foo.txt
# change isolated occurrence of aaa to bbb in each file *.c or *.h
perl -p -i.bak -e 's{\baaa\b}{bbb}g' *.[ch]
# reverses lines of file foo.txt and print it
perl -e 'print reverse <>' foo.txt
# find palindromes in a dictionary /usr/share/dict/words
perl -lne 'print if $_ eq reverse' /usr/share/dict/words
# reverses paragraphs in file foo.txt
perl -00 -e 'print reverse <>' foo.txt
# increments all numbers in foo.tx by 1
perl -pe 's/(\d+)/ 1 + $1 /ge' foo.txt
# reverses order of characters in each line of foo.txt
perl -nle 'print scalar reverse $_' foo.txt
# print lines beween START and END in foo.txt to STDOUT
perl -ne 'print if /^START$/ .. /^END$/' foo.txt
# delete lines beween START and END and backup original file
perl -i.old -ne 'print unless /^START$/ .. /^END$/' foo.txt
# look for duplicated words in a line
perl -0777 -ne 'print "$.: doubled $_\n" while /\b(\w+)\b\s+\b\1\b/gi' foo.txt
# start Perl debugger "stand-alone"
perl -d -e 42
# run a Perl program program.pl with warnings
perl -w program.pl
# run a Perl program program.pl with debugger
perl -d program.pl
# Run perl program program.pl, check syntax, print warnings
perl -wc program.pl
Jaunty Jackalope(Ubuntu 9.04) and Windows 7 Dual Boot
Posted by Darrell in General Information on January 15, 2009

Jaunty Jackalope Ubuntu 9.04 Alpha 2 and Windows 7 dual boot
Crazy Yes I know, but it is exciting. Besides having to waste a perfectly good DVD-R for the image file I have had no issues yet. Download Jaunty Jackalope and try it out here. I have a dual boot Windows 7 and and Ubuntu 9.04(Jaunty Jackalope) laptop. My dell Inspiron E1505 previously a Windows XP and Ubuntu 8.10 machine with Intel Dual core, 2GB of memory, and an nvidia 7300 go has always run anything I have thrown at it. Fallout 3 was a stretch, but you get the point. I haven’t done much with the system since install, but It does boot really fast(23 seconds) Thank you EXT4. I will play around with this over the next two months and let you know how I feel about it. I just can’t believe I have a dual boot Windows 7 and Ubuntu 9.04 the jaunty jackalope on my laptop with default installs and nothing custom. Now it is time to get custom. Feel free to ask questions about the install, or if you are having issues let us know.