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 [...]

Issue with making a bootable Ubuntu 15.04 USB stick

I wanted to create a boot USB stick from an Ubuntu 15.04 desktop that was running in a Virtual machine. So I plugged in a clean USB stick, and picked “Startup Disk Creator” from the Launcher. Then picked the USB stick as the target, and waited for 15 minutes. When the utility was done, it [...]

Linux: Quick multiple page scanning with scanimage

It’s often required to scan a lot of pages in one go, even manually. The problem is that when doing individual scans, there’s a significant delay between each scans, as the computer initializes the scanner for each. The trick is to use scanimage’s batch scan feature. A typical command for scanning an 10 A4 pages [...]

ImageMagick convert from pdf to jpg and vice versa

To convert all pdfs into a jpgs with fairly good resolution (Linux, bash): for i in *.pdf ; do convert -density 300 “$i” “${i%%.*}.jpg” ; done Without the -density parameter, the result is pretty lousy. To prepare a lot of image scans for printing, into a single pdf doc: convert *.jpg -colorspace gray -contrast-stretch 1% [...]

MuseScore notes on Fedora Core 12

Random notes playing with MuseScore 0.9.6 (pun not intended): Installation (after grabbing the RPM file from the web): # yum install –nogpgcheck MuseScore-0.9.6-1.fc12.x86_64.rpm Which installs the file with no signature. Somewhat dangerous in theory, as the RPM could in theory contain malicious code (as if a signature helps in this case). The command line for [...]

Plain-text mail from Thunderbird (under Linux)

Introduction I’ve been annoyed for quite a while by Thunderbird’s strong inclination towards HTML mail. To the extent that if I don’t really, really verify that a mail goes out in plain text, it’s probably going to slip out in HTML. This is bad in particular when sending mails to Linux-related mailing lists. They don’t [...]