Month: February 2010

  • Fedora 12 – Disable mouse focus

    One problem that I’ve had with Fedora 12 is that when enabling compliz the focus starts to follow the mouse pointer. This behavior is annoying to me as I don’t like events to occur unless I explicitly ask for them (aka click). To disable this feature, perform the following: 1. install control-center-extra 2. Open with […]

  • Bash Tips – Parse mail logs for used mail boxes

    I was auditing a set of mail servers at work the other day getting a list of all active user accounts and developed this little one liner: zgrep LOGIN /var/log/mail.log.[1-9].gz | sed -n ‘s/.*user=\(.*\), ip.*/\L\1/p’ | sort | uniq >> /tmp/mailbox.list This script finds all logins from the mail log and prints out only the […]

  • MySQL /tmp Usage with Optimize Table Command

    I’m currently trying to prune a MyISAM table with 200 million rows down to 100 million rows. As part of this process, I am simply removing any orphaned records. This is a simple tracking table where every record must have an associated record in the users table. The total size on disk is 11G of […]

  • Command line replace with perl

    I often run into issues on the command line where I’d like to perform a non-greedy search and replace. This is not possible with sed, grep, or egrep, AFAIK, so I must resort to perl. Here is how it’s done: perl -pe ‘s|”http://(.*?)/.*$|$1|g’ The above example will take a list of requested URIs or search […]

  • Apache – Getting rid of (internal dummy connection) in the logs.

    On busy sites the (internal dummy connection) message in apache logs can be a major annoyance as it fills the logs. A simple way to filter this out is to use the following log declarations (assuming IPV6 capable host): SetEnvIf Remote_Addr “::1” dontlog CustomLog /var/log/httpd/access_log combined env=!dontlog RE: http://wiki.apache.org/httpd/InternalDummyConnection

  • Decode base64 text using perl from the command line

    I recently ran into an issue where I needed to decode some base64 text from the command line and used perl to manage the task: perl -MMIME::Base64 -ne ‘print decode_base64($_)’ < /tmp/input.txt RE: http://perldoc.perl.org/MIME/Base64.html

  • Removing memberUid from OpenLDAP group

    The following syntax can be used to remove a user from an OpenLDAP group: $ ldapmodify -x -D “cn=manager,dc=example,dc=com” -W <<EOF > dn: cn=sshusers,ou=groups,dc=example,dc=com > changetype: modify > delete: memberUid > memberUid: previousMember > EOF