My golden Makefiles for compiling C programs

Single-source utilities This is the Makefile I use for compiling a lot of simple utility programs, one .c file per utility: CC=    gcc FLAGS=  -Wall -O3 -g -fno-strict-aliasing ALL=    broadclient broadserver multicastclient multicastserver all:    $(ALL) clean: rm -f $(ALL) rm -f `find . -name “*~”` %:    %.c Makefile $(CC) $< -o $@ $(FLAGS) The ALL [...]

Password-less SSH remote login demystified

This is documented everywhere, and still, I always find myself messing around with this. So once and for all: The files In any user’s .ssh/ directory, there should be (among others) two files: id_rsa and id_rsa.pub. Or maybe with dsa instead of rsa. Doesn’t matter too much. These are the keys that are used when [...]

Linux Malware Detect for occasional non-root use

Intro This is a minimal HOWTO on installing Linux Malware Detect for occasional use as a regular non-root user. Not that I’m so sure it’s worth bothering, given that contemporary exploit code seems to be able to go under its radar. Background One not-so-bright afternoon, I got a sudden mail from my web hosting provider [...]

LVM volume resizing jots

These are my jots as I resized a partition containing an encrypted LVM physical volume, and then took advantage of that extra space by extending a logic volume containing an ext4 file system. The system is an Ubuntu 14.04.1 with a 3.13.0-35-generic kernel. There are several HOWTOs on this, but somehow I struggled a bit [...]

systemd jots

I not an expert on this These are just my what-on-earth-is-going-on-here notes as I tried to understand how my Debian 8.2 (“Jessie”) machine boots up. Conclusion: It’s a mess. More specifically, it’s a weird mix between good-old SystemV init scripts and a nasty flavor of upstart. And they say it’s here to stay. Maybe. But [...]

Cursor control characters in a bash script

To control the cursor’s position with a plain bash “echo” command, use the fact that the $’something‘ pseudo-variable interprets that something more or less like a C escape sequence. So the ESC character, having ASCII code 0x1b, can be generated with $’0x1b’. $’\e’ is also OK, by the way. There are plenty of sources for [...]

Using Linux’ setpci to program an EEPROM attached to an PLX / Avago PCIe switch

Introduction These are my notes as I programmed an Atmel AT25128 EEPROM, attached to a PEX 8606 PCIe switch, using PCIe configuration-space writes only (that is, no I2C / SMBus cable). This is frankly quite redundant, as Avago supplies software tools for doing this. In fact, in order to get their tools, register at Avago’s [...]

Hexdump notes

General notes For plain byte-per-byte hex dump, $ hexdump -C To dump a limited number of bytes, use the -n flag: $ hexdump -C -n 64 /dev/urandom 00000000  9c 72 b0 43 da 6e 27 2f  f9 f1 34 06 60 d5 71 ad  |.r.C.n’/..4.`.q.| 00000010  cc 07 89 02 f7 f9 5f 85  f6 [...]

Instead of using “rm -rf”

The slightly safer alternative  is $ rm –one-file-system -vrf delme-junk/ There are two additional flags: The -v flag causes “rm” to display the files as it deletes them. This gives the user a chance to stop the process if something completely wrong happens. Not as good as thinking before making the mistake, but much better [...]

Linux: Yet Another Google Chrome “Aw, snap” solved.

“Aw, snap” in Google Chrome happens when a process (or thread?) involved with Chrome dies unexpectedly. I got quite a few of those, and learned to live with them for about a year, as I couldn’t figure out what caused them. It was clear that it had to do with Adobe Flash somehow, and that [...]