mindstalk: (Default)
At work today, Boss suggested I look at sqlite a bit, since our client code uses it. What I thought might be a brief glance turned into hours of reading, as it became rather fascinating. For those who don't know, it's an embedded SQL database, with not much code, unlike the client/server databases of Oracle or anything else you've probably heard of. As their docs put it, they're not competing with such databases, they're competing with fopen() and other filesystem access.

They call their testing "aviation grade", possibly without hyperbole: 100% branch coverage, 100% coverage of something stronger than branches, 700x more testing code than actual library code and a lot of that generates tests parametrically... it sounds pretty nuts. They worship Valgrind but find compiler warnings somewhat useless; getting warnings to zero added more bugs than it solved. https://www.sqlite.org/testing.html

They claim "billions and billions of deployments", which sounded like humorous hyperbole until they added being on every iPhone or Android phone, every Mac or Windows 10 machine, every major browser install... There are over 2 billon smartphones, so just from the phone OS and the phone browser, you've got 4 billion installs...

They also make a pitched case for consider a sqlite database any time you'd be considering some complex file format. With almost no code to write, you'd get consistency robustness, complex queries, machine and language independence, and at least some ability to do partial writes[1], compared to throwing a bunch of files into a zipfile.


They also had a nicely educational description of their rollback and write-ahead models. https://www.sqlite.org/atomiccommit.html

[1] I do wonder about this. One odd thing about sqlite is a looseness about types, and AIUI cramming numeric values into the smallest range that will hold them. So I'd think that if you UPDATED a value 100 to a value 1000000000000, you'd have to shuffle the trailing part of the file, compared to a format that e.g. reserved 8 bytes for a numeric type. But maybe they do buffer numeric or string storage. And not having to write the whole file, or not having to read the whole file (e.g. to decompress it) seem like at least partial wins.
mindstalk: (Default)
In April a friend introduced me to csvkit, a suite of command line tools for manipulating CSV files, including doing SQL queries against them, and that sounded cool so I made a note. A bit later, friend Z Facebooked about q, which is the worst software name ever, which also ran queries against CSV files. I made another note.

My use case is my finances, which I'd been keeping in ad hoc text files like "May2015", with some awk scripts to sum up categories in a month, and crosscheck that the overall sum matched the sum of all categories, to detect miscategorization. It worked well for that task but wasn't very flexible, and late last year I had the idea of finally going to 'proper' software. At first I assumed a spreadsheet, because spreadsheets = finances, right? But then I realized that for the queries I wanted to do, SQL was more appropriate.

So I wrote a Python script to convert my years of files into one big CSV files, with date broken down into year and day for easy queries, and my text tags converted into a category column. Then I imported it into MySQL and it was good.

But what about going forward? I spend more, and make new text files... making notes in the full format (date, year, month, day, amount, category, notes) is a pain, and I kept forgetting how to import more into MySQL, and I just let things slide.

Last night I decided to get back to it, as part of checking my spending and savings, and checked out the old tools, with this year's spending in a simpler (date, amount, notes) CSV file.

Both programs work, and I figured out sqlite for extracting month on the fly (so I can group sums by month, or compare power spending across all Junes, say.) Sample queries:

q -H -d, "select sum(amount) from ./mon where code like '%rent%'"

q -H -d, "select strftime('%m', date) as month, sum(amount) from ./mon where code like '%transport%' group by month"

csvsql --query "select Year, sum(amount) from money2 where Month='06' group by year" money2.csv
#that's against the more complex CSV

How do they compare? Probably the more important is that q is way faster, perceptually instantaneous on a 7000+ line file, while csvsql has notable startup time. Both are Python, but csvkit also requires Java, so maybe it's starting a JVM in the background.

q is much lighter, an 1800 line Python program; csvkit has a long dependency list. I tried using the Arch AUR package, but don't have an AUR dependency tracer, so ended up using 'pip install csvkit' instead.

q needs to be told that the CSV file is actually comma separated, not space-separated, and has a header; OTOH csvsql needs to be told if you want to do a query, and the file you're querying.

It looks like both only do SELECT, not UPDATE; I'd wanted to do UPDATE in cleaning up my booklog CSV file but ended up resorting to another Python script. (After trying to push everything into a real sqlite database, but failing to get the weird CSV imported correctly.)

q only does queries; csvsql does more, I dunno exactly.

q has a man page, csvkit docs are entirely online.

I'll probably be using q.

Why not use an actual database? Mostly to cut out steps: new expenditures or books read are easy to update in a text file, and if I can treat that as a database, I don't need a step to update some other DB.

mysql felt heavy and clunky, though thanks to work I now know about the '~/.my.cnf' file which can store authentication. You still need a mysqld up. sqlite3 can run directly off a file and is certainly worth considering -- though as noted, I never got it actually working.
mindstalk: (Default)
Firefox 52 dropped support for ALSA systems. Arch Linux users were insulated from this; something like the code was still there but not enabled by default, but it was in the Arch package. As of FF 54 though, poof, it's gone for good. I'm not sure exactly why Pulseaudio is avoided, but I'm still avoiding it... so need another browser.

There are lots, actually! Currently trying Seamonkey on the work VM, mostly because it's the one alternative which is both based on the same engine as FF (so familiar, and plugins should work) while having a supported package on Arch. There are a couple more, including Pale Moon, but they need the AUR, and I'm lazy.
mindstalk: (Default)
So, I play freecol. A while back, it started behaving badly -- popup windows would lose focus, and I'd have to lower and raise the window to get it back. It was an annoying ritual, but I stuck with it.

