Tag Archives: convert

x_x: The Dead Guy CLI

With barely a week left for this site, I’m beginning to trim away programs that I just probably won’t get to, by virtue of time or technical dilemmas. I’m also making a conscious effort to pick out titles that amuse me in one form or another, so I finish with happy memories. πŸ˜›

x_x, which I mentally refer to as “the Dead Guy CLI,” because the home page uses that as a subtitle, is a rather nifty tool that I’m surprised I haven’t seen covered elsewhere. Using a bland, dull, boring Excel spreadsheet borrowed from a corner of the Interweb, Dead Guy CLI transmogrifies it into this:

2015-04-21-6m47421-x_x

Well isn’t that clever.

Dead Guy CLI gives you a small measure of control over your output, by allowing you to specify a header row or allow for special encoding. It also works with CSV files, so you’re not strapped trying to convert back and forth to Excel, just to fiddle with x_x.

Aside from that though, Dead Guy CLI seems very simple. Of course, your spreadsheet may need some management if you expect it to fit into a certain dimension, but I am confident that as a skilled and capable member of the information age, you won’t throw a wobbly over a pear-shaped spreadsheet.

Keep x_x in mind when you’re thinking about things like csv2xls or xlhtml, since it may save you a step or prevent you from relying on graphical tools just to extract data from a spreadsheet. And of course, if you’re working with csv files, x_x could supplement what tabview or other tools can do.

For my own recordkeeping, Dead Guy CLI gets points for doing something obvious that I don’t recall seeing elsewhere. And also for the snarky name. I’m a fan of snarky names. 😈

textprint: Visually impressive, in only 18K

You can get graphing and plotting functions in the console from a variety of sources. textprint is easily my favorite for simple data arrays, mostly because it can do this, with only 18K:

2015-04-16-6m47421-textprint-01 2015-04-16-6m47421-textprint-02 2015-04-16-6m47421-textprint-03

textprint takes a flat data file as input, and arranges it graphically to fit the terminal without distorting the image. From there, textprint goes from zero-to-60, in about two seconds.

Because on top of a rather bland plotting display, you have the option to pick between about four or five different graphs, including the bar and column charts you see above, and a couple others.

And then, you can shift those displays along the x or y axes, zoom the displays and even “print” the display to a text file that matches what you see on the screen. (I did see some corruption when trying to zoom in too “close,” though.)

So you have essentially a tool to convert data arrays into visual representations, adjust them to your liking, then “print” them in their new format. And all that in only 18K.

textprint is not without shortcomings, but truth be told, I could sift through anything and find small nits to pick at. Color options would be nice, and while it does have onboard help, there aren’t any flag options that I can see. If I could send commands to textprint and have it spit out a “printed” file without the interface, textprint would be doubly useful.

And to be honest, the title “textprint” is a slight misnomer. That’s going to get lost in the endless array of pdf converters, ASCII readers and document translators that already pepper the ‘web. It needs a more accurate, and more descriptive title.

It’s still exceptionally impressive though. And the fact that it has so many options in such a small space. And seeing that it’s a dozen years old and still working is noteworthy too.

Not in Arch/AUR or Debian that I could find. textprint is bundled with a precompiled binary, but it’s going to look for an ncurses library that didn’t exist on my Arch system. The command to compile it is in the readme.txt file.

cp437: Turning frogs into handsome princes, since 2013

I got a note from Markus Ulfberg back in December, and his tip was such a cool little program that I’ve been holding it in reserve in hopes of showing it off properly, once I find a application that really really needs it.

The problem is that I haven’t stumbled across anything that desperately deserved its attention. And as it’s been a couple of months since Markus’s e-mail, I’ll just give it the spotlight on its own. Here’s cp437, and what it can do for you.

2015-03-03-6m47421-cp437-bitchx-01 2015-03-03-6m47421-cp437-bitchx-02 2015-03-03-6m47421-cp437-bitchx-03

