Posts

Unintentionally formatting your system drive is a bad idea

One day, I was playing with a chroot jail. This whole incident has taken place some months ago. I wanted to test if I could install software from user mode because my apt-get was doing a system update. Well, building from source via "apt-get -b source" would have also solved the issue, though dependency handling in this case is not automatic if I understand correctly. In order for this process to take as little overhead as possible, I wanted to simulate a manual copy-on-write filesystem by creating links to the parts that are common with my root system, and recreating directories which are partially different. I first tried to use symbolic links, but I had to realize that relative links that point outside the sandbox were dysfunctional. Hence I made a hardlink for my root in the chroot. Well, it was a read-only bind-mount to be more exact. Note that I did succeed previously with a different system and kernel (Gentoo 2005.x) by using symbolic links, that's why I gave it a...

Wooden house good idea after all

I had a conversation with a friend of mine some years ago about buildings made out of renewable material. Well, it wasn't actually a healthy argument, as I scared the guy off with a few tongue-in-cheek expressions, like the example of Tom and Jerry. :) I wanted to continue, but sadly, he said he was convinced and changed his mind. Nowadays, I myself consider this an ever more viable alternative, given the low ecological footprint and the numerous successful projects in this area. Note that while I have not analyzed the per-year cost of these less durable materials yet, renewable by definition is almost always better than non-renewable. The following links (and many others) seem to imply the same: Build Your Own Affordable, Eco-Friendly House by Dr. Owen Geiger Natural Resources & Sustainability Environmentally Friendly Homes by Adam Downing Wooden Eco-buildings - energy efficiency in LCA perspective

Social interaction is prime

Who would have guessed that even mathematical logic is not a pure expression of general intelligence, but rather a device evolved directly out of simple reward-punishment and social exchange? wiki: Wason selection task Okay, perhaps the amount of practice done in this area by most humans could also provide part of the explanation.

Chopping a long string into smaller ones toy

I made a great tool I can't do without from now on! ;-D Update#1: added null string checking, renamed "i" to "s". Update#2: upgraded output format, added BASH version! Here's the Haskell source code: import System.Environment(getArgs) import Data.List(unfoldr,intersperse) chop k | k>0 = unfoldr f where  f [] = Nothing  f s  = Just $ splitAt k s main = do  [k,s@(_:_)] <- getArgs  let out = show . concat . intersperse " "      res = chop (read k) s  putStrLn $ "filter(/=' ')" ++ out res Typing: ./chop.hs 27 http://bkil.blogspot.com/2009/05/chopping-long-string-into-smaller-ones.html Gives: filter(/=' ')"http://bkil.blogspot.com/20 09/05/chopping-long-string- into-smaller-ones.html" Or if you prefer, you could alternatively opt for the following BASH routine: main(){  printf 'echo "'  printf "$2"|sed -r "s~.{$1}~& ~g"  echo '"|sed "s~ ~~g"' } This one...

Substituting power plant fired switchgrass for ethanol

Edit: fixed dead link http://money.cnn.com/news/newsfeeds/articles/reuters/MTFH68994_2009-05-07_19-55-00_N07396064.htm Just as I've been telling everybody for many years now: the internal combustion engine is unsustainable. Note that a possibly even better alternative would be some strain of algae. Also note that I am nevertheless still advocating commuting to work by electric motorcycle or bicycle for most people! UK (REUTERS): Researchers eye better use for biomass than ethanol

Quine in Erlang

How could I have forgotten about the friend of mine who's fond of Erlang? :-D -module(q). -export([s/0]). s()->io:format("~s~p.\n",[p(),p()]). p()->"-module(q).\n-export([s/0]).\n\ns()->io:format(\"~s~p.\\n\",[p(),p()]).\n\np()->". Here's another one for the Eshell REPL: fun(P)->io:format("~s\n~p).\n",[P,P])end( "fun(P)->io:format(\"~s\\n~p).\\n\",[P,P])end("). And as I know he's also in love with LISP, here's a Haskell variant rewritten in that spirit: (\ (x)-> ((++) x (show x)))"(\\ (x)-> ((++) x (show x)))"

Fixing grey background (default bgcolor) in graphic links2

#Installing dependencies if you can become root is easy (Debian names shown): apt-get install pkg-config libpng12-dev libjpeg62-dev xorg-dev # libssl-dev libgpm-dev libbz2-dev #Fetch the web browser source: mkdir mylinks && cd mylinks && apt-get source links2 #Here's the magic, changing the default graphics mode background color from grey to white: patch -p 0 <<END diff -u links2-2.1pre37.old/default.c links2-2.1pre37/default.c --- links2-2.1pre37.old/default.c 2008-06-21 18:05:53.000000000 +0200 +++ links2-2.1pre37/default.c 2009-05-09 22:10:48.000000000 +0200 @@ -1453,7 +1453,7 @@ struct rgb default_vlink = { 255, 255, 0, 0 }; struct rgb default_fg_g = { 0, 0, 0, 0 }; -struct rgb default_bg_g = { 192, 192, 192, 0 }; +struct rgb default_bg_g = { 255, 255, 255, 0 }; struct rgb default_link_g = { 0, 0, 255, 0 }; struct rgb default_vlink_g = { 0, 0, 128, 0 }; END #Now we can compile the software: cd links2-* && ./configure --with-x --enable-...