Today at work, I'd stopped working, but had some time to kill before my next event, so installed freecol on the VM. To my surprise, it behaved the way you'd expect.

Fresh install, so maybe I had broken configuration at home? Went home, nuked all the directories, tried again. Nope.

Well, the other difference is that I've been using twm at home -- it's primitive but lightweight and familiar -- but xfce on the work VM, out of necessity to get things like resizing display. So I installed xfce4 at home, and tried that... yep, freecol played nicely.

Maybe I had something wonk in my .xinitrc? Nuked it down to just running twm... nope, still bad.

So I guess something in a freecol update stopped playing well with a 1980s window manager. Oh well. Maybe I'll just switch to xfce at home (though it'll be confusing when I'm running Arch/xfce on both the VM and the host...) But I'll need to configure it, to get some key mappings, and move-to-focus.

Nope, I don't need to; they're there already. HOW? That's really spooky.

I hunt down the config -- .config/xfce4/ -- and look at the modification times. Some are tonight, but some are 1 Nov 2012. "Wait a minute."

See, sometime after putting Ubuntu on my laptop, I played around with a whole lot of graphical environments and window managers, then upgraded, and broke Ubuntu for good. But that's another story; the point is that it's suddenly plausible I installed xfce back then -- on another OS -- configured it to taste, and moved on, leaving the preferences buried in my home directory.

Well, I keep a detailed journal for a reason. I check... and yeah, while I don't mention xfce specifically, 1 Nov 2012 was a day of messing around with such things.

"Wow! So I somehow copied my home directory in toto, between laptops, picking up weird directories like .config. I'm impressed."

"...no, I'm a dumbass; it's the *same laptop*."

OTOH it *is* a whole different version of Linux. Did I install Arch on top of Ubuntu and keep my home dir, or copy out my home dir to an external hard drive, to copy back after installing Arch? I honestly don't remember, but either seems plausible, and would get the job done.

Actually there's an /old directory on the hard drive, basically an old root directory, which I think is evidence that I managed to drop Arch right onto Ubuntu after I made a copy. There's even /old/etc/os-release, saying "14.04 Trusty Tahr". (It was not trusty; it refused to boot and I switched to Arch. Though now I'm not sure how I made the copy. Maybe I did go through a hard drive?

Anyway, one way or another, five year old configuration I'd completely forgotten about stayed with me, and worked smoothly. I guess the real surprise is that xfce didn't change its configuration system in five years, not enough to break things!

Edit: on playing again, it was broken again! Waaaa. After more investigation, it seems broken with twm no matter what, even with an empty xinitrc, but with xfce, it breaks when scim is running. That's my Japanese input interface, I'm not giving that up. :(

I guess I could play in the VM. Or I could play less, that'd be good...

aliasing fi

2017-May-13, Saturday 07:12
mindstalk: (Default)
I think I mentioned not long ago that I found I'd been aliasing fi=finger which breaks if loops in my shell, and marveled that it took so long to find that. It makes more sense to me now.

1) Yeah, I didn't script much.
2) When I did do an ad hoc script at the prompt, it was a for loop.
3) Scripts you get are mostly bash scripts.
4) Even an explicitly written zsh script wouldn't have a problem: my aliases are loaded by .zshrc, which is loaded by interactive shells, i.e. not script shells[1].
5) Only when I tried pasting an if loop into a *function*, also loaded by .zshrc after my aliases, did a problem occur. Possibly it had occurred before and I simply gave up on some unnecessary function that mysteriously didn't work.

[1] This also sheds light on past failures to ssh in somewhere and invoke a function directly: not an interactive shell, so no functions loaded. When I try 'ssh ... "zsh -i script_invoking_function"', it works. So if I want remote function invocation, I'll need to use -i or to load functions outside of .zshrc.

why zsh?

2017-May-11, Thursday 21:21
mindstalk: (Default)
When I got to Caltech and discovered Unix, the default shell on the cluster was csh, with more user features than the sh at the time, but not a lot. If you got the lowdown, you could switch to the far more useful tcsh, but the sysadmin refused to make that the default for resource reasons. There was also ksh, but I never heard people talking about it.

A few years later zsh came along, and the more techie undergraduate cluster largely switched to it en masse. It was even made the default shell there.

Out in the greater world, and in the era of Linux, bash seems the default shell, pretty much incorporating much of what was good about tcsh and ksh, and also displacing any more primitive sh. zsh still is an exotic thing even Linux people may not have heard of... which is a shame, because it's so much better.

Granted, it's also way more complicated, and a lot of its cooler features have to be turned on. If you want a shell that's full-featured out of the box, there's the even more obscure 'fish'.

And bash can approach, though not catch up to zsh, with the "bash-completion" package.

But what's so cool? Well, tab-completion can be far more powerful, working not just on filenames, but environment or shell variables, command options, man pages, process numbers, and git branches. It can also go to a menu mode, for scrolling around lots of options.

(But fish will do the magic of parsing man pages on the fly to display command options. :O )

It's easy to have your prompt display the exit code of the last command, something I find pretty useful; doing that in bash requires writing your own functions.

Likewise, you can easily have sophisticated right-hand prompts.

**/ recursive directory listing, though that is something you can turn on in bash. (shopt -s globstar)

