Welcome to little lamb

Booting a 4096-byte sectors disk with Syslinux (in QEMU?)

Posted

syslinux has always been my bootloader of choice. It's small, fast, does the job well, can be used for booting your hard drive, or a USB stick, a CD or when making an ISO file of those things. It's nice.

I'm happy not having to deal with the complicated mess that GRUB is, or at least seems to be from my ignorant POV.

Having said all that, lately I've had to look at syslinux a bit again and learn some more about it's boot process. And yes, it evolved 4Kn sectors.

Continue reading...

Make transferring files under dropbear MUCH faster

Posted

Imagine you need to transfer a bunch of files from one box to another, and you don't want to do it in plain sight because why would you? So, you'll very simply copy files under SSH, using scp or rsync or whatever you want.

You start the operation and notice how it goes at around 760 KiB/s. Which isn't exactly slow per-se, but it also isn't that fast. Especially considering you're transferring files from two servers which outta have some much faster interfaces available.

What gives ?

Continue reading...

Shell: How to read pipe from another fd?

Posted

It might be that you remember when, a few days ago or so, I talked about piping to another fd ? Well, let me introduce you to part two ! :)

Yeah, because apparently some sort of "unusual" pipes is a thing I find myself needing/wanting to do often. Also, me & file descriptors makes 6, or something.

Anyhow, quick recap: last time I wanted to pipe output from one process to another, except that I didn't want the reader to be reading from its stdin. There were reasons for that (having to do with password input), and the solution was, as you may already know/recall, process substitution.

Now I find myself in some kind of "reverse" situation, as I don't mind if the reader will read from its stdin, however the writer will not be writing to its stdout !

Continue reading...

Any GTK wizard out there who knows how to control a scrollbar?

Posted

I have started a little project which requires a graphical interface, and I'm using GTK3 to do so.

One thing I need is to have a scrollbar. Nothing fancy here?, one would think. And one would be right, after all there is a GtkScrollbar widget that's just what you'd think it is (if you thought it implemented a scrollbar that is...).

But because I'm picky or something, I wanted my scrollbar to have, say, values from 1 to 10, or 7 with a page size of 3. And, most importantly, I want possible values to only be integers. So 1, 2, 3, and so on up to 7. But no 1.2 or whatever.

Sounds simple?

Continue reading...

Shell: How to pipe to another fd?

Posted

Recently I found myself wanting to pipe the output of one process into another, but - to make this a bit more interesting, I needed it to go to another fd than 0 (stdin).

So, in my head, I was thinking 3. As an alternative file descriptor to use. Piping the first process' output to the second process' fd 3. Pretty much, I had this in mind :

foo |3 bar

Which, somehow, would mean to put the reading end of the pipe not in fd 0 but fd 3 of bar. Of course, this isn't possible.

Thank you, good night!

Continue reading...

Rolling Hash and Content-Based Chunking

Posted

When dealing with large sets/streams of data, it might be useful to split them into small chunks of data, for various reasons. For example to track dupes and use the resulting data deduplication to reduce needed bandwidth and/or storage.

Of course you can just decide of a given (fixed) size, and cut every time that many bytes went by, but that's not ideal. The way I had implemented this was based on a rolling hash based on the Rabin fingerprint to perform such content-based chunking.

Continue reading...

Bang And Blake, or how hashes compare to one another

Posted

I've been needing to use the hash of small blocks of data recently, and originally used SHA3 for the job. It did the job fine, but I wondered how did the used implementation performed against others, to see if I couldn't speed things up a bit.

Because, as it is, the SHA3 computation is pretty critical in terms of performances here, as many many hashes need to be computed during the run of the application.

So, once again I set up to test a few C implementations of SHA3, and while at it threw in a couple alternative algorithms just to see/for reference.

Continue reading...

High Speed Train

Posted

On a project I'm working on, some data need to be stored. A lot of similar data, small packs, and most of the project works with streams. That is, file streams (FILE *) are used to read and write files, and similar memory streams are used to construct data in memory before writing them out.

Which also means a lot of calls to printf() - or fprintf() to be exact - are being made. I decided to change that, for various reasons, but let's have a quick loot at the impact on speed.

Let's see how I will store data now, being both a bit more compact as well as faster, both to read and write.

Continue reading...

Find the first (most significant) bit set in C

Posted

Here's a simple problem in appearance : how to find the first bit set in a number ? Or, the most significant bit set ?

It's a question I got confronted with, and of course the answer doesn't seem that complicated. In fact, it's pretty simple to imagine how one can achieve this : just start from the left and loop until the first bit.

Continue reading...

Code/Documentation are live, comain/limb/qmdoc are out

Posted

It's taken me a bit of time but we're finally getting there : the Code and Documentation sections are now live ! :)

Not only that, but to make sure they don't stay empty I've already put some things in there, as a new software - qmdoc - is just out.

And in order to get there, I did release a couple more things, but at this point they're pretty much of no use except for qmdoc, really.

Continue reading...