Showing posts with label Shell. Show all posts
Showing posts with label Shell. Show all posts

Thursday, 29 October 2009

Random Musings - Day #303

The Japanese Premier, Yugo Hatoyama maybe launching an attack on the charts. Meanwhile Wham's "Freedom" was #1 many years ago.

It's 1000 days from the start of the Olympics.

Any interesting script in two lines to mess around with a script file and generate a listing ports in a way your mother likes it.

grep "^10.0.0.1" tcpscan1.ts | awk '{print $3$2}' | cut -c2- - | sed 's/)/|(/' > ,
for I in `cat ,`; do echo "$I/tcp)"; done | sed 's/|/ /'


More bits of useful scripting relate format modifiers and one-liners for sun. Talking of sun here's a blueprints guide

Tuesday, 27 October 2009

Random Musings - Day #300

I was looking at the weather map and noticed how close Scotland is to Northern Ireland. On closer inspection, it doesn't appear as close as it is from Dover to Calais but apparently you can get from Larne (N.I.) to Cairnryan (Scotland) in an hour by ferry!

McDonalds have pulled out of Iceland. You can work out on your own what the story is about. ;)

It's all about the cut. Once again, computerhope have a good guide.
Actually I am trying to split, mix'n'match fields delimited from a csv file. There's a bunch of useful linux and unix commands at laynetworks and one must get up to speed in using the powerful but tempermental awk.

Thursday, 27 August 2009

Random Musings - Day #239

More one-liners
No, this is not comedy but there are so many ways to kill a dead donkey. All these one-liners do the exact same thing and that's add a tab and 'Y' at the end of each line in a file...

for I in `cat t.txt`; do echo -e "$I\tY"; done

for I in `cat t.txt`; do printf "%s\tY\n" $I ; done

cat t.txt | xargs -i echo -e "{}\tY"


I prefer using the for construct in shell, as I can remember that and you can find a way of doing things with it. That's just a personal preference. Here's another example, generating IP address on-the-fly and look the dns name up.

for I in $(seq 255); do host 192.168.0.$I; done

Wednesday, 26 August 2009

Random Musings - Day #238

I watching skins tonight and heard the old bronski beat song, "Small town boy". The acoustic version played is by Andre Herman Dune. I think it's an adequate cover but I don't think you can go wrong with the song. If I sung it, it probably sound good too...

Songs on my mind,
Corporation of One's original version of "The Real Life".
The mashup of "You rock my world" and "Rock your body".
The space cowboy mix of discostick song by Lady Gaga.
The Legend of Zelda sounds of Unicorn Kid with "Wee monster".

Fancy ways to...
Remove last character from a string and merge lines. This led to the following one-liner!

grep "172.16.0.1" auth-sel-1.txt | grep "MS0" - | awk '{print $2}' | uniq | sort | rev | cut -b 2- - | rev

grep "172.16.1.4" auth-sel-1.txt | grep "MS0" - | awk '{print $2}' | uniq | sort | sed 's/:/,/g' - | tr -d '\n'


Scuba is evidently not only used diving but for Oracle databases

Sunday, 15 March 2009

Random Musings - Day #73

Confidence Trickster
There has been a spate of mobile insurance frauds. About 10 companies have been involved cold-calling punters selling mobile insurance. The trick is that the fraudsters have bought new mobile phones and dial up numbers similar to their own. Chances the number are new. So they claim they are the mobile operator or from the shop they bought the phone, offering cheap insurance.
Always be careful when you get cold calls and cold emails. Don't give out details. In fact, ask to phone back!

Dating Review
Stumbled upon this dating agency review.

Shell Tidbit
Here's a nice little tutorial that I found for generating numbers from a for-loop in a unix shell.

Windows Tidbits
1. The old IIS unicode exploit!
2. How to restrict access to the registry from a remote computer.
3. How to prevent Windows from storing a LAN manager hash of your password in Active Directory and local SAM databases.