Nerdabout: the art and craft of technology

Hacking

Simple Scraping With Lynx

November 24, 2009

A scraper is simply an automated Web browser.

By automated, we mean that a scraper can be driven either by you directly (usually via the command line) or by a script (or batch file). Scraping at its most basic, is simply the act of running a program that automatically retrieves information from a remote Web page or Web service.

If we accept that simple definition of scraping, then the very simplest of all scrapers, is Lynx.

Canada Lynx (Lynx canadensis)

Continue reading >

How To Install the W3 CSS Validator

November 23, 2009

Did you know that you can install the same CSS validation tool on your local machine? Follow the simple instructions below, to set yourself up to run the W3 CSS validator from the command line!

CSS Validation on the Command Line

Web developers are all familiar with the W3's CSS validation service.

CSS validation is an essential part of developing a Web interface. The same goes for XHTML validation and running JavaScript through JSLint.

Continue reading >

How To Use Lynx to Quickly List All the URLs On A Web Page

November 17, 2009

When used with the --dump option, Lynx parses an HTML document and builds a list of hyperlinks in that document.

If you have tried either of our previous Lynx recipes, then you may have noticed that, in addition to parsing out the textual content from Web pages. Lynx prints all of the URLs referenced in a document, as a numbered list at the bottom of the output.

how to use Lynx to list all the URLs in
an HTML page

Continue reading >

Lynx As A Simple (but Fast!) HTML Parser

November 10, 2009

There are numerous useful things that can be done with Lynx. For instance, you can quickly scrape a weather report for any US zip code.

Another little-known use for Lynx, is to preview HTML documents.

howto preview HTML from Maruku, using
Lynx

Continue reading >

Using Lynx to Scrape a Weather Report

November 03, 2009

Lynx As A Simple HTML Parser

One great and often-overlooked feature of Lynx is its --dump option.

lynx --dump <url> dumps the text content of the Web page at URL, followed by a numbered list of URLs that were referenced in that page.

how to use Lynx to scrape a weather forecast

Continue reading >

Python's SimpleHTTPServer: the World's Smallest Web Server?

October 27, 2009

When last we posted about tiny Web servers built with Ruby, Face-book friend Michael Cottingham immediately protested that Gary Robinson has blogged about a Python Web server that is in fact even smaller.

And the Python version seems to be more featureful than the Ruby version as well. For instance it is a bit more secure (and much more intuitive), in that "server root" defaults to the directory where SimpleHTTPServer was invoked. By contrast, the Ruby version blindly serves up everything in the root of the drive where it was invoked.

The internet is not a big truck

Continue reading >

Solution to the Perl Puzzler: by Aram

October 20, 2009

w00t!!1! Major congratulations to aram, who deciphered our very first code puzzler!

cksum file1 file_n | perl -ane 'warn if $F[0] != ($x ||= $F[0])'

Aram explained the convoluted code above as follows:

