the_silver_searcher: Intergalactic searcher smackdown

Uh-oh. I can already sense some friction between the_silver_searcher and ack, which you might remember as a sort of replacement for grep.

2014-10-30-6m47421-ag-ack 2014-10-30-6m47421-ag-ag 2014-10-30-6m47421-ag-grep

Left-to-right, ack, the_silver_searcher and grep. Please pay attention to the results of time.

Because it seems to me that both the_silver_searcher (which I will henceforth abbreviate by its executable ag, because that name is a little cumbersome to type) and ack pound their chests on their home pages, and suggest they are faster than grep. And ag definitely holds itself out as faster than ack. And I could swear ack claimed a speed difference over grep.

And yet in subsequent tests, I get results a lot like this …

grep ack ag
time … “Time” list.txt real 0m0.025s
user 0m0.010s
sys 0m0.003s
real 0m0.387s
user 0m0.280s
sys 0m0.010s
real 0m0.051s
user 0m0.017s
sys 0m0.007s

And grep is regularly faster than ack or ag. Q.E.D. :\

For the record, list.txt is a 75K list of television and movie titles that I scraped off the Internet just for this searching smackdown. No funky characters or encoding issues that I could see, and nothing but simple ASCII characters.

Maybe it’s my imagination and none of these programs attempted to be faster than another. And it’s important to remember that my tests are particularly gummy. I have an unnatural knack for screwing up some of the simplest setups, and an unscientific, unprofessional, unstatistical freestyle search-to-the-death would be no exception.

All that aside, ag strikes me as every bit as useful or friendly as ack, and seems to follow a lot of the same flag and output conventions. In fact, some of them appear identical. :???:

I suppose that means your choice of search tools will depend mostly on … your choice. In the mean time I’m going to turn up the heat on all three of these and check their results when I turn them loose on time {grep,ack,ag} main /lib/:shock: That will separate the men from the boys. :evil:

P.S.: Thanks to riptor for the tip. ;)

dradio: Not to be blamed

I got a tip about dradio from a frequent contributor who prefers anonymity. If I could coach people on how to make a decent text-based interface, dradio would be a good place to start.

2014-10-30-6m47421-dradio

Simple arrow keys to select a station, and enter to cue it. Super-big logo. There are playback controls visible in a pop-up help box, and one or two at the command line. Clean and simple.

dradio is a frontend to mplayer and is more or less hard-wired to connect only with Danmarks Radio. Which leads me into the only problem I had with dradio: No audio (or for that matter, video) output. Checking the log shows the corresponding address connecting and resolving, but after that … nothing.

I don’t fault dradio for that, since force-feeding mplayer with the same addresses that are available from dradio’s configuration files yields an identical amount of nothing.

So either the links are wrong, or have moved, or are disallowed on geographic bounds (I am not in Denmark right now). In any case, it appears the fault is not in its stars, and dradio is doing as much as it can to bring music to my ears.

It’s a shame that dradio apparently isn’t open to other radio stations though; I suppose I could try to trick it into opening, for example, a stream from soma.fm (because I’m sure it works) by writing it into the configuration files. But otherwise I think dradio is a one-band man.

If you have any clues for me, on how to prod dradio into action, please let me know, I can always do with a little audio entertainment. ;)

slap: Intuitive and colorful

I got a note a little less than a month ago from pouet, pointing out a text editor called slap. pouet said I might like it, if I wasn’t fond of bizarre double-control-key command sequences or arcane letter combinations for controls.

2014-10-29-6m47421-slap-01

It certainly grabs your eye. And considering its default keystrokes are enough to get me working without traumatic tutorials or A3-sized posters of cryptic letter combinations, it has already won points from me.

slap (I’m not sure about the evolution of the name) also does me the favor of having a simple file browser on the left side of the screen, and the open file command (CTRL+O by default, hallelujah) jumps the cursor across the divider bar and allows me to select.