At left, brand X. At center and right, cp437 with bitchx. And suddenly the glory days of ANSI graphic art have returned. What will you be drinking, sir?

I don’t know all the ins and outs of codepages or why some tools show scrambled glyphs in the terminal or the framebuffer. I’m just a lowly user, accepting life as it appears in front of my blinky-blinky cursor and learning to suffer when things aren’t gorgeous.

But cp437 manages to seamlessly and transparently convert frogs into handsome princes, and I have no better explanation than magic. It’s gotta be the shoes.

I can think of several tools that will probably benefit from cp437’s love — Markus mentions camp and duhdraw as two winners, and I’m sure there are lots more. I daresay there are even some image converter tools that would refine their art with the help of cp437.

So I’ll leave it to you to experiment — and experience — the cp437 goodness. In the mean time, I’m going to wander back through the back catalogue and see if anything suddenly changes from ugly duckling to swan, by sprinkling a little cp437 on it. … :mrgreen:

talkfilters: All that computing power, and this is what you come up with?

After falling flat with yesterday’s attempt at an amusement for the console lifestyle, I thought perhaps talkfilters might be able to give me a quick giggle.

2015-02-25-6m47421-talkfilters

Well, I smirked at one or two.

talkfilters is exactly what you think it is — a series of filters that exchange certain words or letter sequences for analogues spelled or arranged to poke fun at certain dialects or speech patterns. Or individuals.

In some cases, it’s not so much a filter as an insertion tool though, with sporadic phrases interjected at points. Sometimes it’s funny, sometimes it’s just an obfuscation. And sometimes there’s probably a joke in there, but I don’t know what it is. :\

Like any attempt at comedy, talkfilters is likely to insult you if you think you’re the target of its humor, and I see one or two in there that might even be jabs at me. Not personally of course, but probably at my own demographic.

I don’t really care though. If your sensibilities are so fragile as to take offense at a juvenile filter that translates into an “accent,” then you haven’t been exposed to the real problems that can happen in life.

Regardless, I can see where one or two of these might have an application beyond the comic, and the buccaneer filter is likely to be of use sometime in September. Aside from that, I don’t know if there’s much other than comic relief they can offer. If they even do that. … 😐

P.S.: In Arch as talkfilters, in Debian as just filters.

html2wikipedia: Converting back and forth

A long time ago I mentioned wikipedia2text, and not long after we ran past wikicurses as an alternative. In both of those cases, the goal was to show Wikipedia pages in the console, without so much congealed dreck. wikicurses in particular seemed like a good option.

But considering that much of Wikipedia is put together in a markdown-ish fashion, wouldn’t it make sense to have some sort of conversion between HTML and Wikipedia format? You could conceivably take a dull .html file and send it straight through, coded and set.

Never fear, true believer.

2015-02-17-6m47421-html2wikipedia

html2wikipedia is a free-ranging program that does very much that same thing. In that case, I grabbed kernel.org, pumped it through html2wikipedia, and got something very close to markdown.

I should mention that it’s not perfect; I wouldn’t blithely slap the results of html2wikipedia straight into a Wikipedia page, mostly because I think the formatting would be off kilter here or there.

But at first glance, it’s certainly in a workable state. The author suggests it should work in Windows too, so if you’re an avid Wiki-gnome (I am not), this might save you save time and work in the future.

Like I mentioned, I don’t see html2wikipedia in either Arch or Debian, but I don’t take the time to go through every distro out there. 😯 Whether it is or isn’t, this is one of those times where it might be quicker and easier to download the source code and build it manually than download all the other packaging materials that accompany a 59Kb executable. πŸ™„

cam and cam: One for the eyes, one for the ears

In a rather odd twist, I have two programs entitled “cam,” one which has a visual focus, and another which has an audio purpose. Let’s start with the eyes.

2014-12-23-jsgqk71-cam

And I am beginning to believe that tools that translate from standard image formats to terminal output are not so rare after all.

