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.

birthday stuff

2017-May-09, Tuesday 21:30
mindstalk: (riboku)
I haven't been good at making birthday plans since moving to Boston, but today was good. I went in to work late, expxloring Malden center instead; the library had been described as distinctive, and it does have an older building, though Cambridge main it's a Franken-building. Unlike Cambridge, you can't even go into the older part right now. I took a picture, but the margin of this post is too small to contain it[1]. I also discovered that Malden and Chelsea are affiliated with BPL, not Minuteman. Checked out a book on Angkor and one on Armenian history, I keep running into Armenians.

Some cheap restaurants present but I didn't feel hungry until right after I'd decided to set out for the station. >.< Like the rest of the Orange line, all the interesting stuff is like 10 minutes from the station.

I found another bug at work, not in my code[2]. This is good insofar as we improve the product and I get a reputation as a magical bug finder.

As it happens, in honor of the release, boss was taking us out to a fancy dinner, so I got a big thing without actually mentioning my birthday. $55 New York strip au poivre medium rare, quite good. Some other food too but it's a steakhouse, steak's where it's at. That's about as much as I've ever paid for an entire meal, back when I was working in SF and getting dragged off to some fancy places rarely. Usually $20 is my cap. But hey, wasn't paying!

Couple of Facebook people went above and beyond and sent cute and/or appropriate pictures with their greetings, and J texted me in lieu of calling, which was good because this wasn't a day for calls.

Oh right, a cute thing at work! I was wearing a Kyuubey shirt I got at Anime Boston this year, the first anime T-shirt I've bought. A guy complimented me on it, then I noticed he was wearing a FMA hoodie -- the complex circle on the front looked suspicious, but the squiggle on the back really gave it away. Demographic note: big black guy.

[1] Or I'm too lazy for my picture transfer workflow.

[2] So far I've barely written any code, apart from a logging module and a Frankenscript, it's been all learning tools and code and testing. And honestly I'd like to keep it that way, until I can read 13,000 lines of code and sort through testing them properly. brrr Python. My ideal gift right now would be a compiler.

Google fail

2017-May-07, Sunday 13:37
mindstalk: Tohsaka Rin (Rin)
I was trying to pick up my Japanese studies again, and turning to Google Translate as a way to get some daily phrases. "A bowl of rice" was given the plausible characters 米のボウル, but transliterated as "Amerika no booru". Cooked rice (kome) and America do share a kanji, but you wouldn't read it that way!

I shared with my friend in Japan, who laughed, then said you wouldn't read it as "Amerika" even when talking about America.

Also that "kome no booru" was like a bowl made out of rice (plant) or something, and not something you'd say; instead you'd use "ichizen", ichi-zen, zen being an oddly specific counter for bowls of rice or pairs of chopsticks.

So, multiple levels of machine translation fail!
mindstalk: (Default)
Brought up in discussion on RPG.net: Lorien had a ship he used to take Sheridan away from Z'ha'dum, but at the end of the series he went all lightbulb. Possibilities:

* He's an interstellar lightbulb, but needed something to bring the mortal safetly.
** ...so he just happened to have his own ship all along, which he later abandoned.
** ...so he 'borrowed' one from the Shadows or their servitors. This was my idea, and it amuses me.

* Advanced races only went interstellar lightbulb when "going beyond the Rim". Also my idea, and it seems more boringly plausible, given that the First Ones use ships usually.

MBTA passes math

2017-Apr-30, Sunday 08:11
mindstalk: (Default)
Say you're a regular commuter, taking transit at least twice a workday. 10 trips, which would cost $22.50 if you're using a CharlieCard. A 7 day pass is $21.25, so it totally makes sense to buy one, then ride the T whenever you want. Even if you somehow had a 4 day workweek, having a couple more trips would be likely.

Four 7 day passes would be $85; a monthly pass is $84.50. So that makes sense too. Or does it? Say you have three weeks of vacation, and leave town for them; maybe you'd save money by just cycling 7 day passes, and skipping the weeks you're gone.

