Some Future in your Science Fiction

I finished reading Kim Stanley Robinson’s The Martians, on my Kindle the other day (the short review: It was great, I don’t know how I felt about the poetry at the end, but I liked the collection.) and promptly began reading this month’s Asimov’s. The first story is an alternate history/fantastic history/I-think-there’s-science-fiction-coming-but-it’s-not-here-yet, piece and I can’t bring myself to really read get into it. It’s well written, and I even find myself delighting at the text (in a technical sense.) I think the issue that I’m running into is that I don’t really get the alternate history thing.

Which is, you know, weird. I should break out and say that my fiction tends to be very historically concerned. I’m fascinated by history and there are a lot of historiographical themes and ideas in the stories I write. But they’re all set in the future, and try as I might, I don’t really have much interest in writing stories set in the past of our world. Alternate or otherwise.

Maybe it has something to do with my view of history. I tend to take a big picture approach to history and I tend to think that single events and single individuals rarely really affect history. If you called me a determinist I’d probably gnash my teeth for a few moments and then agree. Which makes constructing alternate histories sort of difficult. Add to that the fact that quasi-deterministic big pictures, though probably accurate and helpful, don’t lend themselves to good stories. When you don’t feel like your characters--any of them--have agency, it doesn’t make for terribly interesting story telling.

At least for me. I think other people can pull it off.

This whole “I want my science fiction to be set in the future,” thing isn’t something I can rationalize or support very well. Clearly I don’t find the past to be a very good “escape.” The future is fun, vast, and full of possibilities and enables the sorts of things that I enjoy most in science fiction: the ability to engage in a critique of the present, high energy stories with adventure, and for lack of a better term, stories that impart a “sense of wonder.” There’s more out there, I just can’t seem to muster the interest.

This isn’t to say that I don’t sometimes find myself enchanted by non-futuristic stories, it’s just not a terribly frequent or predictable sort of experience. I should also be clear, I’m not of the opinion that when science fiction stories talk about the future and are set in a future, that they are about anything except the present at all.

And I’m not terribly proud of this. I suppose we all have our things.

I worry that my tastes aren’t sophisticated enough, that I enjoy stories for the wrong reasons, or that I get too caught up in the scenery and forget to pay attention to what really matters. Despite this whole “writer thing,” that I have going on these days I don’t have very much formal training in literature. It’s sort of awkward to say “I feel like I’m not a very good reader,” that’s definitely something that I battle with.

For those of you who are part of the larger community of science fiction/fantasy/genre fiction readers (which I think necessarily includes writers,) I’d be very interested to learn your thoughts on this subject: how do you relate to the future in the stories that you write and read? The past? Alternate histories? Is there some connection that I’ve mostly failed to see? Am I not alone in this?

Thank you (preemptively) for your feedback.

Git Tips for Writers

The Context

git is this version control system that’s designed to be used in a distributed manner, and supports a very divers and non-linear workflow. While it’s designed to support the work of software developers--particularly in large projects like the linux kernel--at the core, git is just a file system layer that has an awareness of time and iteration. It also does its magic on any kind of text files… code or writing. I use git to manage a lot of my writing--indeed, most of my digital life, which is a bit weird admittedly; and as a result people on the Internet, not to mention my coworkers,come to me with git questions from time. This post is a response to a more recent change.

How I Work

I have two kinds of repositories: general repositories which store a bunch of different kinds of files that I need to work: the general repositories that store files that I always need to get things done, and specific project-only repositories that only have the text (and possibly notes) for a very specific project. I also have a “writing” repository where I do drafting for the blog, and start writing projects that I’d like to version, but are too small yet for their own project repositories. The brief overview:

  • garen is like my home directory within my home directory, and it has config files, scripts. and other daily essentials.
  • org stores my org-mode files.
  • fiction projects: I have five repositories in ~/ that store fiction projects, that I’m theoretically working on in some capacity, though I haven’t touched most of them regularly.
  • writing holds blog drafting, and a couple of not-exactly-fiction, projects that I’m not quite ready to admit exist.
  • website content: wikish, tychoish.com, cyborginstitute.com, the cyborg institute wiki and a few other website projects that I’m involved with have repositories to store their content.