This cam is available in the AUR as cam-git, but to be honest, the version given there wouldn’t build for me.

However, following the instructions on the home page made a workable cam, and as you can see, it converts our old pal Smiley into its text-only version with no real effort. It also manages a fair representation of the original colors, and shades things appropriately where it can.

cam also squeezes its output to fit the current terminal dimensions, without losing the aspect ratio — something I liked in the last converter we saw, and in others from years past.

cam seems eager to take on the role of a slideshow tool as well, with options for pausing between separate image files, preset looped shows, sizing in proportion to the terminal dimensions, and eight- or nine-position alignment that overwrites the current terminal content. It’s a nifty effect.

This cam is a solid thumbs-up in terms of graphics viewing for console environments, and unless you have something specific that you need from another converter tool, it might usurp others you already know.

Here’s the other cam, which is an acronym for CPU’s Audio Mixer. I’ve looked high and low for a home page for this cam, but the only sites I can see in the source code, and the only addresses I find in the Debian packages are all dead.

2014-12-23-jsgqk71-cam-02

Which might be a foregone conclusion, since cam’s source codes show dates as early as 1994, and I don’t expect the home page for an OSS-era audio mixer to survive 20 years until now. Not that it can’t be done, only that it doesn’t surprise me if it didn’t.

This cam seems to work well in hand with alsa-oss, but the only mixer controls I can muster are the ones you see in the screenshot.

I also can’t account for the oddball characters used in cam’s display, but I’m willing to either chalk that up to cam’s age, or to my less-than-expert setup, or using the Mint live environment. Any one or all could be a factor there.

This second cam might be a little less useful for those reasons, but it also has most of the requisites I look for in a decent console application — good use of color, onboard help and key cues, and a straightforward focus that doesn’t wander all over the map.

Still, it’s good to know it’s available, even if it’s not altogether as employable as it may have been. 😦

morsegen and morse2ascii: Since we’re on the subject

I have a couple of other small Morse telegraphy tools in my list, and since we covered cwcp in the last post, it’s probably a good time to throw them into the mix. Here’s morsegen, from Luigi Auriemma.

2014-12-18-6m47421-morsegen

As you can see, morsegen is very straightforward, and really only reads text files and converts the contents into dash-or-dot sequences. No flags or frills, unless you consider the readout of Luigi’s fixed header to be a frill.

In that sense, I would prefer morsegen work a little more like morse, and accept text either as a target, or through a pipe. morsegen seems hard-coded to look for a target file, and read through that.

Which is all neither here nor there, and perhaps if you like, you can ask Luigi’s permission to adjust morsegen. I wonder if that wouldn’t make morsegen nearly identical to morse, though.

Here’s something a little more ambitious, by the same author: morse2ascii.

2014-12-18-6m47421-morse2ascii

The inner workings of morse2ascii are beyond me, but suffice to say that it reads through a wav file, senses the tones, and converts them into text. You can see the analysis and the results in the screenshot, taken from a random sound file borrowed from The Internet. πŸ˜•

As far as I can tell, as someone unskilled in the art of decoding Morse telegraphy, morse2ascii is doing a good job. The file I borrowed was supposedly a training session, working through basic letters and digits before moving into specific sequences. It looks right, anyway.

morse2ascii has the same arrangement as morsegen though, and won’t accept strings and wants a target file. So if you want to stream audio through morse2ascii, you might need to first capture the broadcast, then feed it to morse2ascii. I leave it to you to solve.

Both programs compile and run fine in Arch; morse2ascii is in AUR if you prefer. Debian has both prepackaged. Debian users get all the cool toys. … πŸ˜‰

jp2a: Jack be nimble, Jack be quick

Quick, nimble, short and fast programs are always to my liking. We’ve been through plenty of image-to-text converters for the console, but here’s one that just plain works, on the first try: jp2a.

2014-12-15-6m47421-jp2a-01 2014-12-15-6m47421-jp2a-02