Even more extended globbing, including excluding patterns, or selecting files based on modification time within a window and other criteria.

Redirection tricks, some of which reduce the need for tee. |& pipes stdout and stderr to a program such as less. >! can clobber files even when you have noclobber on.

I'd anticipated sticking to bash for scripting, for better standards compliance/portability, but I realized that I'm not writing a package script, just in-house tools. And zsh scripting has a lot going for it. Arrays just work, while bash arrays were described Sunday as the worst of any language. I'm using the mod time glob mentioned above.

zsh can share history between shells. I find this useful and annoying -- useful now for storing and reusing commands, but also destroys the individual history of a particular window. Oh well. An impressive application was when I found myself reusing history across *machines*, where my home dir was NFS mounted.

"Named directories" mean I can collapse long pathnames in my prompt, e.g. Main/wsgi-scripts becomes just ~WS

Probably a lot more, but those come to mind.

That said, there is one odd lacuna in zsh. bash has --rc-file, to tell it to read in a custom rc (like bashrc) file after everything else. zsh... doesn't. And sometimes I would like to start a shell with a custom additional environment, e.g. from ssh.
mindstalk: (escher)
My boss apparently figured out the problem with the VMware clone: fakes3 (for faking a local Amazon S3 service) apparently behaves badly if given the local hostname (or just localhost?) rather than an IP address, and I'd probably edited the clones files to use a name because why wouldn't you.

And I tackled my VBox again, and got shared directories working! I'd found a different set of instructions, which worked for manual mount, and then even automount from fstab. Going back, I reproduced the error I'd gotten from the Arch instructions: I'd been using '/vmshare /vmshare' (Window and guest locations, a la VMware FUSE command syntax) when it actually wanted 'vmwshare /vmshare' (short name of the shared directory in VBox, guest location). "Protocol error" is a pretty terrible error message, but I can see now what I was doing wrong.

I also found VBox's Seamless Mode, which I don't quite see the deep point of yet, though it does reclaim screen space from the Windows title bar while still leaving the start/monitor bar at the bottom, but it's allegedly similar to VMware Unity Mode, except Unity says it doesn't support Linux Guests.

So VirtualBox seems strictly better than VMware in features, since it does everything one would want, while VMware doesn't do Unity or (more important to me) touchpad scrolling. OTOH we probably have the VMware clone at least behaving the way we expected it to. Though I'm not sure this was actually tested on it, I think it's a prognosis based on fixing something on the Ubuntu machine.

Also VBox is open source and doesn't charge you money for running more than one VM at once. OTOH we already paid VMware the money.

I haven't tried comparing performance.
mindstalk: (Default)
My Arch VMware still doesn't do touchpad scroll, not that I've tried.

I cloned it for my co-worker, edited the accounts, tested the system, it worked fine. Copied it to the shared hard drive, then to her laptop. And now it has quirky IP address or hostname lookup issues that we can't figure out, such that the boss decided to start over.

With OpenSUSE! He trusted the official VM tools, it didn't work. May have tried Open VM Tools, I stopped paying attention.

Co-worker moved onto Ubuntu, using an image from OS Boxes, which I view as potentially NSA/mafic front, but hey, it's not my IP. That seems to be working, possibly in all ways.

I was inspired to go back to VirtualBox, and started over from scratch. After 40-50 minutes, mostly waiting for packages to download and install, it was ready, with X and XFCE and Firefox. Display resizes, cut and paste works, even scrolling works! Everything... except shared folders; I thought I followed the Arch instructions, but I get a "Protocol Error".


I have continued to realize VMs are cool. I could have a second Arch VM and play with desktop environments without messing up my working one. Or play with Ubuntu and Red Hat without rebooting. Or you could skip "will Linux work on this laptop?", install VBox or QEMU on Windows, then go full screen and ignore Windows almost entirely.
mindstalk: (bujold)
LXDE was happy starting from startx, but it doesn't have a way to configure move-on-focus. Searching about "you can't" and "apply this 100 line XML file somewhere". So I moved on to xfce -- the full thing, not just xfwm. It's not happy starting from startx/.xinitrc, or I'm doing something wrong, but it provides its own startxfce4. It resizes, doesn't crash, and had a single step for turning on the One True Mouse behavior. Was also able to configure my usual X keys (I have some function keys mapped to window raise/lower/minimize). Plus it's supposed to be fairly light weight. So that's where I'm at for now. Haven't explored it much since; if it lets me move my windows around, I'm good. (I'm used twm after all, which pretty much is nothing but that.)

On the downside, touchpad scroll still doesn't work. This may be a VMware problem. I was working on a VirtualBox image, but it didn't go smoothly. First I tried export/import, which didn't seem to work -- frozen boot screen. But when I went to Close it, the proper display flashed up, and I've been able to find that it does boot and have my account. But it's not *usable*. Possibly X would fix that. I also tried a pure install, but after applying some tweak to make console resize, it didn't want to boot at all. I haven't had time to go back and try pure vanilla. And the VMware image I'm working with is getting more and more developed, it may be hard to switch.

