geoip lookup with curl on geody.com

2010-04-11 1 min read Linux

$ geoip(){curl -s "http://www.geody.com/geoip.php?ip=${1}" | sed '/^IP:/!d;s/<[^>][^>]*>//g' ;}

  • <a href="http://www.commandlinefu.com/commands/view/3835/geoip-lookup">View this command to comment, vote or add to favourites
  • <a href="http://feeds2.feedburner.com/commands/by/twfcc">View all commands by <a href="http://feeds2.feedburner.com/commands/by/twfcc">twfcc

<a href="http://www.commandlinefu.com"><img src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg" alt="commandlinefu.com" align="bottom" />

by David Winterbottom (<a href="http://codeinthehole.com">codeinthehole.com)

<a href="http://feedads.g.doubleclick.net/~a/cceHjCeJpY_mGEm7ufxOyYvznhw/0/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/cceHjCeJpY_mGEm7ufxOyYvznhw/0/di" border="0" alt="" align="bottom" />
<a href="http://feedads.g.doubleclick.net/~a/cceHjCeJpY_mGEm7ufxOyYvznhw/1/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/cceHjCeJpY_mGEm7ufxOyYvznhw/1/di" border="0" alt="" align="bottom" />

<img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~r/Command-line-fu/~4/TiutyTYxoU0" border="0" alt="" width="1" height="1" align="bottom" />

URL: <a href="http://feedproxy.google.com/~r/Command-line-fu/~3/TiutyTYxoU0/geoip-lookup">http://feedproxy.google.com/~r/Command-line-fu/~3/TiutyTYxoU0/geoip-lookup<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://www.killerstartups.com/Web-App-Tools/retwt-me-shortening-links-in-a-new-setting">ReTwt.me – Shortening Links In A New Setting (killerstartups.com) <div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/9044e865-5beb-432f-b243-31d6858ee7a2/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_e21.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related pretty-attribution">

Continue reading

83.233.30.32 is blacklisted.

2010-04-11 1 min read Linux

If you IP is 83.233.30.32 then contact me if you want to access my site in any manner. To check your IP click <a href="http://amit-agarwal.co.in/mystuff/getip_txt.php" target="_blank">here.

Script to get the number of events from the logs.

2010-04-11 2 min read Learning Linux Perl

<a id="aptureLink_4P0PJ73NaG" style="margin: 0pt auto; padding: 0px 6px; text-align: center; display: block;" href="http://en.wikipedia.org/wiki/Log%20analysis"><img style="border: 0px none;" title="Log analysis" src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/ph/360x320_WikipediaArticle" alt="" width="360px" height="320px" />

I was trying to do some <a class="zem_slink freebase/en/log_analysis" title="Log analysis" rel="wikipedia" href="http://en.wikipedia.org/wiki/Log_analysis">log analysis and finding the events in the logs. For this the logs had the Events logged as &#8221;|+Event name|&#8221; or with sending and receiving. So I wrote this little script to take care of my requirements.

Continue reading

Advanced Sed Substitution Examples

2010-04-11 1 min read Bash Linux

This article is part of the on-going Unix Sed Tips and Tricks series. In our previous sed articles we learned — sed printing, sed deletion, sed substitute , sed file write, and sed multiple commands. In this article, let us review some interesting workarounds with the “s” substitute command in sed with several practical examples. I. […]

Read More: <a href="http://www.thegeekstuff.com/2009/10/unix-sed-tutorial-advanced-sed-substitution-examples/">Unix Sed Tutorial: Advanced Sed Substitution Examples

URL: <a href="http://feedproxy.google.com/~r/TheGeekStuff/~3/uN-cE6UOvfA/">http://feedproxy.google.com/~r/TheGeekStuff/~3/uN-cE6UOvfA/<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://www.slumpedoverkeyboarddead.com/2009/08/06/vim-video-tutorial/">VIM video tutorial (slumpedoverkeyboarddead.com) <li class="zemanta-article-ul-li"><a href="http://www.slumpedoverkeyboarddead.com/2009/08/22/turn-vim-or-emacs-into-and-ide-with-exuberant-ctags/">Turn Vim or Emacs Into and IDE With Exuberant-Ctags (slumpedoverkeyboarddead.com) <div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/0d68ebaf-6fc5-419a-a31c-7d31bc55ab3f/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_e8.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related pretty-attribution">

Continue reading

PuTTY export client display on login for opening X application and terminal.

2010-04-11 1 min read Bash Linux

export DISPLAY=$(echo $SSH_CLIENT |awk '{print $1&#8221;:0.0&#8221;}&#8217;)

Explanation:

SSH_CLIENT contains the IP and the port of the client machine. So we need to export (Client IP):0.0 for the display on the client machine. If the above is put in .bashrc or .bash_profile or .profile, then the DISPLAY variable will be set based on the client machine.

Linux Links — collection of universe.. all links on everything about linux

2010-04-11 1 min read Fedora Firefox Linux

<a href="http://loll.sourceforge.net/linux/links/">LoLL is a sourceforge project which maintains a well commented and categorized list of links on linux. This is a very nice list and has very nice links. Probably there is nothing that you will not find here which do not interest you. Definately worth a look.

log analysis with perl and wireshark decode.

2010-04-11 1 min read Linux

Here is something that I had to do in couple of hours to check the logs. The problem was the log file was printing the Received and Sent message in the hex format. I had to verify if the messages were correct. So here is how to do it.

open(FP, &#8221;<$ARGV[0]&#8221;)|| die &#8221;File $ARGV[0] does not exist&#8221;;
while ($line = )
{

if ($line =~ /(Received :)|(Sending :)/)

{

@words = split(/\|/, $words[4]);
$received = $words[1];

Continue reading
Older posts Newer posts