Wednesday, March 31, 2010

Dummy Credit Card Numbers for Testing

Here is a list of dummy credit card number that can be used while testing your applications involving credit card transactions:

Visa: 4111-1111-1111-1111
verification number is 121

MasterCard: 5431-1111-1111-1111

Amex: 341-1111-1111-1111

Discover: 6011-6011-6011-6611

Credit Card Prefix Numbers:

Visa: 13 or 16 numbers starting with 4

MasterCard: 16 numbers starting with 5

Discover: 16 numbers starting with 6011

AMEX: 15 numbers starting with 34 or 37

in reference to: Dummy Credit Card Numbers for Testing (view on Google Sidewiki)

Tuesday, March 30, 2010

How To Optimize Your Site With GZIP Compression

Compression is a simple, effective way to save bandwidth and speed up your site. I hesitated when recommending gzip compression when speeding up your javascript because of problems in older browsers.

But it’s 2007. Most of my traffic comes from modern browsers, and quite frankly, most of my users are fairly tech-savvy. I don’t want to slow everyone else down because somebody is chugging along on IE 4.0 on Windows 95. Google and Yahoo use gzip compression. A modern browser is needed to enjoy modern web content and modern web speed — so gzip encoding it is. Here’s how to set it up.
Wait, wait, wait: Why are we doing this?

Before we start I should explain what content encoding is. When you request a file like http://www.yahoo.com/index.html, your browser talks to a web server.

in reference to:

"How To Optimize Your Site With GZIP Compression"
- How To Optimize Your Site With GZIP Compression | BetterExplained (view on Google Sidewiki)

Wednesday, March 24, 2010

Mitch's list of really incredibly useful commands...

This thread is simply a list of commands that I use from time to time, which are really useful, but long enough that I won't remember them when I need them.

Please note: for the rename examples below to work, you must be using the Perl version of rename, such as the one included in Debian (and derivative) distributions. The Redhat Enterprise Linux version of rename is different and is almost useless.

Rename files to add leading zeros (in this case followed by a letter)
Code:
$rename -nv 's/^([1-9])([a-z])/0$1$2/' /mydir/*

note: remove the 'n' argument to actually change the filenames.

in reference to:

"This thread is simply a list of commands that I use from time to time, which are really useful, but long enough that I won't remember them when I need them.Please note: for the rename examples below to work, you must be using the Perl version of rename, such as the one included in Debian (and derivative) distributions. The Redhat Enterprise Linux version of rename is different and is almost useless.Rename files to add leading zeros (in this case followed by a letter)"
- Ithaca Free Software GNU Linux • View topic - Mitch's list of really incredibly useful commands... (view on Google Sidewiki)

A tabular summary of the regular expression (regexp) syntax in Perl with a collection of annotated examples.

Regular expressions in Perl

This document presents a tabular summary of the regular expression (regexp) syntax in Perl, then illustrates it with a collection of annotated examples.

in reference to:

"Regular expressions in Perl This document presents a tabular summary of the regular expression (regexp) syntax in Perl, then illustrates it with a collection of annotated examples."
- Regular expressions in Perl - a summary with examples (view on Google Sidewiki)

perlre, Perl Regular Expressions

NAME

perlre - Perl regular expressions

DESCRIPTION

This page describes the syntax of regular expressions in Perl. For a description of how to use regular expressions in matching operations, plus various examples of the same, see discussion of m//, s///, qr// and ?? in Regexp Quote-Like Operators.

The matching operations can have various modifiers. The modifiers that relate to the interpretation of the regular expression inside are listed below. For the modifiers that alter the way a regular expression is used by Perl, see Regexp Quote-Like Operators and Gory details of parsing quoted constructs.

in reference to:

"NAME perlre - Perl regular expressions DESCRIPTION This page describes the syntax of regular expressions in Perl. For a description of how to use regular expressions in matching operations, plus various examples of the same, see discussion of m//, s///, qr// and ?? in Regexp Quote-Like Operators. The matching operations can have various modifiers. The modifiers that relate to the interpretation of the regular expression inside are listed below."
- perlre - Perl regular expressions (view on Google Sidewiki)

Saturday, February 6, 2010

How to recursively go through all local or remote directories

Taken From: http://www.cyberciti.biz/tips/linux-recurse-through-local-remote-directories.html

You can use find command or recursdir command to recurse through local or remote directories to command/find files or create tar files.

recursdir command pass a C script to recursively perform operations on files. recursdir is an excellent tool for automatic stuff. It provides C style programming functions and statements such as:

* strncmp()
* exec()
* system()
* strstr()
* strcat()
* printf()
* popen()
* if ( expr ) { take-action }
* if ( expr ) { take-action } else { do-something-else; }
* /* comments */
* Detecting file types and macros
* All of the logical, arithmetic and bitwise C operators are supported. These are ( ) >= <= > < != == && || ! - + * / % & ^ and have the same meanings and precedences as in C. etc.

Install recursdir

recursdir is part of mirrordir package:
$ sudo apt-get install mirrordir
Recursively find file and take action

For example find out all *.bak file and delete them, using find command:
find /path/to/dir -iname "*bak" -exec rm {} \;
Following is a fast and overkill equivalent of find, using recursdir :
recursdir /path/to/dir -C 'exec("/bin/rm","-f",PATH);'

Find and print out all the *.CPP (C++) files on your system, enter (note usage of if and printf() C like syntax):
recursdir /path/to/dir -C 'if (!glob ("*.cpp", FILE)) printf ("%s\n", PATH);'
or
find /path/to/dir -iname "*.cpp"
Backup a remote ftp site to local tape:

This is my favorite command to mirror remote ftp tree:
recursdir ftp://user-name@ftp.server.nixcraft.in/ --tar-file /dev/mt
Write complex directory manipulation scripts

You can write complex scripts using recursdir. For example, following will removes all core files from your Linux 32 bit system:

recursdir / -C '
long l;
/* look for /proc */
if (strncmp (PATH, "/proc", 5)) {
if (S_ISREG (stat.st_mode) && !strcmp ("core", FILE)) {
if (strstr (popen ("file " + PATH), "ELF 32-bit LSB core")) {
l = l + stat.st_size;
printf ("removing: %s, cumu. total = %ldkB\n", PATH, l >> 10);
exec ("rm", "-f", PATH);
}
}
}'

recursdir offers many more advanced options such as encryption, backups compression and many more, please refer the man page for more information.

in reference to:

"How to recursively go through all local or remote directories"
- How to recursively go through all local or remote directories (view on Google Sidewiki)