I also found a program to make *Windows* use move-on-focus. I should probably tell you what it was, but I don't remember, and the info seems to be only on the office machine. But it's SO useful, at least for my workflow which uses overlapping windows a lot. (Often a full-screened browser or VM (or browser in VM) and some other window I'm taking notes in.)

OTOH I really wish I could make *Windows* raise and lower windows with a key.

New co-worker coming Monday, she'll need a VM too. Rather than re-installing, I simply cloned mine. Easy! And purged my limited personal info on it, a bit more work. And got the system working on it... that was a lot more work, we've got too much hardwiring of local IP address. Which will interfere with putting code in source control too, so we've got a double incentive to fix that.
mindstalk: (CrashMouse)
My new work laptop has Windows 7 Pro at base, which we need at some point, so for Linux we've been trying to put Linux into a VMware Workstation. Since I use Arch, I tried for Arch, even though it's not listed as supported. It's been a fun couple of days. Some of that my own fault: though I did wonder about boot information, I missed the "choose and install bootloader" instructions three times running. Some, well, while Arch does tell you to enable dhcp, you have to click through and read everything; it's easy to think it's up by default.

Then there's VM Tools. Supposedly even VMWare tells you to use "open-vm-tools" rather than what they provide, but a couple webpages said certain features would work with the official tools. But its installation script failed straight out of the ISO, on a clean install. That's never good...

There's a site OSBoxes.org, which provides VMWare and VirtualBox images of various OSes. No idea who they are, and I'd be paranoid about trusting some unknown OS image. OTOH, I did end up downloading a few to see if things would work at all -- Arch CLI, Arch KDE, Ubuntu.

Discovery: don't think I like KDE or Ubuntu's UI, but the latter did have full screen and cut-and-paste between Linux and Windows. The Arch ones didn't seem to, so it didn't seem worth trying to track down a difference in configuration.

One cool thing about VMs is that you get to treat 'machines' as documents. I'd started making copies and snapshots, and when messing around with official VM Tools failed and broke things, I was able to pop back to an instance before that. Woo.

And with that, trying open-vm-tools again *very carefully* and avoiding conflicting paths, I got shared folders working -- even without the auxiliary tool the docs said I would need. Sweet! But fullscreen and pasting still didn't work.

OTOH, by default I use startx and the ancient environment of twm. xfwm4 didn't 'work' either. Finally I tried Cinnamon... the window manager of which promptly crashes. But the session hangs around, and voila! fullscreen and paste! So I guess I'm going to need some sort of full session for this thing, not just a WM.

Also twm was able to take over the apps, and then the Failsafe Desktop or something becomes a window managed by twm. That's just surreal.

LXDE was happier starting from startx, and that's what I've got now.

Still missing: touchpad scrolling, which is a big loss. Hope I can get it...
mindstalk: (12KMap)
My phone (Android 4, CM 11) swipe input is weird when it comes to profanity. So, there are three levels: its first guess for your word, two alternates to the side, and then a list you can bring up. 'suck', 'sucking', 'shit', and 'dick' will never appear in the first two levels, even if I go slowly and letter by letter -- 'shi' turns into 'shot', with 'shirt' and 'shoot' as alternates. Peter thinks it's a probability weight thing; I figure it's hardwired, with a short list of words being simply barred from your being able to input them too quickly (i.e. accidentally.)

But 'fuck', 'fucking', and 'fucker' I can enter quite easily. 'cunt' too. And 'pussy', with a bit of care (it's hard to swipe a double letter.)

Peter thinks it's also probabilities weighted by how you've used the phone, but I use 'suck' and 'sucking' in texts far more than any of the others... I've probably never tried to swipe 'cunt' before.

My thought for a while was that maybe fuck* weren't in the dictionary at all, until I added them, so wouldn't be barred, but I checked my personal word list and nope, they're not there.

So I dunno. Maybe it's more of an "accidentally unprofessional" filter, like words on the edge of acceptability are barred so you don't tell your boss how much something sucks, but the designers figured if you want to go full vulgar you knew what you were doing. Not how I'd do things.... and no, I don't see a profanity filter I might have turned off.

Wait, I'm wrong! I just checked again, and yes, Android Keyboard has a "block offensive words" option which is off, so I probably did that at some point... and I'm *still* not getting 'suck' or 'shit' as choices above the third level.


Totally unrelatedly, I finally have Japanese input working on my laptop! 日本語よ! I'd tried UIM a while back, per the Arch Linux default recommendation, but it didn't work. Then I tried SCIM a few days ago, and it seemed to not work either, but later I found myself typing in Japanese suddenly. Ctrl-Space turns it on, Ctrl-Shift cycles through modes (Anthy [Japanese], Unicode, English/European [which doesn't seem to do anything]. I should look into configuring that, because I need Ctrl-Shift-C and -V to copy and past from/to my Terminator terminal, so there's an annoying conflict there. Still, woo!

Is this more than a toy, given my weak Japanese skills? Slightly: online dictionaries tend to work best with Japanese input, not romaji, so now I can actually use them. And I've started studying it again, so that helps.

today's events

2016-Nov-05, Saturday 15:53
mindstalk: (juggleface)
Crisis! I was going for my measuring cup, and a wine glass fell out of the cabinet and utterly shattered! Oh no! Except, it fell into the large kitchen sink. Total shrapnel containment! Except maybe for one piece on the counter, I don't know if it leapt up there or fell off when I was picking up pieces to put in the trash. But yeah, as far as shattered glass crises go, this was about as mild as it could be.


I'm not experienced or bold with hardware. But I've been worrying about my laptop fan for a while. Partly the temperatures reported by acpi -t[1], partly the knowledge that I'm much better at washing dishes than I am at dusting my household, and between me or my tendency to live on mildly busy streets, the dust piles up amazingly fast. So I randomly decided today to see if I could clean it out a bit. My old set of screwdrivers doesn't have one small enough for laptop screws; fortunately, in cleaning a few months ago, I found another set of screwdrivers I got who-knows-how, which does. Sometimes, hoarding really does pay off.

So I carefully took out and arrayed the screws -- I could have been more careful, put them in a cup, but I trusted my careful habits, mostly correctly in this case -- and eventually got one part of the bottom off, exposing the fan. There wasn't that much dust, actually; either it's piled up in the internals, where I'm not brave enough to go, or the fan actually works. There was some dust on the battery grill, and a lot on the fan grill -- kind of a lot: enough to obscure vision, not so much that I was rolling off felted mats. Then again, I took a hand vacuum to it quickly enough.

Apart from that, meh. Put it all back together, cleaned the table, turned it on, and hey, it still works! *And* it's claiming a much lower temperature than it usually does. Success?

But, we have some screws loose -- literally. Most of the screws are pretty short, but two were long and deeply recessed. And a couple seemed to just fall out of the laptop, too -- one long, one short. I thought I had everything lined up properly, and I don't remember any holes being screwless in the first step, but in the end I was a short screw short, despite supposedly having an extra. I don't think it'll matter, the panel is secured by two other screws (but it's a dust hole!), but, weird. As for the spare long screw, I put it in a coin purse.

[1] Such as they are: it was alternating between 56.5 C and 62.5. And not in the course of operation: one boot would be at 62, the next at 56. Now it's claiming 36.5. So I don't have a lot of faith in the accuracy, but insofar as it's measuring anything at all, that may have improved.
mindstalk: (robot)
most: the pager sequence now goes more, less, most. most's big thing seems to be displaying multiple windows. It's also good on scrolling sideways, but I just found less is too, so I'm not sure there's a difference there. OTOH, I just learned less can scroll sideways.

rlwrap: applies a readline wrapper to interactive programs that don't use readline directly, like ocaml or 'perl -de 1'. If you use rlwrap -m, then ^^ summons an editor on your input.

man 7: there's a whole lots of odd information there.

.inputrc lines for better history:
"\e[A" history-search-backward
"\e[B" history-search-forward
searches (up-arrow) with what you typed so far as a prefix. There's also ^R, which you type first, followed by what you're looking for, and use ^R again to search other matches.

I recall that years ago, zsh searched on prefix. Then for a long time it had gone to only searching on the first word. I finally got the behavior I wanted back, though it's more involved.
(* edit: these lines don't actually work for me. I thought I did but I must have tested in a shell with the other ones already loaded, not in a fresh shell.
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-beginning-search
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-beginning-search

autoload -U history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^[[A" history-beginning-search-backward-end
bindkey "^[[B" history-beginning-search-forward-end

I don't know the difference between the two, if anyway. The -end stuff in the second case is to make it move the cursor to the end; otherwise it just leaves it where you left it, which I hate.

zsh tricks:
ls > file1 > file2, or ls > file1 | file 2. Duplicates the output. More compact than messing with tee.

I just spent an embarrassing number of seconds trying to see if "ls | cat | cat" would "duplicate output", before I remembered what piping *does*.

You can set zsh options so tab completion lets you scroll around the choices. My mind is blown. I'm not sure what the minimal set needed is.
setopt auto_menu auto_list
seems like a good starting point. But I'd just re-started the configuration wizard and turned almost everything on and stuff started being cooler.

I played with the shell fish ("friendly interactive shell") again. I'll probably never leave zsh at this point, but fish does lots of neat things out of the box, vs. having to turn them on in zsh via research or going through the startup wizard. I think zsh's completions are more powerful, but it's a close race.

[Edit: hmm, I just found that for ocaml, zsh doesn't provide anything, but fish does. I'd guess fish is doing its parsing of man pages thing, rather than knowing about ocaml from installation.]

kill completions:
phoenix@mindstalk ~/zoot> kill 
1            (systemd)  1430           (bioset)  1985  (systemd-journal)
2           (kthreadd)  1431           (bioset)  1990          (kauditd)
3        (ksoftirqd/0)  1432           (bioset)  2155    (systemd-udevd)
5       (kworker/0:0H)  1466           (bioset)  3048            (crond)
…and 46 more rows

[mindstalk:0] kill 3360
 3360 pts/3    00:00:04 zsh                                                    
18729 pts/3    00:00:00 zsh                                                    
18730 pts/3    00:00:00 ps 

bash (with bash-completion package):
[phoenix@mindstalk zoot]$ kill 
Display all 151 possibilities? (y or n)
1      1422   1474   1499   15636  18739  2      3048   3337   491    779
10     1423   1477   1500   16300  18740  2155   3049   3338   5      780
10445  1424   1480   1501   16972  18741  23548  3050   3353   637    782

(and lots more PIDs).

As you can see, fish and zsh try to give you useful information, or at least a name. zsh seems limited to the tty process, which bash lists all the processes, regardless of whether you can kill them. fish also lists every process. No doubt zsh completion could be configured to do so as well. (I'd actually want just listing all of my processes, not like I can kill root ones.)

Likewise, bash's idea of command option completion is to just list them; the other two shells give descriptions. (What I really learned tonight was that bash does such advanced completion at all.)

sudo !!
A very old simple trick for when you try to do something but it needs sudo. If I'd known about !! I'd forgotten until today, though I knew about !num to get at a specific history command.
mindstalk: (Default)
On IRC we'd been discussing procmail, and its lack of maintenance, and whether it *needs* maintenance other than security fixes. I snarked about wc not needing updates... then checked and found that its web page was dated Jan 2016, because GNU. This led to Ian complaining about ls having too many options, and he didn't even know about the dired output ones for emacs integration. I count about 56 options. That's a lot!

OTOH, I use a lot of them:

All my aliases use -F and -color=auto.
lt uses -ltr
Others use u, A, s, h, and d. That's 10.

I discovered L recently, and found it useful. Others on the list look interesting: --group-directories-first, R, S, X. 14 total! Still a fraction of the total, but I'm not going to say the others are useless.

Are they redundant with the Unix way? E.g. all the sort options could instead be piped to /bin/sort. OTOH that would be more verbose, and less efficient, especially for e.g. a numeric sort on filesize: easier to sort within ls, which has the numbers as numbers, rather than to print them as text to stdout, read them in again and convert, then print out again. Or more commonly, sorting by modification time, as a human readable thing? Ew.

*** Reference

-F: append / for directories and * for exectuables and @ for symlinks.
-color: colors by type
-l: detailed listing
-t: sorts by modification time, newest first
-r: reverses sort
-u: show last access time
-A: show dotfiles, but not . and ..
-s: show file size in blocks
-h: print size in human friendly form, like 4.3M
-d: shows properties of a directory, rather than its contents.
--group-directories-first: duh
-R: recursive
-S: sort by size, biggest first.
-X: sort by extension.

machine go boom

2016-Sep-06, Tuesday 03:00
mindstalk: (Default)
College (and other) friends and I have shared a server for many years, racked in some colo place. This instance, the third, was bought in 2003, and has served us far longer than we expected. In the past couple days we basically got to watch the RAID die in real time. Still not sure if the disk filling up was a trigger or result or unrelated, but today I watched it die with only 88% full disk. I got to see even some of my own files turning corrupt, like being owned by another user.

Robbie and another friend had unkind things to say about hardware RAID. We'd gotten hardware RAID, 3wire, set to redundancy mode for the server. We'd thought we were doing really well, with some tool reporting no disk failures... now someone else says it may have lied, with disk problems we weren't told about.

OTOH other friends say software RAID really wouldn't give performance or even safety guarantees. I dunno. But the damn thing did survive 13 years of probably somewhat heavy use, with our disks from one vendor; we sure got our money's worth.

The question now becomes "what next?" A bunch of us were still using it as an active server, like for mail, so a replacement would be nice. Previous machines were graciously retired and replaced on a plan; I'd kept urging us to go to machine 4 over the past few years, but people were lazy, and I was in no position to physically volunteer.

Of course, today we have VPS. Since I cleverly had mail going to my own domain, hosted on the server, I found I was able to get my own linode, transfer DNS, and get basic mail working, in under 3 hours. Hopefully at this point I won't *lose* mail, though I have yet to get procmail -- or some more secure replacement -- up; I really depend on filtering. And I don't know about spam... we had greylisting going, which probably prevented a lot of spam even before my powerful spamprobe filter; right now I'm exposed. But it's after 3am, it can wait a day or two.

Anyway, someone could probably replace our machine with a VPS quickly... if they had control over our DNS. That's probably one guy, on vacation right now. Whee. Also, while I backed up my own files, I never thought to grab the passwd or shadow files; if no one else did either, actually making accounts for everyone would be a pain.
mindstalk: (robot)
So with cold and allergies and stuff I've been sick tired and lazy, and limped along for a couple of weeks. Yesterday I got back to trying to whip my Arch install into shape. The big one was wifi, which kept not working, so I registerd with the forums and set about composing a very detailed post about my problems, pasting in lots of error messages and what I'd done to generate them. Then I thought to pass on some state, like the contents of wpa-supplicant.conf Whoops! Noticed I'd misspelled my WiFi network name. That didn't fix, but did generate new messages. Then I remembered process conflicts are sometimes a thing, so I was going to show I didn't have many of those -- whoops, two background wpa_supplicant processes. Killed those, still didn't work. Had noticed that the conf file had my actual passphrase commented out, in favor of some long hash; I swapped that -- ding! suddenly it worked. So the forum ended up acting like one of those teddy bears you explain bugs to before bothering another human about it, as that often clears things up, hence 'bugbears'.

I still posted in the end, but scrapped all the wifi stuff and just complained about tethering not working. Which turned out to be due to having upgraded my kernel, which orphaned some modules; once I rebooted, ding.

After that, getting my audio keys working took a lot of careful reading but very little work. Ditto for having lid-close not send my computer to sleep, but also turning the screen off. webcam worked after I put myself into the video group, as with audio -- I don't remember doing this with Ubuntu, but maybe Arch is more compartmentalized.

Not everything's done or perfect yet. I turned circular scrolling on, but you have to circle the center of the touchpad, whereas my finger reflexes and memory say that before, I was able to use small circles in the upper right quadrant of the touchpad to keep scrolling. No one knows what I'm talking about though; my best guess is that I was enjoying proprietary drivers with the Dell Ubuntu install, and the generic Linux is meh. I've seen Xorg options and played with synclient, but I don't see anything that controls what I've seen.

I'm still using twm, without dock or taskbar. I should probably fix that. I'm leery of big environments, though.

I have a few ripped DVDs, none of which play well, I'm not sure if this is the rip or the codecs. I think they'd worked better before... Haven't tried a physical DVD yet.

Overall it feels much faster now. I don't know if that's upgraded Firefox (though it's not just FF), upgraded Linux, lightweight environment, or having spent a week on my eee again making everything seem fast. It's been two weeks now, and thinks still seem fast and responsive compared to before.

Oh, and I had a working compose key, but now the command is failing, and the forums have failed me.

Not much progress on the Android front, apart from getting tethering working (my eee served to test that -- worked smoothly even with modded Ubuntu 10.04.)

Electronics 2

2014-Apr-30, Wednesday 03:13
mindstalk: (robot)
Ordered a used Galaxy S4.

Installed Arch Linux on my laptop, more or less. For the USB stick version, wifi-menu didn't work, but I was able to get wifi the alternate way. For the actual install... nope, not yet. Firefox has jumped from 21.0 to 28.0 for me, with a side effect that my preferred Garamond font is now used everywhere, but the flashplugin doesn't seem to work; Youtube videos crash, anyway, complaining about inability to find card '0', my sound card. I haven't tried installing media players yet to see if they'd fail too. Touchpad works surprisingly well; scrolling wasn't but synclient quickly fixed that. The Arch wiki *is* pretty good...

Edit: chromium was able to play Duolingo audio; Firefox *still* can't. I installed totem, which played audio from a saved FLV. Scratchy, I think, but that sometimes happened before; at least sound plays at all. And chromium can play Youtube just fine, without plugins, even. Hmm.

No, wait, now Firefox can play Youtube too. I don't even know what I did. Unmuted alsamixer, added myself to an audio group (which you're not supposed to do, but then you're not supposed to need to... ran speaker-test.) VDPAU errors are still being generated, but non fatal ones.

Currently running twm as a lightweight default. It's amazing how few processes I have... but I'd want the laptop sound keys to work. And a wifi applet, and a way to dim the screen...
mindstalk: (robot)
It's been a bad week for the devices of my household. Well, my N900 smartphone has been having growing trouble for the past few months, but recently it pretty much lost all ability to reliably keep a data connection up, especially for SSH. (Web seemed to do better for a while.) Then it was having more and more trouble with even voice; more and more I'd get a message like "General connection error, even emergency calls won't work, try rebooting". I've given up and moved my SIM card to my 2005 $50 Nokia 6110 ("the Indestructible"), so I'm missing 3/4 of my contacts and texting sucks... even the 9 year old battery holds useful charge way longer, though. The N900's wifi still works fine, so it's become my bedside wee hours computer.

This of course leads to "Operation: Buy A New Smartphone", which would be a lot easier if anyone made what I want. Physical keyboard, removable battery, expandable storage, up to date, Android or even freer but reliable and competent OS -- nope, does not exist. Dropping the keyboard seems to mean "Samsung" these days, with new problems of "costs a lot" and "possible Samsung bloatware and slow updates". The Galaxy S4 has a Google Play (pure Android version) which would be good except it's still $649, about as much as a regular Galaxy S5. But you can burn on Android stock ROMs yourself, apparently, or just skip over to Cyanogen, so I'm thinking of an S4. Or going back a generation to the S III, though that's still not trivially cheap. Or else selling out and getting a Nexus 5. The OnePlus One sounds fairly attractive but it's unclear when it'll even come out, let alone how problem free it'll be.

The Oppo N1 comes with a Cyanogen installer, which is cute, but it's a $600+ phone that doesn't even have LTE.

Versus the Nexus, the S4 does seem to have a better screen and camera, plus a few more sensors; I'm waiting for phone to fully turn into tricorders. I'm still not sure if all that plus the batter/storage is worth $2-300. I did note that I'm only using 19G of the 48G on my N900, so fitting into 32G shouldn't be too hard. I am amused that phone are just catching up with the N900's storage options from 2009. (32G internal, 16G microSD card. Actually things with cards go up to 64 or even 128 now.)


Right, other electronics. So I'd let my Ubuntu 12.10 laptop fall behind on updates, and finally caught it up. After which the sound wasn't working, the touchpad(!!!) wasn't working, and the wifi wasn't working. I get messages about various sound devices being removed. I tried full system update, that fails with errors. I think I need a clean install. Safest would probably be to revert to 12.04, since I know that works. Conventional would be 14.04. I'm thinking of flipping off Ubuntu and going with Arch and learning more about how my system works, though the Arch installation guide assumes I know a bunch of things I don't, mostly about formatting.

So I'm using my eee 901 again, with its eeebuntu 10.04. Shocking to again have a version of Gnome that doesn't suck. It's slow and small and has almost on no space after downloading the Arch ISO. But lightweight!


2013-Jan-12, Saturday 16:39
mindstalk: (Default)
I've been very unadventurous since the 2nd and 3rd. On the 2nd new sandals chafed very badly, scraping off a lot of skin near my big toe; it's still scabbed over. (I've had related problems before; this is why I often commit the fashion sin of socks with sandals. Sandals air out my feet, socks protect them.) On the third I stubbed another toe unprecedentedly badly, with bruising halfway down, and ongoing mild pain or discomfort. I finally saw a doctor yesterday; she thinks a fracture is unlikely, and anyway all they do is tape your toes together. But she did recommend keeping my foot high ("to keep toxins from pooling") and avoiding hiking. It's like I got a prescription to avoid pedestrian tourism and stay in a place where groceries come to me.


S's parents are here, and K brought Starbucks instant coffeee. I just tried some, and it was very dark, burnt, and bitter, just like everyone says of SB coffee in general. I've been trying some local instant coffee with Colombian beans and a price twice the alternatives; it's much better by comparison.


Last night I noticed my laptop tingling while plugged in; I asked G about it, and got a remedial education in basic electric wiring, current and neutral and ground. My adapter is only two prong, and my laptop's ground wire had been unaccomodated; he lent me one of his 3-prongs, and the tingling went away. The eee didn't have this problem, but he remembered it as being 2-prong, and it's a hard plastic clamshell, vs. the high-metal casing of the Dell.

I might as well share, in case any readers are as ignorant. The two usual prongs are channels for the current, which is like an artificial river. Electrons come in and flow out, pushed by the voltage, and a device can draw power by sapping the potential like a watermill taps a river. (We ignore AC and oscillating current.) But electrons can leak from the innards to the case, or else fields can draw in electrons from dry air, and so a third wire connects the case to ground, draining off such nuisance electrons before they zap you like a doorknob. The eee, being solidly plastic, is naturally insulated from such problems.

This also sheds light on a cheap metal lamp I'd bought in Boston ($4, with CF bulb) that had also been tingly. I'd figured that was just cheapness -- I doubt it has ground -- but he suggested flipping the plug if it's not width-polarized like many these days.

He also reminded me that grounding in Chile is hard, what with all the fractured dry soil; years ago he'd said the observatory dug down tends of meters and still couldn't find good grounding. He's found that neutral and ground are 20 volts apart, whereas they're usually equal in the US. Neutral is the power company's ground, ground is you, the power company is likely lots of dry soil away.

Socks often crackle or sizzle too; some of that is on insertion, due to crappy oxidized sockets; some of it was ongoing, probably due to the ungrounded plugs. Oh, voltage is 240 here, too.


Books: Hans Brinker (abridged), Night's Master (Tanith Lee), Death's Master (ditto), Larry Gonick's Cartoon History of Universe/Modern World, Years of Rice and Salt.


I still don't have my laptop Linux in an ideal state, but I don't feel like complaining about it too much. Well, a bit. konsole's colors suck compared to gnome-terminal, and kde-plasma picked up an ugly orange color on highlighted items that I couldn't change. kde/openbox is better, though I had to edit a file to get my keyboard shortcuts. konsole doesn't open urls as conveniently, but gnome-termnal keeps resizing itself under non-gnome.

OTOH, I did get firefox to stop doing so, by turning off its Ubuntu and Unity addons, to no obvious loss of functionality.


Cooperative game we've played down here: Flash Point, nicknamed Fire Rescue. More intuitive actions than Pandemic. Apologies if I'm repeating myself.


The house is sitting on an ant colony or something, and they keep trying to invade. Two days ago I woke to them crawling over the power outlet and computer. We spray a lot, which works briefly.
mindstalk: (squeee)
Some years ago I played with Livejournal styles, and customized it to use a font I liked. I later found I'd been using Windows, and the Edwardian Script ITC I liked there for display wasn't on Linux, but then I found Elegante, and it was even better. And I found URW Palladio, a Palatino derivative, for the body.

But these aren't common fonts, and while I tried putting in alternatives, like URW Chancery L or Monotype Corsiva or plain old Times, it's not the same. So all this time the way I saw my pages and the way you saw them probably weren't the same. Actually, on my eee, it wasn't the same either, since I'd forgotten how to get the fonts I liked.

But now, that's changed! I've learned about @font-face, and thus can serve the free fonts I want for my website. That doesn't work as easily for Livejournal, because Firefox doesn't like cross-domain font serves, but Google Webfonts has EB Garamond and FF will take that. And then it turned out that the the .htaccess magic here works too, so I can serve Elegante through LJ (and DW). Which means I could serve the URW Garamond No. 8 that I found before EB and am using on my computer, too, but eh, EB seems as good.

(I'd submitted Elegante to Webfonts, and I even got a friendly reply despite my not owning the font like they ask, but they don't like GPL as a font license and would like the author to submit under OFL. The author is some guy in Spain, I don't know if the e-mail I found is even him, the one in the license bounces.)

(Note Elegante is GPL, in the ttf-linex package of Ubuntu and maybe Debian? EB Garamond is Open Font License, and Garamond No. 8 under some custom free license.)

And ttf2eot converted the TTF (TrueType) files to EOT, so IE can probably stay with us cool kids. I don't have IE to test it with, though, I can just use my eee to verify that things work on a Linux box without the fonts.

So I predict a radical difference on everyone else's computers when they look now.

This is also how I've been seeing *your* LJ pages; I use "use my style". (Which also means I still see subjects on comments.)

Now if I could fix my DW style. It's very pretty but the header image has duplication and legibility problems.

Side note: seems odd that the Times website uses Georgia instead of Times New Roman. Wikipedia says even the physical paper doesn't use TNR any more. Though I guess Georgia is related.

Edit: worth noting this is related to my question about what fonts people use, not that anyone responded.

October 2017

123 4567
89 1011 1213 14

Expand Cut Tags

No cut tags

Style Credit