Compiling a kernel using the modules you actually have loaded.

So today on reddit, someone named sping was wondering if anything existed to take the modules you have loaded on a linux system, and automatically compiling a kernel with those compiled in.

Now, this is probably not that great of an idea if you plan on updating your kernel any time soon, but it may come in useful for people who know have a computer whose kernel and/or hardware aren't going to need updating for a few years.

I wasn't (and am not) aware of a tool for doing this, so I decided to write one - as it sounded like a fun (not to mention educational) exercise. I figured there would be a pretty easy-to-find correlation between module names and kernel configuration options (since they are marked with "m" or "y" and such). I'm far from being a kernel-configuration guru, or a master of the kernel internals, but I know a little bit (and better yet I know how to find stuff out, hooray.).

It was a lot harder than I expected to figure out how to relate the currently loaded modules to their configuration options. The reliable method I found is slow.

Basically, once you have the kernel sources, you can find what kernel option you need with this nastly oneliner, from the sources directory, where FOO is the name of the module you're looking for:

find . -name Makefile | xargs grep .*CONFIG.*FOOo$ | awk -F "$" '{print $2}' | grep -o \(.*\) | sed -e "s/(\|)//g"
This looks pretty nasty, but it's not that bad. Its just doing this:

  1. Find any file named Makefile under this directory.
  2. For each match of step 1, look for a string in it containing "CONFIG", "FOO", and ending with an o. These lines look like this: "./fs/hppfs/Makefile:obj-$(CONFIG_HPPFS) += hppfs.o
  3. For each match of step 2, split the line on the "$" and print out the part of the second half surrounded by parentheses with the parentheses removed.
Anyhow, once you have the links between module names and kernel configuration options, all you have to do is modify the kernel config file and compile (and perhaps still answer a few compile config questions if an invalid kernel config got generated).

This was a lot more work than I expected it to be, but really wasn't that hard when you take into consideration that I don't really know much about linux internals, or how the kernel works except at a high level, and was able to come to a solution primarily by searching through and modifying text files, and having a program call the commands that I normally would.

I wrote the actual "I would give this to people who know what they're doing to try" version of this in python, you can see it (or download it) here. It might for any debian-based distro, but I've only tested it on Ubuntu. There's a script called prelims.sh that will download and install what you need to compile a new kernel, and the kernel sources. The script is still rather hackish, there is some ugly code, may only work on Ubuntu, and is not appropriate for people who don't know how to step through a kernel config process already.

So, it's not polished - but it works as a proof of concept, and that was the goal here.


What I would do if I had 100K per year.

Earlier today, there was a post on HN asking people what they would do with their life if they had solved the "money problem". Say you had $100,000 per year, adjusted for inflation and all that - what would you do with it?

I know what I would do with it. I would make a huge attempt to get the average person concerned more with the quality of life of humanity as a whole than with the quality of their own life. We've got a metric shitton of problems we're facing right now, and $100K per year - while not a gigantic sum of money - is more than enough to put some stuff to action.

What I'd probably want to do first is buy a large building of some sort - a wharehouse, or an old apartment complex. Something that would be maintainable and have a whole lot of space.