I approached the math from a couple different angles, but this presentation seems best: a month pass costs about the same as 4 weeks, so 12 monthly passes covers the year for the cost of 48 weekly passes. Even if you skip 3 weeks, you'd still have to buy 49 passes... plus covering that extra day (or two, if leap) in the year. So go monthly!

Though, having been using 7 day passes, I noticed that they actually shuffle forward. If I buy one on Monday morning, the next Monday I can leave a bit earlier and still use it, buying (or activating) my next pass Monday evening. And so on. The effect is that you end up covering 30 days for the cost of 4 passes, as each one picks up an extra "half-day" commute. And if you shuffled into buying a pass on a weekend, well, maybe you could skip travel that day and save an extra day.

Of course, there's a week's worth of 31 day months, so there's that -- you're not quite getting a month's worth for 4 passes.

It's nice doing estimations in my head, but at some point you have to turn to a calculator for precision. A year's worth of monthly passes is $1014. If you cover 30 days with 4 weekly passes, that's $85 per 'month', and $1020 to cover 360 days, with 5 more days to finagle. OTOH, if you can skip 3 weeks, you'd spend just $956.14 in a year, saving $57.75. Or $42.57, if you threw in 5/7 of another pass for the extra days.

Of course, that assumes you can maintain the shuffle. Weekends offer skipping a day, but a regular weekend thing might pin you down. Say I activate a pass at 8pm Sunday to go to Grendel's; the next week I might leave earlier, but I'd still have to activate a new one at 11:30 to get home. The week after that I could leave Grendel's a bit earlier, activating the next pass on Monday morning... okay, it still works, though Sunday feels a bit sticky due to the short 'commute'.

Of course, the monthly pass means not having to buy stuff every week, nor worry once a week about the timing of when you do things. OTOH, saving $40 to 60... well, it's not a ton, but it's not trivial either; 40/1014 is 4%.

Extra thought: if you really use the weekends on your one-week vacations, you could save another 2 days each, or 6 days total, in effect skipping another week.

As for me, if I had today off I'd probably just go monthly. Annoyingly, I probably have 4 or 5 trips to make today. Cash today and monthly tomorrow, or weekly today?

***

Meanwhile, the $12 daily pass is hard to justify unless you run around a lot. Even for a tourist spending $2.75 per trip via CharlieTicket, it costs more than 4 trips -- though if you're doing train/bus transfers that becomes a lot easier to justify, since the Tickets don't give a free transfer. But even then you'd d need bus/train, bus/train, and one more trip. For a Card user you'd need to make 6 independent trips to make a day pass economical. Most likely use case would be having to make multiple quick trips along a train line.

On recent bouncing

2017-Apr-29, Saturday 21:48
mindstalk: (Homura)
Twice cast out, shy of permanence, I roam the 'hoods of Boston.

Hilton was horrible to a friend. Her compensation? Three nights downtown for me.

Oak Grove home, great view.
Reason? Same as price: a steep slope
And slippery icy death.

Oak Grove, land of giant parks.
Malden Center, land of small shops.
Which is more alive?

Life in Orient Heights:
East Boston famed for plane noise
Home eerily quiet

In Cambridge, geese walk the River
In Revere, planes fill the skies

"No one takes the Blue Line", say Cantabrigians
Just poorer and browner people
Who enjoy working trains.

Blue Line stations clean, bright, spacious
Are they a real subway?
Red Line gut says no.

From a plain dark box, with two forks and no can opener,
To a home full of rugs, plants, and Buddhas.

If you meet Buddha by the catbox
Try not to piss on him.

Springtime paradox:
Plants have sex by wind pollen,
I hide indoors.

Jamaica Plain green and quiet,
Land of vegans, queers, Dominicans.
Co-worker fears crime: "Please don't die!"

One hostess: absent, unmet.
One hostess: garrulous and gift-giving
One hostess: fleeing to China.

Orange Line, Blue Line, Orange Line
Not a Trader Joe's for miles.
Just great Mexican food.

life stuff

2017-Apr-23, Sunday 16:57
mindstalk: (Default)
I'm still nomadic in housing. Since leaving a friend's free basement, I've stayed in a downtown hotel, near Oak Grove (tip: prefer Malden Center), a Cambridge co-op, Orient Heights (a bit too quiet), and now in JP. I sample a range of housing as well as neighborhoods, from "motels have more character" to "totally decorated in plants and Buddha statues". In May I'll be by Malden for a month; be nice to stay somewhere long enough to make it worth buying olive oil.