That I really like. I tried NERD Tree as an extension to vim once, a long time ago, but it wasn’t nearly as fluid and obvious as slap’s simple browser.

slap also does some fundamental syntax highlighting, has customizable behavior via a .slaprc file, and will give you a pop-up help screen if you need it. Most of the keypresses you probably know already though — even things like “jump to the end of the document” are present as CTRL+End, and “select back one letter” as SHIFT+Left Arrow.

Best of all, highlight something and start typing, and slap eats up whatever you highlighted, and begins your new text exactly where you left it. Just like a real word processor. ;)

I understand from the home page that mouse support is also a big feature, although I don’t know if I would use it much. I keep to the keyboard when I can.

The only thing I can think of to “complain” about is that the file selector might be a little cumbersome if you have to work through trees of documents. I looked, but I don’t see a way to bring up a path entry dialogue, or some other vehicle for typing out “/usr/share/kbd/keymaps/i386/qwerty/”, other than browsing up and down through the dozen directories. That’s a fairly minor complaint though. slap is good stuff, and definitely has a grip on decent editor behavior.

So the next time you curse vim because you can’t figure out how to delete from the current position to the end of the next occurrence of the “n” character (d then slash then n, by the way), or can’t figure out how to get out of emacs (CTRL+X or something … I forget), remember slap, and the other thousand-plus text editors that don’t need to brainwash you to get the job done. ;)

P.S.: Not in Arch or Debian. I installed it by installing nodejs in Arch, and then using sudo npm -g slap … just so you know. ;)

bashmarks: The simple solution

We’ve been through plenty of fast-directory switchers, like j and j2, or z or popd and pushd, and a lot of others (and there are still more to come :roll: ). But I don’t recall seeing something like bashmarks before, which lets you give a nickname to your path, and recall it in the future.

bashmarks works as a shell script you can either trigger through your .bashrc file, or source directly as you need it. The git package offers to “install” it to .local/bin, but I found it just as usable in its raw form, sourced with . bashmarks/bashmarks.sh whenever I felt I wanted it.

Once you’re hooked in, bashmarks gives you about five commands, all single letters that trigger or control nicknames to folders in your system: “s” saves a path, “g” goes to a path, “l” lists the bookmarks, “d” deletes one and “p” prints the path held in a bookmark.

And basically, that’s all.

kmandla@6m47421: /usr/src/nvidia-96.43.23$ l
downloads            /home/kmandla/downloads
home                 /home/kmandla
nvidia               /usr/src/nvidia-96.43.23

kmandla@6m47421: /usr/src/nvidia-96.43.23$ g home

kmandla@6m47421: ~$ g nvidia

kmandla@6m47421: /usr/src/nvidia-96.43.23$

bashmarks saves its data in ~/.sdirs, and I doubt anyone would complain if you wanted to hand-edit that file, and still move seamlessly around your system.

There are two big reasons I enjoy using this. The first is tab completion with bashmarks, which is such an obvious addition that it would be a huge mistake if it hadn’t been included. The difference between g d[TAB] to get to /home/kmandla/downloads and cd /h[TAB]/k[TAB]/d[TAB] is enough to make bashmarks a useful tool.

The other reason is more philosophical, I suppose: If I was going to create some sort of “fast directory switching” tool, it would probably work like this. It’s the most obvious solution to me.

I’ve seen a lot of other directory switching tools that use stacks or frequency or priorities to try and analyze and predict where I want to go. bashmarks takes the simple path, lets you assign names, and goes where you tell it. And it does that without compiling intricate binaries, background daemons or gnarled dependencies.

It’s even got a tiny bit of color. ;)

And since I’m feeling generous today, and because it does such a bang-up job, I’m going to give out a K.Mandla gold star to bashmarks: :star: Don’t spend it all in one place. ;) Enjoy!

streamripper: Keeping local copies

It’s been a while since I’ve seen an audio stream ripper — in fact, I think the last one was fIcy, way back when this site was just starting up. :|