> Just a guess, it looks like it does a comparison of 2 files. 
> The chksum file file2 calculates and outputs the checksum which is 
> piped into a perl program.
> perl -a auto splits the output from checksum and puts it into array $F, 
> so F$[0] is the first element.
> the perl -n loops through all the piped input.
> $F[0] is the checksum of one file.
> $F[0] != ($x ||= $F[0]
> is true if $f[0] is not equal to $x or $F[0]. 
> it seems $x is set to $F[0] if not equal

Awesome, Aaram. Comparing the checksum of two files is exactly what this little one-liner is meant to do.

Hey Aram -- DM us on Twitter and let us know how we can get in touch with you! We'd like to send you a Nerdabout laptop sticker.

Pimp mah Laptop

Continue reading >

Set Up Passwordless SSH Login on Windows with Cygwin and SSH-Keygen

October 13, 2009

Here is how to set up passwordless login for SSH access to a remote server (including SVN over SSH) on Windows.

im in ur fiirwalz watchin ur pakkitz (by Andy Cunningham)

Getting this right has sadly eluded us for some time, even though the internets contain some really good articles on how passwordless login works as well as step-by-step instructions on how to set up passwordless login.

Still, putting it all together, on Windows, we found a bit tricky. But we've finally banged our heads up against a solution.

Continue reading >

Dorkbot-NYC Wins Again

October 09, 2009

By Joanna Burgess

This past Wednesday night was the 2nd Dorkbot-NYC of the season at Location One in Soho. The theme of the evening was the interaction between humans and technology.

Asteroid Girl 2

Continue reading >

The Magic of GNU Readline: Emacs' Commands Without Emacs

October 06, 2009

Take advantage of the convenience of Emacs keyboard commands, even if you aren't using Emacs. It turns out that quite a few pieces of software support the basic Emacs text-editing command set. All this is made possible of the GNU Readline library.

gnu emacs

There's a complete list of keyboard navigation commands in the Readline documentation. Or if you prefer, there is the bash/Readline cheatsheet :-;)

If you aren't already, you'll want to familiarize yourself with the the basic Emacs text-editing command set before trying these out.

Environments where you can use the Emacs keyboard shortcuts, that aren't Emacs

Mac OS X

Firefox, Safari and many other Mac OS X applications.

The IRB

The Ruby's use Emacs commands in the IRB interactive shell.

bash

The bash shell for Linux, BSD Unix and Mac OS X.

Cygwin

Cygwin, the Unix terminal emulator for Windows, runs bash and so supports Emacs keyboard navigation shortcuts

Cygwin (the Linux emulator for Windows): Emacs' Commands Without Emacs, part 4

September 29, 2009

When I wrote about bash support for the basic Emacs text-editing command set, I should have mentioned Cygwin, the bash emulator for Windows. Cygwin ships with a Linux terminal emulator, that runs bash and so supports Emacs keyboard navigation shortcuts.

Kill Bill
photo: wili_hybrid

If you haven't, try it. Especially if you are a Windows user and haven't tried they GNU/Linux tools yet.

Cygwin can change your life by enabling you to do things that you generally just can't do on Windows, at least not out-of-the box.

It's so awesome to have a free tool that will let you, for instance, search for files on your hard drive by name and by content, at the same time. And it's free. I'm consistently surprised by the preponderance of ten-to-fifty-dollar shareware programs, whose functionality can be duplicated with a 5 or 10 line shell script, and perhaps a little Perl.

Twyric: A Twitter Flickr Mashup

September 28, 2009

By Joanna Burgess

I'm always looking for new mashups and was quite happy to discover Twyric via digg. When I first started to use Twitter, I tried to write only in haiku. That fell by the wayside for a bit but I'm working on picking it back up which is why Twyric--with its minimalistic approach--is so appealing to me.

With the assistance of Twitter's real time search, Twyric collects tweets that include the hashtags #haiku, #twyric, #twly, #gedicht, #poesie, #lyric, #poetry, #limerick, #poetic and #poem. Keywords are parsed out and using the Flickr API, an image is matched up with the tweet. I've seen the same poems fade in and out. Sometimes the image paired with the poem remains the same, other times it changes.

I did my first haiku this morning and it took about 1/2 hour to be on Twyric. Two things I learned: 1) reread tweets for typos and word repeats (as you can see I make many in the morning) 2) don't put a title (in this case "Tea") before your hashtag otherwise it appears in your haiku (minus the hashtag because that's removed).

tea

How To Run the World's Smallest Web Server: one line of Ruby!

September 22, 2009

In 2008, Michael Neumann published a Ruby one-liner that leverages the power of Ruby's standard RSocket::TCPServer library, to start up a fully functional HTTP server; in just a single line of Ruby.

ruby -rsocket -e's=TCPServer.new(5**5);loop{_=s.accept;_<<"HTTP/1.0 \
200 OK\r\n\r\n#{File.read(_.gets.split[1])rescue nil}";_.close}'

teh internets-truck version03

cartoon: goopymart

Although there's no fancy stuff like 404 pages or redirects, you'll find that all the basic HTTP transactions work (eg you can follow links to other documents).

Once started, the server's root directory is the root of your local filesystem.

Continue reading >

Hackers and Prankers: from the Archives

September 21, 2009

Relatively speaking, there are few things more satisfying than a good hack. Hacking pranks prove useful year round. We dug back through our archives and picked out a few of our favorites.

Why the chicken crossed the road...

  1. Useful, but Overlooked, Shell Commands
  2. Spiff Talks About Code Monkey and WOW Machinima
  3. Pranks From Our Readers
  4. Google Map Mashup: Ohio is a Piano
  5. A Talk With Artist And Educator Kate Hartman
  6. The Diaper Prank
  7. DIY Wii-mote
  8. Remote Control Jammer Pranking
  9. The Mysterious Lightbulb Prank
  10. The Calculator Prank

bash: use Emacs' Commands Without Emacs, part 3

September 15, 2009

GNU Linux's bash shell supports the Emacs command set out of the box. Like IRB as well as many Mac OS X applications, you can navigate your way around the Bourne-Again SHell.

This is because Bash takes advantage of a library called GNU Readline

Here is a Readline Cheatsheet. Bash Emacs Editing Mode (readline) Cheat Sheet

As you can see, there are tons of features potentially available. That's because bash is a really large, featureful tool. You can work in bash for 10 or 20 years, and still find interesting things to learn, and find out about things you didn't know you could do.

Of course, many people are more interested in just getting some work done. In that case just stick to the the basic Emacs text-editing command set and you'll likely find that just mitigating your need to take your fingers off the home keys, can be a big boost to your productivity.

