Skip to main content

Ralsina.Me — Roberto Alsina's website

Things that should exist.

One of my great­est frus­tra­tions as an ad­e­quate pro­gram­mer is that I think of things I be­lieve should ex­ist, yet I am not able to im­ple­ment them my­self.

To­day I will men­tion one (or two) of them.

There should be a Xen-based dis­tro.

Xen is a very good vir­tu­al­iza­tion pack­age, which gives you mul­ti­ple si­mul­ta­ne­ous vir­tu­al lin­ux in­stal­la­tions with very lit­tle over­head.

Sad­ly, to make it work, right now, you have to get a lin­ux work­ing, then in­stall Xen, then in­stall one or more ex­tra lin­ux­es as xen ma­chines.

Which is not ter­ri­bly hard, but could be done much eas­i­er.

I am think­ing of some­thing like this:

In­stalling Xen-Lin­ux in­stalls a very sim­ple ba­sic set­up as the su­per­vi­sor par­ti­tion, sets up Xen prop­er­ly, and sets you with a sin­gle Xen vir­tu­al ma­chine.

Al­so, in an­oth­er part of the disk, it has a gzipped file with a sim­ple, ba­sic lin­ux set­up which you use as a tem­plate for fur­ther vir­tu­al ma­chine ini­tial­iza­tion­s.

So, when­ev­er you want a new ma­chine, you run a scrip­t, it sets it up, starts it, you get some­thing like first­boot ask­ing you the usu­al net­work/lan­guage/what­ev­er ques­tion­s.

Then, you are dropped in­to a nice pack­age se­lec­tion tool, where you choose what you want in­stalled in this vir­tu­al in­stance.

And that's it.

This would en­cour­age the ad­min­is­tra­tor to al­ways set up his servers as vir­tu­al ma­chi­nes, which ex­cept in cas­es of re­al hard­core per­for­mance re­quire­ments is a good idea (y­ou can im­ple­ment HA as ful­l-im­age fall­back. You can mi­grate to a new box in min­utes!)

I could do most of this. How­ev­er, that leads me to an­oth­er thing that should ex­ist...

A sim­ple in­stall­er

Wait, you may say "Lin­ux in­stall­ers are sim­ple al­ready!!!" and youa re right.

I mean a sim­ple in­stall­er for a guy try­ing to make his own dis­tro!

I ac­tu­al­ly like ana­con­da a lot. But I would like it even bet­ter if I could just get some sort of tool that, giv­en a list of pack­ages, would cre­ate an ana­con­da-based CD with cus­tom­iz­a­ble in­stall script­s.

And that is the piece I am not sure I can im­ple­men­t.

So, if any­one knows of any such thing, I would love to hear about it.

And as a pre­emp­tive mes­sage: No, I don't want to do it with Gen­too, or De­bian, or Ubun­tu, or Suse, or kick­start. I want to cre­ate a RP­M-based, Cen­tOS-based, ana­con­da-based in­stall­er that works just like a reg­u­lar Cen­tOS/RHEL in­stall­er CD.

What I learned moving my blog

  1. PyDS is good enough to let you change how you host your site and keep it just work­ing.

I switched from pyc­ (thanks for all the good work!) to a stat­ic site host­ed at my IS­P.

Since PyDS sim­ply gen­er­ates a whole lot of stat­ic HTM­L, this worked pret­ty good!

I gen­er­ate the site, and then up­load us­ing lft­p. No fuss, again, it just work­s.

  1. Stat­ic host­ing suck­­s.

On pyc­ I had re­fer­rer logs, stat­s, com­ments. The stat­ic tem­plate from PyDS does­n't have any of that, of course.

  1. You can work around the suck­­age.

No com­ments? Haloscan can host them for you.

No stat­s? stat­counter can do them for you.

No spam-free mail web­for­m? I haven't looked yet, but I bet it ex­ists some­place :-)

  1. You learn stuff.

