In this example, file contains five columns where first column is text. Variance is calculated for columns 2 - 5 by using perl module Statistics::Descriptive. There are many more statistical functions available in the module. Show Sample Output
Of course you will have to install Digest::SHA and perl before this will work :) Maximum length is 43 for SHA256. If you need more, use SHA512 or the hexadecimal form: sha256_hex() Show Sample Output
Finds all *.p[ml]-files and runs a perl -c on them, checking whether Perl thinks they are syntactically correct Show Sample Output
TIMTOWTDI
On-the-fly conversion of Unix Time to human-readable in Squid's access.log Show Sample Output
This includes a title attribute so you can see the file name by hovering over an image. Also will hoover up any image format - jpg, gif and png.
Full Command:
google contacts list name,name,email|perl -pne 's%^((?!N\/A)(.+?)),((?!N\/A)(.+?)),([a-z0-9\._-]+\@([a-z0-9][a-z0-9-]*[a-z0-9]\.)+([a-z]+\.)?([a-z]+))%${1}:${3} <${5}>%imx'|grep -oP '^((?!N\/A)(.+?)) <[a-z0-9\._-]+\@([a-z0-9][a-z0-9-]*[a-z0-9]\.)+([a-z]+\.)?([a-z]+)>' | sort
You'll need googlecl and python-gdata. First setup google cl via:
google
Then give your PC access
google contacts list name,email
Then do the command, save it or use this one to dump it in the cone-address.txt file in your home dir:
google contacts list name,name,email | perl -p -n -e 's%^((?!N\/A)(.+?)),((?!N\/A)(.+?)),([a-z0-9\._-]+\@([a-z0-9][a-z0-9-]*[a-z0-9]\.)+([a-z]+\.)?([a-z]+))%${1}:${3} <${5}>%imx' | grep -o -P '^((?!N\/A)(.+?)) <[a-z0-9\._-]+\@([a-z0-9][a-z0-9-]*[a-z0-9]\.)+([a-z]+\.)?([a-z]+)>' | sort > ~/cone-adress.txt
Then import into cone.
It filters out multiple emails, and contacts with no email that have N/A. (Picasa photo persons without email for example...)
Show Sample Output
Here's a version that uses perl. If you'd like a trailing newline:
perl -pe 's/(.)/sprintf("\\x%x", ord($1))/eg; END {print "\n"}'
usefull for posts via wget Show Sample Output
This deals nicely with filenames containing special characters and can deal with more files than can fit on a commandline. It also avoids spawning du. Show Sample Output
Today I needed a way to print various character classes to use as input for a program I was writing. Also a nice way to visualize character classes. Show Sample Output
In this way it doesn't have problems with filenames with spaces.
Not really better - just different ;) There's probably a really simple solution out there somewhere... Show Sample Output
Nobody wants the boss to notice when you're slacking off. This will fill your shell with random data, parts of it highlighted. Note that 'highlight' is the Perl module App::highlight, not "a universal sourcecode to formatted text converter." You'll also need Term::ANSIColor. Show Sample Output
There are some environments that use this value for password and account expiration. It's helpful to be able to quickly determine the number of days since the Unix epoch (dse) when working directly with the configuration files as an administrator. Show Sample Output
This uses Text::Highlight to output the specified Perl file with syntax highlighting. A better alternative is my App::perlhl - find it on the CPAN: http://p3rl.org/App::perlhl
This works by reading in two lines of input, turning each into a list of one-character matches that are sorted and compared.
Ever wanted to get the directory content with 'ls' or 'find' and had to wait minutes until something was printed? Perl to the rescue. The one-liner above(redirected to a file) took less than five seconds to run in a directory with more man 2 million files. One can adapt it to e.g. delete files that match a certain pattern. Show Sample Output
Please note that binary file checking is NOT perfect. So, use it with caution. It does not delete hidden files whose name has a leading '.' character. And it regards an empty file as a binary file.
This is from perldoc -q random.*line, which says: This has a significant advantage in space over reading the whole file in. You can find a proof of this method in The Art of Computer Programming, Volume 2, Section 3.4.2, by Donald E. Knuth. Who am I to argue with Don Knuth?
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: