Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Heads or Tails?

There is a com­mand, head, to take the first piece of a file.

There is a com­mand, tail, to take the last piece of a file.

Tail does a few ex­tra things, be­cause it's use­ful to watch the end of a file that is be­ing up­dat­ed and sim­i­lar things, but they should be pret­ty sim­i­lar pieces of code, sup­port­ing sim­i­lar op­tion­s, right?

Well, no.

  • head sup­­ports a neg­a­­tive num­ber of lines as ar­gu­­men­t, mean­ing "all but the last N lines", and tail does­n't.

  • Same about bytes in­­stead of lines

That means that you can't quite sim­ply get "all but the first two lines of this file".

But don't wor­ry, this is how you do it:

tac file |head --lines=-2 | tac

Correction: tail has what I wanted. I am just a silly guy that doesn't read the man pages completely, you can do tail -n +2 to do it.

On the oth­er hand, it's not ex­plained in the op­tion, and the syn­tax is dif­fer­ent from head­'s, so it's still slight­ly rant-­wor­thy ;-)

So, this is how it feels...

...­to scratch an itch that is­n't there!

For some rea­son I can't stop play­ing with my blog's site.

Lat­est ricer-­like "im­prove­ments": a google search box and a google sitemap so the search box will work well.

At least the sitemap was some­thing I need­ed to learn about for a client :-)

Roadmap for Qt/IUP

I have been con­tact­ed by a few peo­ple about Qt/I­UP. Here's my cur­rent state of mind...

  • It works most­­ly.

  • It lacks a few wid­gets

  • It needs some­one to walk over the docs check­­ing ev­ery­thing is im­­ple­­men­t­ed and se­­man­ti­­cal­­ly right.

  • It has a (IMVHO) de­­cent struc­­ture for the Qt back­­end. It should be pos­si­ble to im­­ple­­ment ev­ery­thing us­ing it.

  • The IUP peo­­ple know about it.

  • It's still just my toy, AFAIK

So, its fu­ture seems to re­ly on me hav­ing time and en­er­gy to fin­ish it... and there's the catch.

I am Gim­li. I am not a marathon run­ner. We dwarves are nat­u­ral sprint­er­s! So, I can usu­al­ly cook up a de­cent project in a week or a mon­th, and then it lan­guish­es.

Spe­cial­ly be­cause I re­al­ly don't need Qt/I­UP.

I on­ly got here be­cause I was try­ing to learn D and I did­n't like any of their por­ta­ble toolk­it­s, and I found no bet­ter small C tool­kit I could wrap, and then I dis­liked it be­ing Mo­tif.

As you can see, an en­tire­ly too weak link from me to Qt/I­UP to be sus­tain­able.

I will try to push it to­day, im­ple­ment­ing the miss­ing wid­get­s, and see what hap­pen­s.

Using runit is even simpler

I have post­ed in the past about runit.

One of the prob­lems peo­ple mi­grat­ing to runit have is that all your ser­vices are SysV script­s.

The runit au­thor has a col­lec­tion of scripts you can use, but usu­al­ly they re­quire some ad­just­ment to work on a spe­cif­ic ver­sion of Lin­ux.

So, I wrote a lame python script that takes the SysV scripts you are cur­rent­ly us­ing and turns them in­to runit ser­vices, in­clud­ing de­pen­den­cies.

Sup­pose you usu­al­ly start on run­lev­el 3. Then you save this script and run it like this:

mkdir services
python importinit.py 3

And you should end with a bunch of runit ser­vices in­side ser­vices/

Those ser­vices will start in rough­ly the same or­der as if you were us­ing SysV init. That's prob­a­bly way too much de­pen­den­cies.

The main dif­fer­ence is that kdm will start ear­li­er and the ttys will start way ear­li­er than you are used to.

I have found that my note­book boots faster us­ing this, but I can't pro­vide a bootchart be­cause it sim­ply does­n't seem to work in my com­put­er.

If any­one is will­ing and able to run the tests and quan­ti­fy the dif­fer­ence, I am all ears.

For some rea­son kudzu, ipt­a­bles and arpt­a­bles_jf don't work with this ap­proach, so just stick them at the bot­tom of /etc/runit/1

Al­so, please un­der­stand that these are not cor­rect runit ser­vices. They are not man­aged, so if your ser­vice crash­es it stays crashed.

So, you should still even­tu­al­ly mi­grate to cor­rect script­s. This is just a way to make that sim­pler.

Well, I didn't know that!

As ev­ery­one knows, the Da Vin­ci Code is about to be pre­miered world­wide.

I will prob­a­bly see it. By chance I ran in­to the plot syn­op­sis in the site of Dan Brown (the au­thor of the book).

Hm­m­m­m... in­ter­est­ing.

For ex­am­ple, it de­scribes Opus Dei as

Opus Dei [is a] clan­des­tine, Vat­i­can-­sanc­tioned Catholic sect be­lieved to have long plot­ted to seize the Pri­o­ry's se­cret.

Whoa.... Opus Dei is a clan­des­tine sec­t! I must say I dis­like the guys (and I know at least 4 of them), but they are about as clan­des­tine as the Bap­tists. And much less so than the Uni­tar­i­ans.

Not to men­tion that (I've heard) much of the plot re­volves around clues left "hid­den" in things like Da Vin­ci's paint­ings.

You know, if I were the Pri­o­ry of Sion, and had a se­cret... sure, I would hide the keys to the se­cret in world-­fa­mous pieces ev­ery­one sees. Or maybe I would ... hide them? You know, as in not telling any­one about them. As if it was a se­cret?

What would you choose? Any­one? Any­one? Bueller?

On the oth­er hand... the good guys are the ones (the Pri­o­ry) that have the se­cret and the bad guys are an­oth­er se­cre­tive or­ga­ni­za­tion (O­pus Dei) that wants to get the se­cret?

Well... col­or me unim­pressed, but what the hell does ei­ther one hav­ing the se­cret mat­ter? If it is a se­cret, and noone should know about it, why not give it to the guys at Opus and let them keep it? They don't in­tend to an­nounce it ei­ther.

Then the nice fel­las at the Pri­o­ry can go to the beach or some­thing.

But who cares. They are all the same to kdap­tists.


Contents © 2000-2021 Roberto Alsina