The lesson here, about repository organization, is that git wants you to have distinct repositories for different projects. Its possible to merge repositories together (really!) and also to separate the histories of specific directories into their own repositories if you’re so inclined.

I write in emacs almost exclusively, I sometimes use magit, which is a delightful interface to git that works within emacs in a very emacs-centric way. If you use dired, magit will be familiar. Having said that, I mostly just add files, make commits and push repositories. Although I’ve been very interested in flashbake for some time, I’ve never really used it: it seems designed for people who aren’t used to version control or git, and the fact that I am means that it feels cumbersome to me. I suppose I should take this as a challenge, and attempt to hack it into something more usable from my perspective, but I’ve not felt the urge yet.

I use gitosis (but it’s in the debian repositories) on foucault (my server) to manage the publication of my git repositories. I push regularly, both to make sure that all of my machines are up to date, and also as a way of keeping my systems backed up. While I don’t take snapshots of my systems, I’ve been able to set up systems and been up and running inside of ninety minutes after reimaging a laptop without loosing a single bit. Although unorthodox, git is my backup strategy, and the restores work fine. I strongly recommend having your own git hosting set up. It’s not difficult, and while I think git hub is awesome on it’s own terms, independence and self sufficiency is really important here.

I don’t really take advantage of any branching and merging in git, though I’ve played with it enough to know how it works. I do have a branch in the repository for the novel I’m writing for an editor to be able to edit the novel as I write on it without needing to see their changes and comments until I get to that point.

And that’s sort of it. I use jekyll (or an old personal fork) and soon to be cyblog) as well as ikiwiki to publish content, but other than that, I just write stuff.

In any case, if you have thoughts on the subject I’d love to see your input on the wikish git writing page.

Write on!

iPad Reactions

Ok, as a self-respecting geek, I think I have to say something about this whole “iPad” thing.

I’m not as much of an Apple geek as I used to be, that’s for sure. It’s not that I don’t think that Apple’s doing something quasi-innovative and useful in the world of technology and the business around consumer technology. I think bringing UNIX to the hands of “mass market” desktop users was a great move. Although the iTunes Store is not without it’s issues and concerns, the fact that Apple was able to create a viable environment and market that allowed people to exchange money for software and content is probably a good thing. And Apple has brought to a general public a number of hardware configuration (in recent years) that I think make a lot of sense: the mini-tablet (iPhone/iPod Touch), laptops with usable battery lives, the pocket jukebox (iPod Classic,) and so forth.

Deep breath. Having said that… I’m not terribly impressed with the iPad, or moved by it’s potential at the moment. I know Apple often takes a few generations to make something really work, and so I think it’s important to not say “this implementation sucks, and so the whole notion sucks, and is with out merit.” Of all the things that I’ve heard (or said,) in the past few weeks of the iPad the following two threads have stood out:

  • I’m really quite interested to see what other makers are going to be doing in this space. What’s the Lenovo tablet going to look like? HP? One of the leading complaints about the iPad (and iPhone) is Apple’s total-lock-down over the platform, and I think an Android tablet, or a super Nokia N900 is likely to be much more open and killer awesome.
  • I’m interested to see what the iPad platform looks like in a revision or two. Add an SD slot? Multi-tasking? Additional input methods? It could look really awesome, and while I have misgivings (see below) I don’t want to write it off entirely.

At the same time, I don’t really feel like there’s an in-between device that I don’t currently have that I’d like to have. In a lot of ways, even I feel like I have too many devices, too many inboxes (of one sort or another), and too much technology to manage. I’m not complaining. The truth of the matter is that my laptop gets great battery life, isn’t very big at all, and does everything I need of a computer, and almost everything I need of technology in general. iPods are better for playing music if I’m moving around or in the car, and the Kindle is great for what it is, and I do sort of have a Blackberry habit.. but…

My technological challenge at the moment is that I don’t have enough time to get done that which I would like to get done, not that I have a situation where I could be more productive if I only I had a device that would do something more." That’s not something that seems to cross my mind very much. It might be nice to have a slightly more accessible emacs instance that I could use to enter snippets of text and work on things in the kinds of moment. I’m thinking a Nokia N900 might fit that bill pretty well, but I’m not sure.