I'd revamp this place to have:

  • Learning space: Ample library of educational material, rooms for lectures / group study.
  • Rooms for fiddling around with electronics /metal working / audio recording / painting / sculpting / woodworking / etc.
  • Living space for around 50 people.
  • Coffeeshop / open library area, with ample supply of good literature
  • A robust network, and applicable software (there's all kinds of stuff that could be done on an intranet in a place like this)
  • Space for holding larger meetings of people (plays, bands, and so on).
  • Space for indoor food growing - delicious vegetables.
  • Gym / recreational area.
I already know a few people I would want to be living there, but I (we) would be open to anyone passionate about learning, and / or passionate about using technology to improve the living conditions of humans, with a focus on technologies that don't entirely rape the earth.

Ideally, I'd want the spot to be as self-sufficient as possible. Most of the $100K/yr should cover that, and there's a bunch of ways to reduce costs, mainly through having people who are into autodidaticism around. DIY folk. Autodidacts and DIYers are not the same, but there is a pretty significant overlap. We could run generators through excersize equipment, solar stuff, etc to reduce power costs.

I would want the projects started at the place to have a focus on the community that it's located in. Get involved with everyone we can find in the area who would be interested in improving the quality of life for everyone around them, and work with them.

Once this place was established and running well, I would want to then start opening up more spots like it in different areas, and keep them in communication with each other. Share resources, hold mutual conferences. Maybe start sending a bus around looking for people who would want to join up with this mode of living, and start expanding.

If everything went smoothly (which it probably wouldn't), there could be a new societal structure emerging that was overall better for making happy humans than the one we currently have in 20-30 years. At least that would be my hope.


Emacs tidbit

I've been using emacs regularly for around one year now, and I am always running into reminders that I need to consistently learn more about what's available to you in emacs. It's frankly a bit hard to schedule getting stuff done in emacs with learning more about what's available through (or in) emacs, but the return value for learning a bit more about what you can do is very high - there are things that can make you magnitudes more productive just sitting around waiting to be found.

A small tidbit, from earlier today: kmacro-insert-counter inserts the number of times a macro has been called into the buffer.

I was debugging some methods, and had a bunch of similar calls that I wanted to log info about to files named in a sequential order (foo1.txt, foo2.txt). I just needed to do a diff of the output. I made a little macro that used kmacro-insert-counter. Wasn't the most robust debugging solution, but then again I wasn't in need of one at the time, just needed to see some data as quickly as possible.

There have been a few other times where I've wanted something like kmacro-insert-counter. It's not something that's useful (to me) on a very regular basis, but when it's handy, it's really handy. Emacs is chock-full of stuff like that, and if you're familiar with what's there, combining all the little convieniences into one big project-or-file-specific convienience is easy, and allows you to do non-trivial editing tasks much faster than I've been able to accomplish with other editors.


CherryPy doesn't get enough love.

I tell you, it's true. CherryPy doesn't get nearly enough love on the web. Everyone hypes up django and RoR, but barely any mention of cherrypy.

Now, I'm not trying to rag on django, or RoR - they're both wonderful tools - however, I've found my match (so far) with cherrypy.

CherryPy really isn't a web framework - it's more of an HTTP framework. If you're writing a web-application, or website that calls for a framework, then it's fairly easy to pick and choose each part of what makes up a framework, and set it up how you like. Granted, it's normally possible to customize all (or a large portion of) the individual tools that a framework like django uses, but it seems to me that when a lot of people use a framework, they end up never exploring other options for doing what they need to do. Really though, the point about having to pick-and-choose what tools you use for templating, interacting with the database, etc is a minor one.

The real benefit that I get, as a developer, from using cherrypy is the ease with which I can perform iterative development with a minimum amount of learning a bunch of new stuff. Ruby on Rails can make iterative development pretty easy, but I have to learn:

  • The RoR directory structure.
  • How to use RoRs default templating system.
  • ActiveRecord
  • RoRs quirks.

That doesn't seem like much, but really it's quite a bit of stuff. If you've got what your building entirely planned out, already have the design done, and it's fairly large, it can be really nice to just have a place to drop all that stuff into.

That's rarely the case for me. Many times when I want to make a web-application, it's pretty small. Using RoR feels like overkill, there's so much stuff generated that I won't ever use. There's different configuration options for tons of different stuff, and so on.

As an example, I recently implemented a tool for downloading Ubuntu packages and their dependencies as a tarfile. It's about 150 lines of HTML, 80 lines of CSS, and 150 lines of python, plus a smattering of javascript making use of jquery. It doesn't touch a database at all, it's a simple app. It's simple enough that I didn't feel the need to use a templating system - the few methods that generate dynamic content do it through yield statements. Sure, having markup in method code is generally a bad thing, but it is a very small amount of markup and it makes it very easy to know exactly what's going on without having to look at a whole lot of files. This is only a good strategy for simple cases - if the method logic needs to get more complicated, or the markup needs to get more complicated, than the yield statements can (and should) be refactored out into templates.

CherryPy lets me do this. It doesn't care, and it makes it abundantly clear that it doesn't care how the "exposed" method creates what it will be sending back to the user. Need a templating system? Find one, learn how to use it, integrate it into your app.

My tool for downloading Ubuntu packages and their dependencies is one python file, plus the directory structure for html files, stylesheets, and javascript files. CherryPy has a server built into it, that has more than met my needs so far, and it's configuration is right there at the bottom of the file after "if __name__ == '__main__':".

When I first started fooling around with CherryPy, I was a bit confused. The online docs weren't that great, and finding info about configuring the server was difficult.

Then I opened up the code for CherryPy itself. It's well written. It's well documented. It's pythonic as all fuck. I don't need documentation, I can actually read and comprehend the code for CherryPy without much of a strain, without being familiar with the codebase. Oh my.

So in short, cherrypy allows me to:
  • Only do "web frameworky" stuff when I need or want to.
  • Not have to be familiar with how to turn the "web frameworky" stuff off in order to do the above
  • Iteratively develop my web-apps at a sane pace, building them as they proceed.
  • Always write a web-app that I know intimately.
  • Understand what's going on under the hood due to the quality of their source

And those are a few of the reasons that I have fallen in love with cherrypy.


Cloned human bodies for harvesting would be awesome.

Charles Krauthammer recently wrote an article about the possibility of cloned human bodies, meant for organ harvesting looming on the horizon. The article is largely devoid of substance, basically amounting to not much more than fear of the unknown.

Let's take a look:

"These human bodies without any semblance of consciousness would not be considered persons, and thus it would be perfectly legal to keep them 'alive' as a future source of organs."

"Alive." Never have a pair of quotation marks loomed so ominously. Take the mouse-frog technology, apply it to humans, combine it with cloning, and you are become a god: with a single cell taken from, say, your finger, you produce a headless replica of yourself, a mutant twin, arguably lifeless, that becomes your own personal, precisely tissue-matched organ farm."

This sums up the argument against pursuing this - that we would be "playing god". I would argue that it's no more playing god than creating antibiotics is.

Furthermore, the quotation marks around "alive" are not ominous - they are there because the meat is just meat. It is not "alive" in the colloquial sense - there is no consciousness, no mind. There is no "soul", whatever that is. All it is is cloned meat.

I can see why the imagery of a body in a vat, growing organs waited to be supplanted into humans could strike someone as dark, or even foreboding, but I can not see a moral argument against it - at least not one that holds any weight.

As far as for what the intended argument is (in all likelihood) - that this will lead to immortality OH NOES, I don't see a problem with that. I'm willing to bet that most people will willingly choose to die after a while, and am further willing to bet that this won't grant immortality anyhow. Overpopulation? We're already overpopulated, and have been needing to look towards space colonization for a decade or so (at least) now. Humanity has a whole host of problems ahead of it, and although it could be argued that this cloning stuff may not be the best thing to focus on, it's far from humanities primary focus - and I would view the ability as a net positive, not negative.

I don't see this guy railing against any of the other methods that humans use to fight death.



People should have a basic understanding of the prevalent technologies.

Tim O'Reilly, recently gave a keynote that touches on a point that I've been thinking about for a while - there are a lot of software startups, and a lot of social software, but not too much focus (or perhaps I just haven't seen much of a focus) on people using or creating software (or technical skills in general) to really try to improve the lives of people around them.

Maybe I'm just not looking in the right spots.

There's a couple large points here, and it might get kinda rambly so bear with me (or just slap a TL:DR on it and ignore.)

Computers are arguably the most important things in most peoples lives, regardless of whether or not they realize it. We rely on computers, and more specifically networks, to drive a lot of our business - chances are, if you get a paycheck, there's a computer somewhere in that process. I'd guess that it's probably the case that your paycheck is reliant on a computer or set of computers.

However, most people do not have even a basic understanding of how computers work. It can be argued that most people don't have a need to, but I would disagree. Most people that I've met know how a car works, on a high level of abstraction - they know how to operate one, they know that there is an engine that works by burning fuel, and they probably know that the ignition of the fuel pushes a piston down. They probably know basically how the brakes work, etc. On the other hand, most people do not know basic things about how computers work. They do not know that there is basically a whole bunch of abstraction / translation layers that take streams of 1 and 0s and turn them into applications. They don't know how computers communicate over a network, even at a very high level of abstraction. They don't understand that the programming languages that people use to make applications are basically descriptions of methodology. They don't understand how the applications and services they use the most work.

Take google for instance. Google is the de facto search engine at this point in time, and it's what a lot of people (myself included much of the time) turn to first when trying to find something. If you have a very basic understanding of how google finds pages, it makes it a lot easier to search for things. If you know that what you want to search for tends to be words that you would expect to appear in the page you're looking for, and not necessarily the actual topic or specific thing that you're looking for, it's a lot easier to get good search results. Granted, google is very good at returning relevant results to people regardless of their understanding of how their search works - but the point still stands.

People need to understand this stuff, at least on a basic level, for a plethora of reasons.

Another example: I have had to explain to multiple people that you do not need to purchase a wireless internet package to get wireless internet. You can purchase whatever kind of internet service you like, and have it be a wireless connection, all it requires is that you have a wireless router. People are getting ripped off by ISPs selling wireless packages, it's silly.

Right now, we are in a wierd situation, at least in the US. The economy is bad and getting worse, and we have an (unfortunately) rather poorly educated populous (in my opinion). The education system is largely pretty horrible, and we have a culture that encourages people to not apply critical thought.

On the bright side, we have this internet technology that enables us to share knowledge faster and better than ever before. Almost anything that you want to learn about, you can learn about with the power of the internet. I know this, and probably so does anyone reading this, but the sheer vastness of the information available to people is largely unknown to the average person.

I'd guess that if people knew how much information was available to them (and on a larger scale, just how rewarding learning is), that the worlds - and specifically the U.S.s - situation would change for what I would consider to be "the better" fairly quickly. There is, at this point in time, practically infinite ways for people to collaborate with each other to do anything from learning something to providing for their basic living needs.

To attempt to get people interested in teaching themselves, and hopefully get people to start being more interested in what they can do to make their lives (and the lives of those around them) easier, I intend to start something of a "zine" - a self-published magazine. I'm going to collect some of the info freely available online, and do some writing myself, print it out, and go put in on people's doorsteps.

I figure the "first issue" will have some basic information on how computers work, how computers communicate over a network, some information about open source software and why it's a good thing, some information about Ubuntu linux, perhaps some info on how to tell if your ISP is throttling your data or modifying your pages. I encourage people to do the same if they think it's a good idea (or perhaps we could collaborate on content?). I'll have an email address set up that people can send an email to if they'd be interested (or entirely disinterested) in recieving further issues, and also include a request for articles on how to do something (really anything DIY) from anyone who's technically inclined.

I'm not sure if this will be effective at all, but it's better than doing nothing and it can't hurt.