Wednesday, March 18, 2015

Cisco 7841 PC headset adapter

Since I couldn't find this information elsewhere, even on the manufacturer's page, so... This PC headset adapter works with a Cisco 7841 phone: http://www.amazon.com/Headset-Buddy-Adapter-CISCO-Phone/dp/B003EALLHE
also:
http://www.headsetbuddy.com/cisco-pc-headset-adapter
SKU: 01-PC35-RJ9Cisco

Friday, February 13, 2015

rancid 3.x - juniper display set

I found a lot of directions on the net for how to change rancid 2.x to do "display set" for juniper switches, but none for rancid 3.x (this was tested on rancid 3.1.2 on CentOS 6.6)

It's actually pretty easy:
  1. Find your switch type (in this case "juniper") in /etc/rancid/rancid.types.base and copy those lines into /etc/rancid/rancid.types.conf:

    juniper;script;rancid -t juniper
    juniper;login;jlogin
    [...]
    juniper;command;junos::ShowConfiguration;show configuration


  2. Now change "juniper" to some unique string that doesn't exist in rancid.types.base, e.g. "juniper-dset"
  3. Modify all the "juniper" strings in rancid.types.conf to be "juniper-dset"

    juniper-dset;script;rancid -t juniper-dset
    juniper-dset;login;jlogin
    [...]
    juniper-dset;command;junos::ShowConfiguration;show configuration


  4. Add a new line to do the display set:

    juniper-dset;command;junos::ShowConfiguration;show configuration | display set | no-more

    It's up to you whether you want that before or after the normal multi-line "show configuration".

  5. Also, change /var/rancid/router.db to change the "juniper" switch type to "juniper-dset"

Tuesday, January 27, 2015

linux: how to determine if a binary is prelinked

On my systems I use aide to find changes to the system. On one of them, aide was complaining:

WARNING: AIDE detected prelinked binary objects on your system but the prelink tool (/usr/sbin/prelink) is missing!
WARNING: prelinked files will be processed without a prelink undo operation! Please install prelink to fix this.

This is because at one point, I did in fact use prelink. However, I had many issues with aide and prelink and finally just got fed up and removed it. Before doing that you're supposed to undo the prelink, but apparently I missed a file. But aide didn't tell me which one! I couldn't find any information on the net about how to determine whether a binary is prelinked, so here's the answer:

readelf -S | grep prelink

If the binary is prelinked, you'll get something like:

[30] .gnu.prelink_undo PROGBITS 0000000000000000 000e4790

But what if you don't know which file is prelinked? And /etc/prelink.cache is non-existent (because someone removed it) or empty? In that case, you have to examine every ELF binary on the system. I elected to break this into two steps. First, find all the ELF binaries:

find / -type f ! -path "/sys/*" ! -path "/dev/*" ! -path "/proc/*" \
! -path "/opt/splunk/var/*" ! -path "/mnt/*" ! -path "/media/*" ! -path "/srv/*" \
! -path "/net/*" ! -path "/selinux/*" | xargs file | grep ELF | cut -f1 -d':' \
> /tmp/elffiles

Now that you have a list of all the ELF binaries, test each of them to find out if they are prelinked. I did not use xargs in this case because although readelf works on multiple files, when combined with grep it would be hard to tell which of the arguments in the long argument list is the culprit:
for file in $(cat /tmp/elffiles) ; do
   readelf -S $file | grep -q prelink
   if [ $? -eq 0 ]; then echo $file is prelinked ; fi
done

I realize the above doesn't handle paths with spaces or other weird characters. I guess I'm lucky my system didn't have any of those.

Wednesday, January 14, 2015

Dell PERC command-line utility program perccli

This tool apparently works for all PERC9 controllers and the following operating systems are supported:
Novell SuSE Linux ES 11 
MS Windows Server 2012 
Red Hat Ent Linux 6 
Red Hat Ent Linux 7 
SUSE Linux ES 12 
MS Windows Server 2012 R2/SP 
MS Windows 2008 R2

Binaries are at: http://www.dell.com/support/home/us/en/19/Drivers/DriversDetails?driverId=3XDPP

