Jun 11

FUSE and sshfs are two amazingly useful pieces of tech that exist in the linux kernel. The idea of FUSE is to allow file system drivers to exist in user space instead of requiring kernel support. sshfs allows you to mount a remote file system using ssh and access it just like you would any other file system. I use it, for example, to mount my remote website provider to do backups and copy files around. Good stuff. So here are the three little commands that you’ll need to run in order to use sshfs in Ubuntu. This has been ripped from various sources on the internet, so props to the authors.
Install sshfs

sudo apt-get install sshfs

Add your users to the fuse user group where $USER is your userid

sudo adduser $USER fuse

Mount something where $USER is your remote userid and $REMOTEHOST is the remote system you want to mount.

sshfs $USER@$REMOTEHOST:/files /mnt/files

Unmount it when you’re done

fusermount -u /mnt/files

Really neat to play with and the remote nodes don’t have to be linux. They can be solaris, AIX, etc

Jun 10

Regardless of the motivation, sometimes you need an encrypted space to hide stuff and things. Linux has some fairly advanced disk encryption abilities provided by the dm-crypt module. dm-crypt is part of the device mapper suite that is more commonly associated with LVM. I’m assuming that you want to encrypt the first partition of your sdb disk for this tip and that you want to use AES encryption.
First, create the encrypted device.

cryptsetup -y create vault /dev/sdb1

You’ll be prompted to enter a passphrase twice. Next, put a file system on that device.

mkfs.ext3 /dev/mapper/vault

and lastly, mount it and use it!

dmsetup remove /dev/mapper/vault

Subsequent mounts will prompt you for a password. It really was just that simple. Enjoy!

Jun 6

sometimes, you need to take your mp3s another direction, so when you need to go from mp3 to wav, use mpg123 like so

mpg123 -w name_of_wav.wav name_of_mp3.mp3

Jun 2

when I run the free command on my laptop, I get data similar to this.

total used free shared buffers cached
4050260 3988204 62056 0 71160 3551948

That breaks down to
4050260 kb of memory that is usable for programs. This is the amount of system memory that is installed, minus the amount of RAM that is being used for the Kernel, drivers and video card shared memory.

3988294 kb of memory in use. Note that it isn’t saying what the specific use is for, whether it’s programs using it or whether it’s stale. It’s just in use.

62056 kb of memory free. yeah, that’s just A – B = C.

71160 kb of memory in buffers. This is a bit generic, but is the amount of memory that is being used for disk buffers, network buffers, etc. Anything that requires or benefits from having a place to buffer data gets stored here.

3551948 kb of memory cached. This is what’s using up all of your memory and for good reason. Every time a program does a read(), that data gets dumped into cache where it sits until something else bumps it out. This is a good thing because it keeps the OS from having to hit the disk to recall data that it just accessed a few minutes ago. Linux very, very quickly fills up all of the RAM that it can due to this behavior, but the good news is that this memory is essentially sitting free. It takes just as much time to overwrite a memory block with a 0 as it does to write it with a 1, so think of this as a scraps bin where you put cutoffs in case you should ever need them.

If you really want to see where your memory is going, cat /proc/meminfo. A lot of the numbers should look familiar, but a quick look at “Active:” will tell you how much of that memory is in a state where it can be considered untouchable.

May 23

This assumes you’ve already run the convert spaces script. The following script will use mplayer and lame to convert WMAs to MP3s. Not much to talk about here. The wma is dumped to a wav which is then encoded in lame. You’ll end up with WMAs and MP3s of your music and you can pick and choose what you would like to do with them.

for i in `find ./ -type f |grep -i .wma`; do
mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader $i && lame -m s out.wav -o $i;
cp “$i” “`basename “$i” .wma`.mp3″
rm out.wav
done

« Previous Entries Next Entries »