If you’re thinking about getting an iPad, what’s the niche that you see it filing? Do you have a niche that seems like it might be iPad sized?

Status Update

Ok, a confession: I totally ran out of my usual backlog of blog posts, that keeps these pages humming with the signs of life despite the fact that I don’t have time to write a post every day, and often don’t have reliable weekend time to write blog posts. This hasn’t happened in a few months, so it’s sort of disconcerting. One of the reasons why I ran out, is that I’ve been busy doing non-writing things for a few weekends, but a third (or forth?) weekend away from home was too much for my backlog to bear, so here we are.

Here’s a brief overview of what I’ve been up to and the kinds of projects I’m working on, and what the near future holds:

  • I’m going to Dance Flury in a couple of weeks. I’ve not done the usual dance weekend thing before, aside from the Morris Dance gathering I’ve been going to for years. I’m really looking forward to it.
  • I’m trying to get a better handle on the blog. I do this binge cycle thing with my blog posts, that leads to situations like the one that I’m currently experiencing, but also doesn’t actually mean that I have spare time to write fiction in a way that I might like.
  • I’m working a bunch, and while every day is some kind of learning experience, I think I’ve figured out (largely) how to do what I do in a way that doesn’t have me leaving every night feeling like a fraud. There will be more learning curves, for sure, but it’s nice to not feel like I know what I’m doing.
  • I’ve been throwing around the idea of writing poetry (hynms) vaguely in the tradition of the sacred harp. I’m not much of a poet, and the project I have in mind is a little bit peculiar (but then, this is me we’re talking about, so lets not be too surprised.) At the same time I’m irrationally interested in this project, and we’ll see how it goes.
  • I switched to using Chromium as my primary browser. There are still a few plug-ins that I really liked on Firefox that aren’t quite as awesome or comfortable in their Chrome-equivalents, but it’s close and I’m sure it’ll get there. I’ve been looking for a viable non-Mac WebKit browser for a while, and am pretty happy with the Chrome.
  • Check out git for writers, wiki page that I’ve been working on over at wikish to try and explore how writers use and might use the git version control system to manage their writing. Contribute if you like.
  • This weekend (yay! snowpocolypse) I hooked up my laptop to my desktop rig, and have basically abandoned my desktop as a machine that I will interact with directly. (I’m a server guy, so it’ll get used.) This means I’m using xrandr with StumpWM (pretty swank,) and I must say that I love it. While I adore my laptop, and I really like only having to manage one computer, having this “desktop” setup makes it really perfect: I’m often most comfortable in desk chairs and I like the bigger screen and a real keyboard. So it works well. At some point I’ll write up a more thorough account of how I hacked this together.

Ok, this document has been open on my desktop for a few day and I don’t have anything new to add to it, so lets call it done.

Onward and Upward!

Putting the Wires in the Cloud

I’m thinking of canceling my home data connectivity and going with a 3G/4G wireless data connection from Sprint.

Here’s the argument for it:

  • I’m not home very much. I work a lot (and there is plenty of internet there), and I spend about two thirds of my weekends away from home. This is something that I expect will become more--rather than less--intense as time goes on. It doesn’t make sense to pay for a full Internet connection here that I barely use.
  • My bandwidth utilization is, I think, relatively low. I’ve turned on some monitoring tools, so I’ll know a bit more later, but in general, most of my actual use of the data connection is in keeping an SSH connection with my server alive. I download email, refresh a few websites more obsessively than I’d like (but I’m getting better with that), and that’s sort of it. I’ve also started running a reverse proxy because that makes some measure of sense.
  • I find it difficult to use the data package on my cellphone. The fact that I get notified of all important emails on my phone, has disincentivized me from actually attending to my email in a useful way, and other than the occasional use of googlemaps (and I really should get an actual GPS to replace that…) If I get the right Wireless modem, however, it would be quasi-feasible to pipe my phone through the wireless Internet connection, so this might be a useful clarification.

The arguments against it are typical:

  • The technology isn’t terribly mature, or particularly well deployed.
  • Metered bandwidth is undesirable.
  • Sprint sucks, or has in my experience, and the other providers are worse.