HTML version of manual: http://www.dell.com/support/Manuals/us/en/19/Topic/poweredge-rc-h730/PERC_CLI_RG_Pub-v1/en-us

PDF of manual: http://topics-cdn.dell.com/pdf/poweredge-rc-h730_Reference%20Guide_en-us.pdf

Monday, January 5, 2015

Phonetic Alphabet of Confusion

I wanted to make a phonetic alphabet chart, but with words that all have the "wrong" sound at the start. e.g.A as in "aisle" I shamelessly stole most of this from

http://www.reddit.com/r/videos/comments/2g3fcw/i_had_another_phone_scammer_try_to_call_me_so_i/ckfs07x

I'd wanted to use words instead of names if possible (e.g. for "I", I'm used "Ian" because I couldn't find a word that starts with I but has an "e" or other sound.)

I thought about going through the Wiktionary database but that will take a while to program maybe...

Anyway, here's what I have so far:

A - aisle
B - bdellium
C - czar
D - djinn
E - euphrates
F - effluent (I would prefer a word that starts with "F")
G - gnome
H - honor
I - Ian  (can you think of a word not a proper name?)
J - jalapeno
K - knickers
L - elephant (I would prefer a word that starts with "L")
M - mnemonic
N - Nguyen (resorted to foreign language here :( )
O - ouija board
P - pterodactyl (bonus:  P sounds like T ) 
Q - qat
R - arse (I would prefer a word that starts with "R")
S - schadenfreude (can you think of a non-foreign word that starts "sch"
but sounds like "ch"?)
T - Tsunami (foreign origin, but has been adopted as English so I don't
feel bad about this one)
U - urn
V - vrow (frau) (optionally "vee") 
W - wren
X - Xian  (X is weird anyway, most words sound like "Z" anyway, so I
went with an "Sh" sound (Shee-an) instead! but again - it's a foreign
name, can't think of a word)
Y - yperite
Z - Zsa Zsa  (proper name :( )

Sunday, June 1, 2014

Perl script to quiz you for ARRL Ham radio exam

I've been studying for the Technician class amateur radio license. The ARRL sells a book that includes a CD with some nice software for practicing tests. However, if you don't have the book and/or CD, you might want to practice the test questions anyway. So I wrote a perl script that reads the text version of the question pool ( 2010 version or 2014 version), then asks you questions from it. example run:
# study.pl ~/Downloads/question_pool.txt

enter question # (blank for random question) or Ctrl-C to exit :

T6B07
What does the abbreviation "LED" stand for?
A. Low Emission Diode
B. Light Emitting Diode
C. Liquid Emission Detector
D. Long Echo Delay


answer? A
*** WRONG!      correct answer is (B)

enter question # (blank for random question) or Ctrl-C to exit :

T7A07
If figure T5 represents a transceiver in which block 1 is the transmitter portion and block 3 is the receiver portion, what is the function of block 2?
A. A balanced modulator
B. A transmit-receive switch
C. A power amplifier
D. A high-pass filter


answer? b
CORRECT!
Download the script

Thursday, April 3, 2014

Automating the VMware vSphere Perl SDK install with expect:


I couldn't find any other postings on the net about this, so here's my solution for automating the installation for the VMware vSphere Perl SDK on RHEL6 (this assumes you already have all the prerequisites installed.).  It probably works on any Linux OS but I only tested it on RHEL6.4.

Save this expect script (requires expect to be installed, duh!) in the same directory as the extracted tarball for the SDK (probably vmware-vsphere-cli-distrib/):
#!/usr/bin/expect

set timeout 120

spawn "./vmware-install.pl"

expect "Press enter to display " { send "\r" }
expect "vSphere Software Development Kit License Agreement" { send "q" }
expect "Do you accept" { send "yes\r" }
expect "Do you want to install precompiled Perl modules for RHEL" { send "\r" }
expect "In which directory do you want to install the executable files" { send "\r" }
# Wait for installation to finish
expect EOF
This accepts the defaults ("yes" to installing precompiled perl modules, "/usr/bin" for the installation directory) If you don't like that, edit the script!