Use Emacs' Commands in the IRB

September 08, 2009

Ruby's interactive debugger, the IRB is a friendly and helpful shell environment for experimenting with and learning about Ruby.

Why's (Poignant) Guide to Ruby Cartoon: _why

The IRB has many nice features, not least of which is support for Emacs-style editing and keyboard navigation.

Not only is the basic Emacs text-editing command set supported, but the IRB also supports

selecting text with
C-SPC
or transposing characters with
C-t
as well as many other Emacsian keyboard shortcuts.

i.rb: the Interactive RuBy shell

September 01, 2009

By Noah Sussman

If you haven't yet checked out the IRB, it's like a Firebug JavaScript console for Ruby.

The Tiger's Vest by _why

That is, the IRB is a Read-Eval-Print loop where you can write arbitrary code and watch it smash into things ;-) Load up modules or Gems and try out new tools on the fly.

Reverse-engineering Ruby code is easy with the IRB

Everything in Ruby is a first-class object (even "primitives" like numbers and characters) and all objects have the handy inspect method, or even better the methods method, for on-the-fly code composition and of course, debugging.

And if you prefer hard-core stringification when perusing the internals of your objects, like Perl's Data::Dumper, you can get that simply by calling the to_yaml method of any object (tip o' the keyboard to Roberto Saccon in comp.lang.ruby.rails for that one).

Although @wschenk originally introduced us to the IRB, we only got comfortable with it after reading The Tiger's Vest, a really good introductory tutorial (with cartoons) on hacking in the IRB.

Tip: If you have trouble starting the IRB on Windows

If you're on Windows and using Cygwin, then you may need to put the following code in a batch file called irb.bat, somewhere in your system path:


    @echo off
    ruby c:\cygwin\bin\irb
  

One-Line Perl Puzzler

August 31, 2009

cksum file1 file_n | perl -ane 'warn if $F[0] != ($x ||= $F[0])'

Continue reading >

Mac OS X: use Emacs' commands outside of Emacs, part 1

August 27, 2009

By Noah Sussman

Did you know you can take advantage of the convenience of Emacs keyboard commands, even if you aren't using Emacs? We've discovered that that quite a few pieces of software support the basic Emacs text-editing command set out of the box.

Chipi and the GNUphoto:Berto Garcia

the basic Emacs text-editing command set works in many environments throughout OS X. For example, you can press Control-e to jump to the end of a line in TextEdit.

Or use C-a (that's Control + A) to jump to the beginning of the URL bar in Safari. Then use C-k to clear the URL bar. You can even use C-y to paste the URL anywhere within Safari or Firefox.

Do take note though, that OS X's Emacs cut-and-paste commands use a special, application-specific clipboard. What's copied in Firefox, stays in Firefox.

Sadly, for cross-application copy and pasting on Mac you're still stuck with the old, familiar CUA bindings

Ohio is a Piano: An Audio Data Visualization

August 18, 2009

By Joanna Burgess

Once again I am entertaining myself with Google Maps Mania while drinking my tea. This morning's awesomeness? Ohio is a Piano, created by cartographer Andy Woodruff. He's turned the science of statistics into a musical experiment. Here's what the map does: Ohio has 88 counties, a piano has 88 keys. So basically this is an audio data visualization of the state. Each county represents a piano key and you program the map to play a song by assigning a county a key based upon data like kids under 5, median age, avg sz97 and sqmi (which I read as "sqee me" at this early hour and was briefly baffled until I realized this actually meant square miles).

Click here to begin composing.

ohio_piano

9 Essential Emacs Commands for Beginnners

August 17, 2009

By Noah Sussman

For many hackers, Emacs is one of those mysterious, crufty applications that pops up from time to time but has no real use; a leftover from the bad old days when computers didn't have graphical interfaces and most programs were written with a magnetic needle. And that's understandable because most chance encounters with Emacs occur in an ugly little terminal window with no mouse support.

But in fact Emacs is no relic. It's still widely used and has a living, vibrant community of developers and plugin writers. Modern Emacsen (that's the plural of Emacs) have mouse support, and a plethora of other features besides.

Emacs has a rich (some would say notoriously rich) keyboard command set. That shouldn't be surprising, since it was developed 30 years ago, before computers had mice.

CMU EMACS photo: fhisa

Continue reading >

Bombing the Bowery with Ellis Gallagher

August 12, 2009

By Liz Suman

Only in New York City will you find an international chalk art celebrity's first solo exhibit inside an old hardware store on the Bowery. 