Job progresses. Friday not so much: I put in some USB sticks, wanting to extract my VM image. Two of these I know worked in this laptop before. But one never became visible, the other had most of its structure missing. I tried rebooting... and the Windows laptop refused to reboot. "Required device not available". My co-workers had never seen that before, though some people on the Internet had. Unclear why it happened. My boss had been diligent in saving and labeling stuff, and was able to launch a repair process, though I had to make a trip to Braintree. (Too suburban for me.)

I can say proudly that the only thing at risk was a tool to work with; I've been good at ending the workday with no information uniquely on my laptop.

Entertainment: slowly re-reading Hodgell. Wikipedia pages on Catullus and Ovid, and linked pages on various forms of rhetoric. Watching episodes of Ghost Stories (the black comedy anime dub) with people.

US air marshalls

2017-Apr-22, Saturday 14:37
mindstalk: (Default)
"Someone forgets their gun" isn't that newsworthy; people make mistakes. This article is more interesting for the other terrifying information it includes:
"newly hired air marshals do not currently receive on-the-job training"
"Although it has an $835 million budget, agents cover less than 1% of US domestic and international flights"
"A CNN report in 2015 exposed the long hours, chaotic schedules and use of drugs and alcohol among federal air marshals"
"obtained a now-classified study commissioned by the TSA that revealed 75% of air marshals flying domestic missions were sleep-deficient"

I like that 'now-classified' bit. "Oh god, they found problems. Let's classify it so people can't see!" This is also part of why it's hard to take "leaked classified information" as an inherent civic sin.

http://www.cnn.com/2017/04/21/politics/air-marshal-gun-airplane-bathroom/index.html
mindstalk: (Default)
One possible categorization of train stations:

* You emerge, and are immediately in a business district or otherwise interesting area. Examples: Central, Harvard, Porter, and Davis Squares on the Boston Red Line, along with Charles/MGH and Quincy Center; Kimball on the Chicago Brown Line; almost any downtown station, at least in a healthy downtown during the workday; Maverick, Orient Heights, and Beachmont on the Boston Blue Line.

* You emerge, in a parking lot or bus station or other thing that involves a fair bit more walking, but at least can see where to go toward something interesting. Examples: Fields Corner on the Boston Red Line, where you're at a long bus stop but can spy businesses; Assembly on the Boston Orange Line, where I think you'll have to walk a block but you can see the TOD from the station; maybe Wellington, where IIRC you have to walk through a big parking garage to the TOD, but there might be signs telling you to go.

* You emerge, and see no reason not to turn around and catch another train somewhere else. Examples: some Jamaica Plain Boston Orange Line stops, where you come out to a bridge surrounded by traffic; some stops on the south branch of Chicago's Blue Line, where the train runs in a freeway median, and you come out onto an overpass, and there's nothing around; Braintree on Boston's Red Line, where after two minutes on a ramp I still hadn't even left the station yet, and couldn't see anything but giant boxy buildings; I suspect Malden Center on Boston Orange, where you're not far from Malden's center but I'm not sure you'd see it; likewise Sullivan Square on Boston Orange, where the most interesting part I know of is hidden over a rise.

Note that can include "there is stuff but you don't see it" and "there's pretty much nothing around, for real."
mindstalk: (atheist)
It's a small thing in the world, but I feel compelled to counter-act their revisionism. For once, posting is direct action! http://www.sacbee.com/news/local/article71659992.html

huh

2017-Apr-12, Wednesday 08:46
mindstalk: (Default)
post-icon: robot
post-tags: random

Huh, a forged e-mail from a different account didn't seem to work.
Nice.
mindstalk: (Default)
So yeah, I was exploring settings, and I stumbled onto this here:
https://www.dreamwidth.org/manage/settings/?cat=mobile
https://www.dreamwidth.org/manage/emailpost?mode=help

There's even a version for using PGP/GPG signing as authentication,
rather than a cleartext PIN.

