Archive for the ‘English’ Category

Quite a while since I wrote a post now, I’ve not been sick or anything, but there has been a lot of work abound, and outside work I prioritized sleeping over writing. But now I’m back for the moment, so let’s get down to business

Since last time I’ve come up with new ways of abusing awk, such as having it find the highest value from a command outputting in the following syntax:

\t<characters, integers, fullstop>: <integer>\n

To make it a little more different, the command also spits out a header, as well as an additional newline after the end of output.

I just now, while writing this, came up with a different solution, which doesn’t use awk:

Sadly I think this is used way too much, i.e. decide what new law you wish to impose, then come up with something ten times worse, and all of a sudden, the thing you were aiming for sounds reasonable in comparison…

Perhaps this should be spread around more to decrease the risk of misunderstandings?

And finally some programming-“related” things:

Programmers are optimists: This can be read as a quip about the deficiency in programmers with always overestimating their abilities and underestimating the problem, but the last lines paint the post in a somewhat different light

I never understood how useful bash someFileContainingCommands could be until week when I had to rename a couple of files in a couple of directories and didn’t have my usual set of tools (qmv would have made this so easy), so what I ended up doing was:

There has also been a great many things written about programmers, specifically who should or shouldn’t become one:

Jeff Atwood wrote a really nice post, and while I don’t agree with everything he says he is making some good points. I do however firmly believe that there are a great many mundane tasks today, being performed manually, needlessly I might add, since with the right thinking and just a little knowledge, the tasks could be automated. CaseinPoint.

Anyway, Jeff’s post spawned a greatmanythoughtfulreactions. All in all I think it was a good thing to publish that post. Lots and lots of great replies and comments.

I do personally believe that more and more of our world is being governed by digital technology, and a better everyday understanding of how programs are constructed and what the basic concepts are, could never hurt. Hell it might even make it easier to formulate in better words what is going wrong when you call tech support. (“It crashed” vs “It crashed after I instructed it to iterate over these filenames”)

If you do end up wanting to give it a shot, how should you go about it? Adjust your expectations and prepare for inevitability

Looking at the solution, I am kindof ashamed that it took me that long to get a workable solution…

I also found this neat little oneliner in a comment on reddit: echo "something long and space separated of which you want the last word" | rev | cut -d ' ' -f 1 | rev. Then again, I’m sure that awk could have done this with a little $(NF-1) magic or something like that.

The headache-inducing stuff

All since my netbook broke down, I’ve thought about two things: restoring the netbook/replacing it, and how to create some form of backup infrastructure which should be better than what I have in place today.

As for the backups, the “system” I have today is couple of USB-disks which I at times plug in and sync files to. That and most of my projects and config-files are in various git repositories all synced to the laptop/server-in-the-wardrobe which I made sure to backup after the netbook died, especially since the laptop/server disk is much older than the netbook disk was.

Another thing which bothers me with the current solution is that I have no off-site storage. And that would be nice to have. Belt AND suspenders of course, and off-site storage comes with its own set of problems such as trust in the offsite storage maintainer.

I think the solution will take the shape of a GNU+Linux box and Unison and possibly aided by incron. Not sure yet, will have to think more about it.

There are some other requirements which I have just barely scratched the surface of or not even begun thinking about yet, for instance it would be nice to be able to backup my parents stuff as well on a regular basis as to keep their stuff safer as well.

And as for the netbook, although it was a nice little machine, the keyboard was getting a bit worn out, and at times it was rather underpowered with its single core 1.6GHz atom processor, so the direction I am looking in now is towards something like this.

The stuff screwing over society

This sure is some level-A grade retarded society we are constructing for ourselves…

Samsung Galaxy S3: The first smartphone designed entirely by lawyers, a great read about a truly depressing matter which probably is closer to the truth than we imagine. On the other hand, my personal opinion is that the midnight blue version looks pretty damn sweet.

SaaS and other crap where someone else is in control sure is a honking good idea, isn’t? Well, I guess it is if you’re the one in control, but I guess you won’t ever get my business…

The cool stuff

And I also managed to find some posts which touched the hacker in me, such as this post about how one could go about generating pseudo-random numbers (don’t use the algorithms, just be inspired by them) or how this guy started shaving bytes off of his “hello, world!” binary.

I immediately thought about FSCONS when I read this, and I didn’t feel at all worried about people thinking the same about our conf

Until the other day, when I read about its inclusion into git, I’d never even heard about git subtree, but this post makes a compelling case for looking into it.

I also came across a, to me, new data structure: the XOR linked list. Now, it has a couple of drawbacks, and I don’t think I’ll find much use for it, ever, but as a concept it is a very interesting idea, and just goes to show that XOR is frakking awesome.