Making good on his word to experiment with light and shadow in different contexts besides the street, Ellis Gallagher's latest show at Collective Hardware, "Ocular Echoism: The Autonomy of Ellis Gallagher," features striking photographs of some of his most beautiful chalk-outlined objects throughout New York City. Curator De L'Autonomy, defines the work through the lens of Plato's Allegory of the Cave, which you can read about here. But what I thought was the most interesting part about the exhibit was how it brought the street indoors, playing around with what goes where in the same way Ellis does by bringing art onto the street with chalk.

In addition to the dozens of photographs lining the walls of the converted hardware store, the exhibit includes a chalk-outlined bicycle hung from the ceiling, a plastic crate outlined in chalk and surrounded by garbage (the planted trash was a bit much), and a lineup of newspaper dispensers covered in tags, standing to attention in the center of the gallery. It is a who's who of graffiti writers in New York at the time of the show's opening and a live (and far more interesting) roll call than the black and white, two-dimensional name-dropping you find on Gawker the day after a big party in NYC. This inanimate roll call combined with Ellis' installations, a handful of candy-colored Claws, and a fire-tag shout out to Dash Snow provide the perfect anthropological icing to Ellis' beautiful photographs.

The exhibit is only up for a couple more days, but you can check out the work below and stay tuned for Ellis' upcoming shows by keeping tabs on his Facebook page.

"Ocular Echoism," Collective Hardware

Hackers and Pranksters: from the Archives

August 10, 2009

This past weekend involved tasting 5 new beers and a pig roast. (For the record only one Nerdabouter in attendance partook in the pig). We caught up with some old friends which got us to thinking that maybe we should pull together some of our favorite posts from the archives. So...for those who may have missed them the first time around and for the rest of you who might want a refresher on Nerdabout's antics, we give you our top 10 posts on hacking and pranking.

Rubber Chicken

photo: Brent and MariLynn

  1. Useful, but Overlooked, Shell Commands
  2. Spiff Talks About Code Monkey and WOW Machinima
  3. Pranks From Our Readers
  4. Google Map Mashup: H1N1 Swine Flu
  5. Kate Hartman Teaches Houseplants to Blog
  6. The Diaper Prank
  7. DIY Wii-mote
  8. Remote Control Jammer Pranking
  9. The Mysterious Lightbulb Prank
  10. The Calculator Prank

Nerdabout's Hydroponic Window Farm

August 06, 2009

By Joanna

I've been running around like a crazy woman gathering the necessary materials for my own hydroponic system and finally...all the running has paid off. Yesterday Britta from Window Farms plus her team--Ted, Lisa and Anja--spent 8 hours in my apartment installing a home version of the window farm at Eyebeam we blogged about back in June. Sadly I bought the wrong pump so my system isn't fully operational but the new one is in the mail. I'll post a full wrap up on Monday when the pump arrives and I've installed it. In the mean time here's a bit of what we did yesterday.

Jonathan Coulton Machinima

July 10, 2009

Dave's post on Jonathan Coulton is pretty popular so we're leaving it at the top of Nerdabout today. A few months back Joanna interviewed Spiffworld who makes World of Warcraft machinima videos using Coulton's songs. Mythbusters Adam Savage says Spiff's video using Coulton's,"The Future Soon" is "maybe the best piece of machinima art evar!" We've got that one and a few others. Click here to see 'em.

The Nerdabout bloggers are (from left to right) Elizabeth Suman, John Son, Heather Quinlan, Joanna Burgess, Noah Sussman and Dave Caputo.
nerdabout group photo

@Nerdabout on Twitter

Please wait while our tweets load…

Or visit the Nerdabout's Twitter.

Advertisement

Nerdabout's TumbleBlog

Currently listening to…

David Caputo is rockin out to…

Noah Sussman listens to…

Nerdabout on Flickr

Joanna Burgess on Flickr


Noah Sussman on Flickr


Dave Caputo on Flickr


Heather Quinlan on Flickr


Elizabeth Suman on Flickr


John Son on Flickr

SITE SEARCH
SUBSCRIBE TO OUR NEWSLETTERS
CREDITS Photos: iStockphoto | Getty Images | AP | Wikipedia | DCL |
DISCOVERY SITES Discovery Channel / TLC / Animal Planet / Discovery Health / Science Channel / Planet Green / Discovery Kids / Military Channel /
Investigation Discovery / HD Theater / Turbo / FitTV / HowStuffWorks / TreeHugger / Petfinder / PetVideo / Discovery Education
SHOP Toys / Games / Telescopes / DVD Sets / Planet Earth DVD Sets / Gift Ideas
CUSTOMER SERVICE Viewer Relations / Free Newsletters / RSS /
CORPORATE Discovery Communications, Inc / Advertising / Careers @ Discovery / Privacy Policy / Visitor Agreement
ATTENTION! We recently updated our privacy policy. The changes are effective as of Tuesday, October 30, 2007. To see the new policy, click here. Questions? See the policy for the contact information.