Thursday, October 24, 2024

Monday, September 23, 2024

Perl One-Liner to grab IP from TCPDUMP

for grabbing source IP addresses from TCPDUMP output:

cat filename | awk '{print $3}' | perl -ne '$ip = $1 if /^(\d+\.\d+\.\d+\.\d+).*$/; print "$ip\n"' | sort | uniq

or to grab dest addresses substitute the fifth element

cat filename | awk '{print $5}' | perl -ne '$ip = $1 if /^(\d+\.\d+\.\d+\.\d+).*$/; print "$ip\n"' | sort | uniq

Wednesday, March 11, 2015

Thursday, January 12, 2012

Current Year with Perl

Perl scripters,

Did you ever want to just grab the current year in four digit format without pulling in the entire localtime array?  Me too.  Here is a simple statement that does just that and nothing more.  It pulls in the sixth element of the array which is the year.  Don't forget, the array begins with index value 0 so the sixth element has an index value of 5.

     $currentyear = (localtime)[5] + 1900;

Enjoy.

Sunday, January 03, 2010

Homemade Gray-Hoverman Antenna

I built an antenna over the holiday weekend. It receives just as well as the Radio Shack VHF/UHF that I bought twenty years ago for $30. I left that one in the attic at my last house when I moved.

I based it on the DBGH, double bay Gray Hoverman, designs that I found online at a Canadian forum. Below is a picture of of the one I built.




I used some old wood and wires and hardware that were lying around out in the garage so it did not cost me a dime of real money, just the time that I put into it. I figure I saved about $100 based on comparable antennas online.

I am picking up 28 channels just as I did at the other house with the RS antenna and I am feeding my whole house, which is currently three TV's. Several of these channels even broadcast in full HD so it looks real good on my HDTV.

If I had to built it again, I would just build a single bay and put a pre-amp on it. Give it a try. It wasn't that hard and it works very well.

Internet Speeds at New House

Still using same Windstream but they have fiber to the house in the new neighborhood as opposed to copper in the old neighborhood.



Upload speeds are much better. Now, on to wiring the whole house for Ethernet (100M full duplex that is).

Friday, June 20, 2008

Change Case in Excel

Have you ever needed to change the case of text in selected cells within an Excel spreadsheet? After searching the Internet, I found something close then modified it to meet my needs. Others may need to do the same so here is the macro that I ended up with.




Sub Change_Case()

Dim ocell As Range
Dim Ans As String
Ans = Application.InputBox("Type in Letter" & vbCr & _
"(L)owercase, (U)ppercase, (S)entence, (T)itles ")
If Ans = "" Then Exit Sub
If TypeName(Selection) <> "Range" Then Exit Sub

For Each ocell In Selection

Select Case UCase(Ans)
Case "L": ocell = LCase(ocell.Text)
Case "U": ocell = UCase(ocell.Text)
Case "S": ocell = UCase(Left(ocell.Text, 1)) & _
LCase(Right(ocell.Text, Len(ocell.Text) - 1))
Case "T": ocell = Application.WorksheetFunction.Proper(ocell.Text)
End Select

Next

End Sub




I only needed it to force all upper or all lower case. I have not tested the other options so use it at your own risk.