dereenigne.org

reverse engineered

Multiple JPEG images to single PDF

Another handy ImageMagick trick this week. For one reason or another, many people still scan documents to JPEG files rather than PDF files. You can convert all of these images to a PDF in a single command. convert img1.jpg img2.jpg img3.jpg output.pdf Read more →

Linecount

I was recently dealing with a 600MB CSV file which I needed to import into a MySQL database. In order to have a rough idea of how many rows I would have, I needed to count the number of lines in the CSV file. A file that size would crash any text editor, let alone take an age to open, so the fastest thing was to use the commandline. wc -l file. Read more →

Dual Boot, Dual MAC

My desktop machine runs a Linux/Windows dual boot. It runs Linux 90% of the time, with Windows only used for playing games. Rather than have to remember which operating system is running at the time, I decided to forcibly make Windows use a different MAC address. This means that I can now assign each machine a different hostname in DNS. Checking which operating system is running is now as simple as pinging the hostname corresponding to the operating system. Read more →

/proc/*/cmdline

A handy way to see the processes running on your system is to use the ps command: user@host:~$ ps au USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 1000 1804 0.0 0.1 128492 5904 pts/1 Ss+ 00:10 0:00 /bin/bash root 1942 5.5 2.3 176152 95680 tty7 Ss+ Aug03 13:40 /usr/bin/Xorg : root 2991 0.0 0.0 6120 600 tty1 Ss+ Aug03 0:00 /sbin/getty 384 root 2992 0.0 0.0 6120 600 tty2 Ss+ Aug03 0:00 /sbin/getty 384 root 2993 0. Read more →

Add Forwarding to existing SSH Connections

SSH forwarding is very handy for use as a quick and easy temporary VPN. Often you can be logged into a remote host before you realise you need a tunnel. Rather than logging out and in again with the tunnel arguments, it is possible to add or remove forwardings from an existing session by using: <newline> ~C This should allow you to open up a SSH commandline on your local machine where you can add, edit or remote the list of current port forwardings using the standard format. Read more →

Monitor Sleep on Screen Lock

I lock my screen when I know I’m popping away from the computer for a few minutes. It therefore makes sense to place the screen(s) in sleep mode while I’m away. On Linux, I use this handy script from a fellow called Marco. I’ve packaged it up for Debian and Ubuntu users to make it easier to install, and can be downloaded from here. On Windows, I use this little program from a fellow called Kevin. Read more →

4k Drive Alignment

With 4k advanced format drives becoming more and more popular, it is important that users understand the differences that the move from a 512 to 4k sector size brings about. During this transitional phase, the majority of larger drives are using 4k sectors internally, but exposing a 512 byte section externally for compatibility reasons. See for yourself using fdisk. Below is the output of a Samsung HD204UI 2 TB drive: Read more →

Aptitude List Recently Installed

Below is a grep one-liner to look through the logs and find out what was recently installed. Comes in handy if you can’t remember what the exact name of that package you installed earlier was. grep "install\ " /var/log/dpkg.log This should give you a helpful output in the form below: root@lambda:~# grep "install\ " /var/log/dpkg.log 2011-07-05 09:17:07 install libpam-modules-bin <none 1.1.3-2 2011-07-05 09:17:13 install libsane-common <none 1.0.22-4 2011-07-05 09:17:52 install libqzeitgeist0 <none 0. Read more →

figlet ASCII art

When sysadmining a number Debian machines, you start to get sick of the default login message very quickly (and they all start to look the same too!): Linux alpha 2.6.32-5-amd64 #1 SMP Wed May 18 23:13:22 UTC 2011 x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Read more →

kexec Fast Reboot

kexec is a handy tool which allows you to perform faster reboots. kexec works by using the existing kernel that is already in memory to boot again. The result is that you do not have to see the BIOS screen again, the new kernel will execute immediately after the system has halted. To install kexec on a Debian/Ubuntu system, use the following commands: apt-get install kexec-tools dpkg-reconfigure kexec-tools This will make kexec your default handler for reboots. Read more →