Forged mail test

2017-Apr-12, Wednesday 05:43
mindstalk: (Default)
How secure is an approved address?
mindstalk: (Default)
Speaking of aggravating values of fun... I foresaw a day of boring editing in my future? Well, I managed to make that half a day. I'd looked for programmatic solutions but they all seemed half-assed in bad ways, especially in breaking the logging information (filename, function name) we want. So I went through by hand... and a good mastery of vim commands and maps. It's funny, I haven't had to make a new vim map in forever, but the skills are there.

Samples: (Edit: all the [] should be angle brackets; I forgot how Dreamwidth swallows them.)

map CP :s/,/+/g #turns commma to plus, down a line
map KE cwkinnlog.error([Esc]A)[ESC]CP
#changes word under cursor to 'kinnlog.error(', appends ')' to line, invokes CP
map KX cwkinnlog.exception([Esc]A)[ESC]CP
map fp /print^M # fast search for 'print', since CP changes the current search to ','
map St istr(^[ #inserts 'str(' and goes back to command more.
map stt a)^[ #inserts ')' and goes back to command more
map kld cf(kinnlog.debug(^[ #changes everything from cursor to a '('

I got to show off more simply last week, too; I was setting up the product for Co-worker, and had to edit the IP address in a bunch of files.
$ vi *.json
/[IP 1]
C[IP2]",
n #search next
. #ditto
:wn #write, move to next file -- which preserves all the state, so I can keep going 'n' and '.'

She was impressed by my speed. (If you're wondering why not regexes, there were only 1 or 2 addresses per file, this seemed as fast or faster as recalling a ':%s/...')

*******

All that said and done... Python makes it easy to write code. Python has an awesomely nice standard library, including a logger module with many handlers like RotatingFileHandler. Python makes it easy to rip out the guts of a stub logging module and replace it with something sophisticated.

Python 2 has a print statement which can take an indefinite list of things, and print them all, without any type information.

Python 2 does not provide any function that does something similar, so converting from those print statements to calls to actual logging functions was terribly painful and/or un-typesafe. I mean, a lot of the time I can't tell easily what the type of the value of a variable is where it's being used. Granted you can wrap almost anything in 'str()', and maybe I should have been more thorough about doing just that. Python doesn't have a compiler, and as long as it's basically syntactically correct, will be happy until it tries to actually execute the code. I really hate this.

So yeah job

2017-Apr-11, Tuesday 21:16
mindstalk: (Nanoha)
I haven't been practicing tight infosec and have leaked a lot, but here's Ye Officiale Announcemente: I have a job. Started a bit over four weeks ago. I wasn't shouting about it because I felt traumatized after over a year of searching, and takebacks-shy after December's "we'll tell you we'll make an offer, then disappear" firm. Plus a bit of paranoia about whether I'd be out of work-shape and get into trouble. But I've gotten my second paycheck, so this seems real and ongoing. They can pay me! I can keep earning getting paid!

It's a tiny startup, I'm literally the first person to get paid in money and not just equity. Back-end work on a web services (more or less) company, with C++ in my distant future, but right now lots of Python. After lots of virtual machine wrangling (see previous posts.)

I've been learning a lot, it's been fun[1], I like my boss and co-worker, and the hours are agreeably flexible for someone with sleep disruption and a nomadic existence.

[1] For somewhat aggravating values of fun.
mindstalk: (food)
I'm staying on the Blue Line for a couple weeks. Lots of Hispanic food stores, and I got some Goya pork skins. I looked at the nutrition label, as I do.

"Protein: 8g Not a significant source of protein."

Dudes, that's like a whole serving of protein. Something's off.

Well, supposedly 14 g to a serving, 8g protein, 5 g fat, 80 calories, 50 calories from fat... that's a pretty consistent set of numbers, if we assume dried skin is basically nothing but protein and fat, which seems reasonable. So I'm inclined to believe that the 8g is accurate, and the "Not significant" is BS.

Unless there's some subtlety like it's indigestible protein. Wikipedia instead says that it's an incomplete protein, very low in some amino acids. So, don't try to live on pork skin, I guess.
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.