The questions that remain in my mind are:

  • How well do these services work in moving vehicles? Cars? Trains?
  • How much bandwidth do I actually use?
  • Is this practical?

Feedback is, as always, very much welcomed here. I’m not in a huge rush to act, but I think it makes sense to feel things out. It also, I think posses an interesting question about how I (and we) use the Internet. Is the minimalist thing I do more idealistic than actual? I know that we have a pretty hard time conceptualizing how big a gigabyte of data actually is in practical usage. Further research is, clearly, indicated.


Edit: This plan would have to rely on the fact that I might be spending a large amount of time in a city with unmetered 4G access with sprint. I’ve used a gig and a half of transfer to my laptop’s wireless interface in 5 days. I think that would coincide with when I would be doing the heaviest traffic anyway. I wonder how unlimited the unlimited is…

Decreasing Emacs Start Time

One oft made complaint about emacs is that it takes forever to start up, particularly if you’ve got a lot of packages to load it can take a few seconds for everything to start up. In a lot of respects this is an old problem, that isn’t as relevant given contemporary hardware. Between improvements to emacs, and the fact that computers these days are incredibly powerful, it’s just not a major issue.

Having said that, until recently an emacs instance took as much as 7 seconds to start up. I’ve beaten it down to under two seconds, and using emacsclient and starting emacs with “emacs --daemon” makes the start up time much more manageable.

Step One: Manage your Display Yourself

I’ve written about this before, but really even a 2 second start time feels absurd, if I had to start a new emacs session each time I needed to look into a file. “emacs --daemon” and emacsclient mean that each time you “run” emacs rather than start a new emacs instance, it just opens a new frame on the existing instance. Quicker start up times. It means you can open a bunch of buffers in one frame, settle into work on one file, and then open a second buffer and edit one of the previous files you opened. Good stuff. The quirk is that if you’ve set up your emacs files to load the configuration for your window displays late in game, the windows won’t look right. I have a file in my emacs files called gui-init.el, and it looks sort of like this:

(provide 'gui-init)

(defun tychoish-font-small () (interactive) (setq default-frame-alist ‘((font-backend . “xft”)(font . “Inconsolata-08”) (vertical-scroll-bars . 0) (menu-bar-lines . 0) (tool-bar-lines . 0) (left-fringe . 1) (right-fringe . 1) (alpha 86 84))) (tool-bar-mode -1) (scroll-bar-mode -1) )

(if (string-match “laptop” system-name) (tychoish-font-big))

Modifying, of course, the system name, and the settings to match your tastes and circumstances. The (if) statement allows you to have a couple of these -font- functions defined and then toggle between them based on which machine you load emacs on. Then in your init file (e.g. .emacs), make sure the first two lines are:

(setq load-path (cons "~/confs/emacs" load-path))
(require 'gui-init)

Establish the load path first so that emacs knows where to look for your required files, and then use the (require) sexep to load in the file. Bingo.

Package Things Yourself

We saw this above, but as much as possible avoid using the load function. When you use load emacs has to (I’m pretty sure) do a fairly expensive file system operation and then load the file and then compile and load the file. This takes time. Using the require function is not without it’s own cost, but it does save some time compared to load because it lets you take advantage of the work emacs does with the library loading. At least in my experience.

In your various .el files, insert the following statement:

(provide 'package)

And then in your .emacs, use the following statement

(require 'package)

To load it in. You’re probably already familiar with using these to configure packages that you download. Better yet, don’t require at all, but use the auto-load function. This just creates a little arrow inside of emacs that says “when this function is called, load this file, and hopefully the ‘real’ function by this name will be in there.” This lets you avoid loading packages that you don’t use frequently until you actually need them. The following example provides an auto-load for the identica-mode:

(autoload 'identica-mode "identica-mode.el" "Mode for Updating Identi.ca Microblog" t)

Byte Compile files as much as you can.

Contrary to whatever you’ve been told, emacs isn’t a text editor, as much as it is a virtual machine with a good deal of low level functions established for interacting with text and textual environments and some editing-based interfaces. But really at the core, it’s just virtual machine that interprets a quirky Lisp dialect.

The execution model is pretty simple and straightforward, particularly to people who are used to Java and Python: you load source files, emacs imports them and compiles them half way, they’re not the kind of thing that you could read on your own or would want to write, but it’s not quite machine code either. Byte-compiled files are easier for the machine to read, and quicker to process, but they’re not human intelligible. Then when you need to do something with the function that it’s byte-compiled, emacs compiles it the rest of the way into machine code and executes it. Usually this all happens too fast that we don’t really notice it.

One tried and true means of speeding up emacs load times is to byte-compile files manually so that emacs doesn’t have to do it itself when it loads. The emacs-lisp libraries are byte compiled when emacs installs itself, but your files probably aren’t. Now generally, only byte-compile files that you’re not going to be editing yourself regularly. Byte compiled files have an .elc extension, and as soon as there’s a .el file and a .elc of the same name in a directory, emacs will ignore the .el file even if there have been changes made. To byte compile an emacs-lisp file, simply type M-x to get the execute-extended-command prompt, and then run the function byte-compile (i.e. “M-x byte-compile”). Viola!

I hope these all help you all and lead to a slightly more efficient emacs experience.

Winter Break in Reality

I meant to write a more thorough overview of what I was doing with the “extra time” over the holidays. But I don’t think I had as much extra time at the end of the year as I expected to have. What follows is a brief overview what I did do, how the new year has begun and what I’ve been thinking about.

In years past the time at the end of the year was a time to catch up on lost sleep and connections that had fallen by the wayside in the recent months. I also used the time, in some years, to get a lot done: one year I knit about 10 hats. Another, I wrote about a quarter of a novel on a binge. Some years I just vegged.

This year, is different. I haven’t been in school full time for years, and I haven’t received any college credit in a year. I didn’t have significant time off of work. There’s a way in which the holidays were incredibly relaxing. I still have a bunch of friends who are in the later stages of being students, and there’s something awesome about not being a student that’s incredibly relaxing. I mean, working a regular job is not all sunshine and rainbows, but it’s pretty swell, and there’s something about the structure of regular and the mostly even routine that makes it--to my mind--have a greater potential for productivity than “the academic routine.”

In a lot of ways, while I looked forward to holiday time off, and saved up countless projects for that time off, not only did I not make “epic headway” on my projects but I came into the new year feeling sort of behind and tired. Wierd. I blame this on the holidays themselves. It’s as if the entire world slows down: everything gets more difficult for a month or as if the planet is slowly careening to toward this thing that we don’t really enjoy (if we’re being honest,) but that we pretend we really love.

And there’s no getting away from it. You can’t really opt out of the holidays: even if you’re not particularly festive, you can’t control the celebration of other people. You can’t control the fact that the same four songs play on endless repeat in public spaces, you can’t control that everyone wishes you a good holiday, you can’t control all of the federal holidays, you can’t escape tacky decorations, you just can’t escape. And after like 3 days of this, you get tired.

In previous years, the break, the chance to take time off from the big projects I’d been working on (school, applying to graduate school, etc.) was a great opportunity to get “other things done.” Now, there’s no real break from the daily grind, just modulations and finding good balance. That’s an ongoing project, and one that’s better serviced by a good routine and not a few extra days off during a stressful time of year. In any case, I’m glad to have gotten back into things, and I look forward to getting things done.

Onward an Upward!

Wikish and the Personal Public Wiki

First, an announcement. I’ve started a tychoish.com wiki. I’m calling it, appropriately enough “wikish.” You can see a brief introduction and note about my intentions there.

I’ve written a bunch here about the peculiarities of building communities and practices around “the wiki,” as I think it represents a new paradigm for thinking about collaboration and “the text.” I’m, slowly, working on building a community around the cyborg institute wiki, and that’s an ongoing (and fairly specific) project. I’ve also, in much smaller ways, done things with wikis in a couple of other situations: for some group projects I’ve been involved with, a few things for work, and so forth. Perhaps more relevantly, I also used a wiki--much like this one and the others I am responsible for--as the system I used for storing everything in my brain. From these experiences I’ve come to the following conclusion:

  • In any given wiki, most of the “work,” particular at the beginning, is accomplished by a very small number of contributors. Potentially only one contributor.

    Critical mass is a difficult thing to manage or predict, and if you start a wiki and you want it to succeed, you have to be ready to do all of the work of getting it to critical mass, which could take a long time. Fair warning.

  • Wikis are incredibly unstructured. It’s easy to impose structure on a new wiki, in cases where structure will actually hinder growth and development rather than promote development. Particularly if the kind of content you hope to develop is wiki like. For personal organization tasks, wikis are often not the right answer, even if they appear to work for a long time.

  • Creating a page in a wiki is often better and more effective than writing an email of some length (say, more than 250 words), particularly when more than two people are involved in the correspondence.

  • I need another wiki like I need a hole in the head. But, I like that wikish is both public--you all can watch and contribute to what I’m working on--and focused on what I’m working on. The personal wiki, the one that was just for internal use suffered from lack of audience even an imagined audience.

  • I think putting the novella that I wrote in late 2007 into a wiki and working on revisions and tweaks in that context makes a great deal of sense, and I think wikish feels like the “right place” to put that work.

So that’s the plan. I’ll probably post from time to time about new things that I’m posting there, and I’m perfectly happy to have you all make pages in wikish as you want. I’ve also decided, that wikish will require OpenIDs as the only means of authentication. Just cause. See you there!

Independent Web Services

So much of the time, when we talk about network services, technological/software freedom, and this idea of “Cloud” computing, there’s a bunch of debate: “is it a good idea?” “are we giving up too much freedom?” “how does this work out economically?” “what about privacy in the cloud?” While these are important questions, without doubt, I fear that they’re too ethereal, and we end up tussling with a bunch of questions about the future and present of computing that might not be entirely worth debating (at least for the moment.)

Lets take 2 assertions, to start:

1. There are some applications--things we do with technology--that work best when these applications are running on high performance servers that have consistent connections to the Internet, that we can access regardless of where we are in the world.

2. The only way to have control over your data and computing experience is to be responsible for the administration and maintenance of these services yourself.

Huh?

I mean to say, that if we care about our autonomy, and our freedom as we use computers in the contemporary age (i.e. in the era of cloud computing), the only thing to be done is to run our own services. If the fact that Google has all of your data scares you: run your own mail server. If the fact that all of your microblogging output is on twitter, run your own status.net instance. And so forth.

If we really care about having power over our technological experiences, we must take responsibility for services on the Internet. We can say “wouldn’t it be nice if service providers weren’t such dicks with our data,” or “wouldn’t it be nice if software developers wrote networked software that respected our freedom.” And while it would be nice, these convinces don’t in and of themselves

Control over technology and autonomy in the networked context ultimately means that we as users have to:

  • Administer networked servers that provide us with the services that we want and need to do whatever it is that we do.
  • Participate in some exchange for networked services (i.e. pay for service, either in cash or by way of access to data.)

That’s hard! Computers should get easier to use not harder, right?

Leading question there, but…

Yes. One of the leading arguments for consumer-“Cloud Computing” is that by accessing computer services (software) in the browser, developers can provide a more structured and “safe” user experience. At least that’s how I understand it.

While this is a great thing in terms of making computers more accessible, no argument from me, I think we must be careful to avoid confusing of use" with technologically limiting. I fervently believe that its possible to design powerful software that is also easy to use, and I think that as often as not, a confusing technology is an opportunity to provide a teaching experience as much as it presents an opportunity to improve a given technology.

And if it comes down to it, there are situations where it doesn’t matter so much if you’re the one entering the commands into the server. It doesn’t much matter if you are the one managing the server or if you’ve hired someone to configure it for you. As I think about it, there’s probably something of a niche here for people to offer management services in a very boutique sort of style.

If we have to contract to people to do our administration for us, is that really a step in the right direction?

I think, it is. At the moment we pay for our networked computing services (i.e. gmail) by looking at google’s ads next to our mail and giving Google access to the aggregate of our mail spools so that they can mine it for whatever data they need. The other price that we pay for these services is “lock in:” once we commit to using a service it’s quite difficult to change to an alternate provider. Since these are “real costs,” it seems reasonable to expect and want to pay (money) for services that don’t have these costs. Which is where cooperative and boutique-style services make a lot of sense.

I’m not a systems administrator, I just want to do [the thing that I do] and not have to tinker with my computer. This is a lousy idea.

And that’s a lousy question.

To dig in a bit further. I don’t think that “doing the [whatever you do],” would necessarily require a lot of tinkering. It might, of course, and the chances are that we’ve all had to tinker with our technology at one point or another. In most cases tinkering is an upfront rather than ongoing cost. Ideally, the other thing that having full control over your network services you’ll be able to use have services which are more tailored to [the thing you do] than the one size fits all application provided by a third party.

Ok, so what’s the stack look like.

I’m not sure. There’s clearly a common set tasks that we currently use in the networked context. I’m not sure what the application is, exactly, but here’s a beginning of what this “application stack” looks like.

  • An XMPP Server like Prosody.im, with PyAIMt and other convectional IM network transports.
  • Some sort of Email Service: Citadel springs instantly to mind as an “all in one solution,” but some postfix+procmail+fetchmail+horde/squirrelmail seems to make some sense
  • A web server, either for hosting personal websites, or with some sort of authentication scheme (digest?) for sharing files with yourself. The truth is that web servers, are pretty darn lightweight and it doesn’t make sense to not install one. Having said that, people see “web hosting,” and probably often think “Well, I don’t really need web hosting,” when that’s almost beside the point.
  • SSH and some system for FUSE (or FUSE-like) mount points, so that they can use and store remote files.
  • There’s probably a host of web-based applications that would need to be installed as a matter of course: some sort of web-based RSS reader, wiki-like note taking. Bookmarking. Some sort of notification service, Etc.
  • [your suggestion here.]

Bash Loops

I was talking with bear probably two years ago, about programing and how I’m not really a programmer, but I understand what’s going on when programmers talk, and that any time I got close to code, I sort of kludged things together until it worked. This was probably long enough ago, that I was just on the cusp of getting into using Linux full time and being a command line guru.

Of shell scripting, he said something that left something of an impression on me. Something like, “The great thing about the shell, is once you figure out how to do something you never have to figure out how to do it again because you just make it into a script and run it again when you need to.”

Which, now seems incredibly straightforward, but it blew my mind at the time. The best thing, I think, about using computers in the way that I now tend to, is that any time I run across a task that is in anyway repetitive I can save it as a macro (in a non technical sense of the word macro) and then call it back in the future. Less typing, less reading over help text, more doing things that matter.

One thing that got me for a while, was the “loop” in bash. I had a hell of a time making them work. And then a few weekends a go I had a task that required a loop, and I wrote one on the command line, and it worked on the first time through. Maybe I’ve learned something after all. For those of you who want to learn how to build a loop in shell scripting, lets take the following form:

for [variable] in [command]; do

   [command using] $[variable];

done

Typically these are all mashed up onto one line, which can be confusing. Conventionally [variable] is just the letter i, for “item.” Note that the semi colons are crucial, and I think the bacticks are as well (I’d not leave them out,) but they might not be required.

So the loop I wrote. I noticed that there were a number of attempted SSH logins against my server, and while these sorts of SSH probes aren’t a huge risk… better to not risk it. So I wanted to add rules to the firewall to block these IP addresses. Here’s what I came up with:

for i in
  `sudo egrep 'Invalid user.*([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}' /var/log/auth.log -o | \
  egrep '([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}' -o | sort | uniq`;

do

   `sudo iptables -I INPUT -s $i -j DROP`;

done

Basically, search the /var/log/auth.log for invalid login attempts, and return only the string captured by the regex. Send this to another egrep command which strips this down to the IP address. Then put the IP addresses in order, and throw out duplicates. Every item in the resulting list is then added to an iptables rule that blocks access. Done. QED.

It’s inefficient, sure, but not that inefficient. And it works. Mostly this just cleans up logs, and I suppose using something like fail2ban would work just as well, but I’m not sure what kind of added security benefit that would offer, and besides it wouldn’t make me feel quite so smart.

I hope this is helpful for you all.