This is actually quite neat: Instead of adding “lorem ipsum” paragraphs all over your design, tweak the word list in the script, include it in the mockup, and markup all places which need filler content. Done.

In the latest issue of DatorMagaZin there was an article about FUSE which caught my eye, and having read the article my interest was piqued, so I just had to go look at the list myself, and truly, have you seen all the cool filesystems people have come up with? Frakkin’ awesome!

Just found this out, and thought it may benefit someone else, so here you go

In my netbook install of Archlinux I was running out of disk space on / because the package cache (/var/cache/pacman/pkg/) was always filling up with old versions of packages. The reason for this obviously being that whenever I would upgrade a package, it wouldn’t be until next reboot I’d know if something was amiss or not, so pacman -Sc wasn’t really an option. And at next reboot, did I remember to run pacman -Sc? Of course not.

But, as it has been said before, and will be said again countless times: the arch wiki is fantastic!

Take for instance the pacman page, where it gives a hint that if you don’t really like pacman -Sc, you could try cacheclean (found in the AUR).

It takes at least one parameter, or, I guess, two at the most. The required one is a number, indicating how many previous versions you wish to keep. And on top of that you could add -p for preview, in which case it will only simulate removing the packages, and instead printing their names, so you have a chance to spot any mistake you might have made. With -v, cacheclean will perform the task, and tell you what it has done.

Since it will operate on /var/ you’ll need to execute it as root.

Simple as that. The only gotcha is that it is a python3 script, but since that is the standard in arch these days anyway, it shouldn’t make much of a difference anyhow.

And I know that it is the popular thing to do, to hate on Ruby and Rails and that entire community, but seriously, what self-respecting person would want to identify themselves as a brogrammer? But, if I don’t consider myself a rock-star programmer, what then do I consider myself to be?

My first thoughts reading this post revolved around oh no, not another hare-brained “improvement” to something which doesn’t need changing. Then I thought some more, and saw how this could be useful. But then I had another thought.

Ordinary letters, you know, the pen and paper kind, has worked pretty well without being programmable, and I suppose that is because you probably tend to formulate these letters in a different way, thus circumventing the need to programmability. Just a thought…

I ought to dedicate this blog post to git and rsync: The hard drive on my netbook died this week. I haven’t attempted to recover anything from the disk yet, but of that which is most important I figure I haven’t lost anything at all. And that’s due in no small part to git and rsync.

All of my configuration files, at least those I care about, had been added to a git repository. And most of the binaries I wanted to preserve had been rsynced to my server.
Not all of it though, which is a shame, but it shouldn’t be hard to replace what I’ve lost. Especially if I can get the old hard drive to function just one more time, just long enough to at least make a list of what it is I’m missing. The rest of the disk, well, it’s spring, perhaps a spring cleaning was in order.

So all is not lost, and looking beyond this setback, I did learn some other things this week (except for the fact that I need to become better at performing backups) such as:

mplayer will work rather well without X: mplayer -vo fbdev </path/to/movie>

Also, quite some time ago, I went around thinking about how to automatically track my working time, and while this isn’t exactly like what I had in mind (I would probably just have created a daemon which somehow fetched the window title of the currently active window from X, and did so randomly 6 times per hour (not deterministically enough to be able to cheat the system).

And some assorted links which may or may not be of any particular use for anyone:

The Zeitgeist framework seems like a pretty cool idea, although feel that it might operate on too high a level for my tastes. If it just worked on file access and time, and not stuff like email (would it work with any client, or do you need to use “certified” clients?) or what websites have been visited (although that could be useful)

And despite the quite hectic schedule, I did manage to help a colleague with a little scripting, and those are two things which almost always sets me in a better mood: scripting (problem solving), and helping others (of course, if I don’t manage to be of any help, that kindof defeats any positive mood change I get from scripting, but in this particular case it all worked out really well in the end)

And now for the mandatory collection of links from this week:

This must be a joke right? The US can’t really, for real, be irritated with Australia for preferring national service providers over American ones, right? Especially when it could come down to storing data about Australian citizens, or in other ways vital to the government. This has to be a joke right?

I wonder if this is something most programmers can relate to or if it’s just me

This post could have been written by me… well, not as articulate, but the spirit of it. What’s even more interesting is the response this triggered on HackerNews.

Not a whole lot to say this week, it has mostly been work, sleep, work, sleep, … well you get the picture.

Some noteworthy things however:

Just how, in their infinite wisdom, does the EU expect to test the security of their own servers and services if they are going to outlaw so-called “cyber-attack tools”. For that matter, how do they propose ANY manufacturer of ANY type of digital system perform ANY type of actual security testing worth a damn?

Social AND Private? Well… not quite yet, but if they get the p2p and encryption stuff working, then we’re in business