imgInfo Chrome Extension

June 24, 2010  |  coding, git  |  No Comments

I just published my first Google Chrome extension. I feel it addresses the lack of a feature I deem very important – image information. Get it here.

How to use it? Simply hover an image for the amount of time specified in the options page.

All sources are available on GitHub here and here.

Perl: Mass Domain Checker Script

June 16, 2010  |  coding  |  No Comments

A quick and dirty script to mass check domain names.

#!/usr/bin/perl -w
use strict;
use Socket;
no warnings;

print "checking domains...\n\n";

while(<>)
{
	chomp($_);

	if(rindex($_, ".") == -1)
	{
		$_ = $_.".com";
	};

	eval
	{
		my $address;
		$address = inet_ntoa(inet_aton($_));
		print "not available\t -- $_\n";
	};
	if($@)
	{
		print "available\t -- $_\n";
	};
}

print "\ndone.\n";

Usage:

  • Copy, paste & save the script as domainchecker – make sure you have Perl installed.
  • If you’re on a *NIX platform (Macs included) chmod 770 domainchecker.
  • Save the list of domain you want to check in a separate file, e.g: domains.txt, one domain name per line
  • Run the script: ./domainchecker domains.txt

Valid Email NSString Category

May 27, 2010  |  coding  |  No Comments

A quick NSString addition to check if the string is a valid email address:

@interface NSString (ValidEmailAddition)
-(BOOL) isValidEmail;
@end

@implementation NSString (ValidEmailAddition)
-(BOOL) isValidEmail
{
	NSString *emailRegEx =
		@"(?:[a-z0-9!#$%\\&'*+/=?\\^_`{|}~-]+(?:\\.[a-z0-9!#$%\\&'*+/=?\\^_`{|}"
		@"~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\"
		@"x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-"
		@"z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5"
		@"]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-"
		@"9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21"
		@"-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])";

	NSPredicate *regExPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegEx];
	return [regExPredicate evaluateWithObject:self];
}
@end