Archive for the ‘App-Fu’ Category

App-Fu: VLC Plays Youtube Clips

Thursday, August 12th, 2010

VLC 1.1.x accepts youtube urls in its “Open Network Stream…” dialog.

It’ll opt for the highest resolution available, so if you want to force a less taxing quality, add this to your url.

http://www.youtube.com/watch?v=yadda&fmt=5

This means you can save it to a file without a separate downloader tool/site. And/or you can watch at 2x speed or crank up the volume to 400% with the mouse wheel. Unless you save before watching, it’s subject to buffering, so seeking is best avoided.
 
 
It relies on an external script to scrape the page and fetch the video. That’s what needs fixing when youtube’s site changes.

VLC_Dir\App\vlc\lua\playlist\youtube.lua

Judging from the dir listing, several other sites are understood too.

Sed One-Liner to Mass-Rename

Tuesday, July 20th, 2010

Linux’s perl package has a command called “rename” which understands regular expressions.

Windows lacks that, of course. I’ll recreate it using sed, in a way that’s consistent across platforms…

It won’t spring to mind when you need it (unless you’re really familiar with sed), but the exercise is a decent excuse to demonstrate the oft-neglected hold buffer.
 
(more…)

Peek at Pipes by Copying Stdout to Stderr

Wednesday, May 5th, 2010

I’m stringing commands together and want to see what’s passing through a particular point. Technically tee (Linux/UnixUtils) can do this. Its sole purpose is to duplicate stdout to a file, like a metaphorical “T” connector.

echo hello | tee somefile.txt | sed "s/e/a/"

 
Attentive readers will be thinking,
“The post just started; what’s wrong with it?” :P
 
*clickety-click*… Nothing, this works:

echo hello | tee /dev/stderr | sed "s/e/a/"

 
*drumroll*… on Linux, where everything’s a file.

While many MinGW ports on Windows internally translate the likes of “/dev/stderr”, the UnixUtils tee does not. A hyphen arg obediently makes a file named “-”. Linux guys can keep reading; this trick is nifty.
 
(more…)

App-Fu: Viewing Compressed Traffic in Wireshark

Friday, April 30th, 2010

According to the preferences, the three sections of Wireshark are:

  • Packet List – Rows of src/dest/protocol/info
  • Packet Details – Collapsible tree
  • Packet Bytes – Tabbed hex dumps

Most of the time, if you’re sniffing text-based traffic, you’ll find interesting packets, right-click in the list, and “Follow TCP Stream”. The problem is Wireshark’s too honest sometimes, and if the traffic is compressed, you’ll see the binary garbage that’s really flowing through the NIC.

HTTP/1.1 200 OK
Content-Encoding: gzip

If you see this HTTP header, there’s another approach.
 
(more…)

App-Fu: Commandline 7-zip Sfx

Wednesday, September 2nd, 2009

Hidden feature: 7-zip can create commandline self-extracting archives, for use in batch-fu. The GUI simply lacks a checkbox.

A) Here’s the goofy commandline way.
The -t arg is optional, but it’s a reminder that this is, deep-down, the 7z format.

“…\7-Zip\7z.exe” a -t7z somefile.exe somedir\ -sfx

B) Self-extracting archives are literally archives with an executable header tacked on at the beginning.
You can turn an existing 7z archive into an sfx by concatenating.

copy /b “…\7-Zip\7zCon.sfx” + somefile.7z somefile.exe

Or if you’ve got unixutils…

cat “…\7-Zip\7zCon.sfx” somefile.7z > somefile.exe

C) The third way is a cheat.
Replace the graphical header “…\7-zip\7z.sfx” with a copy of 7zCon.sfx. That way the right-click:”Add to Archive…” dialog will make commandline sfx’s all the time instead.

 

Z) Then copy that exe anywhere and the following will extract to an arbitrary location (-o) silently (-y).

somefile.exe x -o”C:\Somewhere\besides\here\” -y