I now un­der­stand how PyD­S's macros/tem­plates/nugget­s/u­pload­ings work. I thought I did. Now I do.

For ex­am­ple, I like com­ments for longer ar­ti­cles. Be­fore, I added the links by hand. Now I just hacked the tem­plates and it's done au­to­mat­i­cal­ly. I could have saved a few hours of my life if I had both­ered to learn it.

  1. Switch­ing your URL suck­­s.

Since noone knows where the hell my page is. Luck­i­ly soon clee will switch me at plan­ and things will start to flow again.

  1. De­pend­ing on free host­ing's tech sup­­port is not a good idea.

I love pyc­ I loved how it worked. Un­til it stopped work­ing.

I have no right to whine, though, so I of­fered to help (got no re­sponse yet). Then I moved out.

Since mov­ing is an­noy­ing, I will prob­a­bly not be go­ing back, even if I start lov­ing it again :-(

I am get­ting and re­post­ing all the com­ments, but then gain haloscan has a 4-­month lim­it on the com­ments, so I will have to im­ple­ment some sort of com­men­t-archiv­ing and clos­ing mech­a­nis­m.

BPython Lives!!!

In Jan­uary, I sug­gest­ed it would be triv­ial to write a pre­proces­sor that would ac­cept a ver­sion of python which de­lim­it­ed blocks with braces in­stead of in­den­ta­tion.

Ok, al­most, I sug­gest­ed #{ and #} as de­lim­iter­s.

Well, I had a few min­utes free to­day, and here it is, a func­tion­al BPython->Python com­pil­er, so to speak.

Here's the kind of im­put it takes (no­tice how it's not in­dent­ed at al­l:

def factorial(n):
if n==1:
return 1
return n*factorial(n-1)

for x in range(1,10):
print x,"!=",factorial(x)

And it pro­duces this (I am not hap­py with the in­dent­ing of the com­ments, but who cares):

def factorial(n):
  if n==1:
    return 1
    return n*factorial(n-1)

for x in range(1,10):
  print x,"!=",factorial(x)

As you can see, this is both a le­gal Python and a le­gal BPython pro­gram ;-)

It has some prob­lem­s, like not work­ing when you use a line like this:

#{ x=1

But hey, it is python with braces.

Here's the code. I pre­dict­ed 30 lines. It's 34. And it's 99% a ripoff of Ka Ping Yee's re­gur­gi­ which you can find all around the we­b.

#!/usr/bin/env python
import tokenize, sys
program = []
lastrow, lastcol = 1, 0
lastline = ''
def rebuild(type, token, (startrow, startcol), (endrow, endcol), line):
    global lastrow, lastcol, lastline, program,indlevel
    if type==52 and token.startswith ("#{"):
    if type==52 and token.startswith ("#}"):
    line="  "*indlevel+line.lstrip()
    # Deal with the bits between tokens.
    if lastrow == startrow == endrow:            # ordinary token
    elif lastrow != startrow:                    # backslash continuation
        program.append(lastline[lastcol:] + line[:startcol])
    elif startrow != endrow:                     # multi-line string
    # Append the token itself.
    # Save some information for the next time around.
    if token and token[-1] == '\n':
        lastrow, lastcol = endrow+1, 0           # start on next line
        lastrow, lastcol = endrow, endcol        # remember last position
    lastline = line                              # remember last line
tokenize.tokenize(sys.stdin.readline, rebuild)
for piece in program: sys.stdout.write(piece)

So, all of you who dis­like python be­cause of the lack of braces and the sig­nif­i­cant whites­pace:

BPython has no sig­nif­i­cant whites­pace, and braces are manda­to­ry.

En­joy cod­ing!

Fighting Spam with Qmail (part III)

A new sto­ry in the "Fight­ing Spam with Qmail" se­ries, af­ter an over two year hia­tus.

This one is about RBLs, qmail and a great tool called qmail-sp­p.

Contents © 2000-2021 Roberto Alsina