Tuesday, December 1, 2009

Test ldap connection against Active Directory

How to test a connection to AD using linux ldapsearch


ldapsearch -LLL -x -H 'ldap://server.com:389' -b 'DC=domain,DC=office,DC=com' -D 'CN=openfire,OU=Service Accounts,OU=User Accounts,OU=DOMAIN,DC=domain,DC=office,DC=com' -W '(sAMAccountName=tor)'


This will make sure that your user can bind, and the in the search they can see user accounts.

We used this for ldap integration for authentication for JIRA and openfire.

Saturday, May 30, 2009

Locking the keyboard on a Blackberry Bold

Because I never read the manual, I was having problems locking the keyboard on my new Blackberry Bold. First, you have to turn off the language switching in the menu to be able to use the old 'Alt-Enter' shortcut for locking the keyboard.

Thing is, with the new trackball, that key combination is a little awkward, and I am so paranoid about dropping the dang thing, that I have been using the menu option for locking.

Until now.

Jeez, the manual for this thing is literally hundreds of pages, and to be honest, I've never even looked at it. I mean, seriously, why wouldn't I already know everything about using a Blackberry?

So, two key shortcuts I learned today are;

hold down '*', this will lock the keyboard
hold down '#', this will toggle between vibrate and normal profiles

Sweet.

Monday, April 27, 2009

ruby script to search for email addresses in a log file

Given input that is ":" delimited, this script will search out email addresses in any field in the input:


cat log_file.txt | ruby -ne 'split(":").each { |col| print col , "\n" if col.match(/^\S+@\S+$/) }' | sort | uniq

Wednesday, April 22, 2009

awk script to add up lines in a file

You want to add up the numbers in a file?

Input:

56168
796
44
26
202
258
478
632

Script:

cat file | awk '{ total = total + $1} END { print total}'