I’m showing two screenshots there because I wanted to point out one small thing about jp2a that I really like: It’s smart enough by default to keep the original aspect ratio, and confine it to the available terminal space.

I know that seems like a small issue, but the original smiley face image that I used was 1024×1024, and some utilities try to convert that as pixel-to-character, on a one-to-one basis. Which complicates things.

jp2a can certainly do that, and if you dig through its flags you’ll see that it can do quite a bit more too. I used only the --colors flag to generate the images above, but you can set output dimensions, redirect to a file, flip an image on conversion, put borders on output and a mess of other options.

If you’re looking for a quick, fire-and-forget conversion tool this might be the one. And given that it has only libjpeg (and curl) as its dependencies, it definitely won’t burden your system with random and impractical features that draw in obtuse libraries.

And once you’ve got your conversion tucked away, you’re only a hop, skip and a jump away from completing your text-only masterpiece. Don’t forget to invite us to the unveiling. πŸ˜‰

number: What computers were made for

I found a lonesome leftover title from bsd-games hiding in my vimwiki directory. This is number, which, if you think about it, does pretty much exactly what it promises.

2014-11-04-6m47421-number

number takes a series of digits and converts them into written English. It’s a niche application, but one that could come in handy.

By itself, number breaks apart its output line-by-line. If you want a full string, you’ll have to feed it its only flag, -l.

And that’s about it. If you feel like really putting number through its paces, give this a try.

number -l $( < /dev/urandom tr -dc 0-9 | head -c24 )

Things like that are what computers were made for. πŸ˜‰

numfmt: Saving you a trip to Google

Sometimes people accuse me of misnumbering things when I type “4Mhz” or “64Kb,” because there is a difference in numbering and how the abbreviations are used. Which is true.

In my defense, I’ll say that I adopted the uppercase-lowercase style as a concession to the AP Stylebook, which (last time I checked) doesn’t rule on things like mebibytes. I have other reasons, which are rather boring (skip to the end if you want to know).

Regardless, “Mb” seems to cover the idea for me, and I can’t recall ever running into problems, except perhaps when talking about labeling actual, exact, bit-for-bit drive storage space. Which is a scam, anyway. πŸ‘Ώ

But the next time you want to scold your friendly neighborhood Linux blogger, you can critique the writer’s integrity with numfmt. Another of the coreutils gems, you can get almost any proper formatting for a number in as simple a command as this:

kmandla@6m47421: ~$ numfmt --to=iec-i 64738
64Ki

Or …

kmandla@6m47421: ~$ numfmt --to=iec 64738
64K

Or …

kmandla@6m47421: ~$ numfmt --to=si 64738
65K

And so forth, and so on. numfmt will also convert back from abbreviated formats, in such as this:

kmandla@6m47421: ~$ numfmt --from=si 65K
65000

kmandla@6m47421: ~$ numfmt --from=iec 65K
66560

kmandla@6m47421: ~$ numfmt --from=iec-i 65Ki
66560

A little boring, but useful when I need to convert 59.75Gi back into a full string of numbers. …

kmandla@6m47421: ~$ numfmt --from=iec-i 59.75Gi
64156073984

Remember this, the next time you need to partition a drive with fdisk. It might just save you a trip to Google. πŸ˜‰

P.S.: For those who really need to know … my rationale on deviating from pure AP Style on MB and MHz and so forth, is that the words are spelled out in full as “megabyte” and “megahertz.” We don’t write “megaByte” or “megaHertz,” or for that matter, split the words as “mega byte” or “mega Hertz.” Since the abbreviations “MB” and “MHz” are deviations from other abbreviations like “km” for kilometer and “kHz” for kilohertz, my mind says “Mb” and “Mhz” aren’t polluting any rules on uppercase and lowercase as they should appear in print. It seems these are determined on a case-by-case basis of what looks right. Of course, you could say that about a lot of things in the AP Stylebook. …