So here’s streamripper, which does something similar to what fIcy does, but seems a little better prepared for the task.

2014-10-28-6m47421-streamripper

What I remember most about fIcy is that without an -o flag, it would dump its output to the screen, and with an -o flag … it didn’t quite work right.

So seeing streamripper effortlessly pull down a stream, dissect the individual files at their correct start and stop points, nest them in a neat tree of folders, and set aside tracks that are incomplete … well, it’s very pleasant to watch.

streamripper is not new. In fact, it looks like it faded away (I need a better term than that for software that stalls) around 2008. That’s the bad news.

The good news is, I don’t imagine much has really changed in the past six years in the way streaming music is broadcast, or for that matter, how mp3s work. Both technologies are pretty much solid at this point.

So if you can deal with the awful public shame of using six-year-old software, streamripper appears to be a viable option for capturing your favorite online audio. And if you can’t deal with that big a lag in software development … well, you’ve come to the wrong place, bub. :\

shed: A simple hex editor

Is it time for a hex editor? It’s time for a hex editor. Here’s a simple one: shed.

2014-10-28-6m47421-shed

shed takes a different approach to the time-worn display model that has huge blocks hex code on the left, and a semi-readable display on the right. Just about any hex editor, from hexedit to hexdump to hexer, has some variation on that style.

Instead, shed gives you a vertical stream taken from the file, and its corresponding values in hex, decimal, octal and binary to the right. Press p and shed shows a line preview that moves up and down, as you navigate or edit the file.

It’s a nice touch — not necessarily better, but very different.

The shed home page also suggests shed will take up a lot less space in memory, because the “file is not loaded into memory.” I … can’t necessarily corroborate that, since just hexedit, opening the same file, seemed to be about 100Kb lighter than shed, according to ps_mem.py. And aphex was considerably smaller.

Be that as it may, shed also boasts of a pico-esque (nano-esque?) display, which I can vouch for. If you’re one of the enlightened ones who doesn’t subscribe to one side or the other of the age-old editor war, you’ll step right into shed with no difficulty.

But then again, shed is simple enough that everyone should step into it with no difficulty. Bonus points for that, and bonus points for an unusual way of arranging the screen. Bonus points for everybody! :mrgreen:

WiFiScanner: Wonderfully geeky

I know this is foolish, but I love tools that have a lot of glitter and dash, even if I haven’t a single clue how to use them.

WiFiScanner is a program that apparently last saw updates way back in 2008, but still compiled for me in Arch, and with a little prodding, worked well:

2014-10-27-6m47421-wifiscanner

The trick for me was to use the -C flag to specify the driver for my card, and to make sure the terminal was large enough. WiFiScanner wants plenty of space. :roll:

But I’m willing to coddle it this time, because the results were wonderfully geeky. Lots of flashing numbers, lots of data readouts spinning past in a blaze, little animated graphs, tons of statistics all ticking upward more and more. …

Of course, I haven’t a clue what it all means, but it’s great fun to watch.

I shouldn’t act so naive; I can read enough from the home page to know that WiFiScanner is a tool for … ahem, testing the security of wireless networks, and perhaps if I was more of a security geek, I’d know exactly what to do with all that information.

I can only think of one complaint about WiFiScanner, and that’s because I don’t know enough of how to use it that I might have real suggestions. Here’s my one complaint: The H key shows a help menu, but it’s interspersed with the flow of data in the lower half of the screen. So it zips off the display within seconds. That’s hardly helpful. :(

If you really want to get your hands dirty with WiFiScanner, poke around in the doc folder of the the source package. There are complete instructions on how to build this in Debian and control it once it’s up and running. Provided you know what you’re doing with it, of course.

As it is, I’m just a babe in the woods, enjoying all the flickering lights and thinking how this would freak out the technophobes in my office, and make them think I was some sort of computer genius. :D

Either that, or they’d have me arrested on some made-up hacker charge. :\