Sorry we could not find the page you were looking for.

Here are some relevant search results instead:

Arduino Relay shield on a Wemos D1

I bought an Arduino Relay Shield to use on my Wemos D1 (ESP8266). After some poking around here is the mapping for which pins enable which relays:

Pin Relay
GPIO13 Relay #1
GPIO12 Relay #2
GPIO14 Relay #3
GPIO4 Relay #4

To enable the relays on this shield you pull the appropriate pin HIGH. Other relay boards I've seen require you to pull the pin LOW, so don't get confused.

Here is the Tasmota template I used for the relay shield.

{"NAME":"Relay Shield","GPIO":[0,0,0,0,24,0,0,0,22,21,23,0,0],"FLAG":0,"BASE":18}
Leave A Reply

Using rsync to backup files as a non-root user

I'm using rsync over SSH to do backups between two systems. When you run your backup as non-root user, you cannot save the files owner or group (uid/gid) because only root is allowed to change ownership. You can however tell rsync to store the owner/group in the file's xattrs. This requires that you mount your filesystems with user_xattr:

/dev/sdb1 /backup ext4    defaults,user_xattr        1 2

Then you tell the writing rsync to use --fake-super

rsync -avP --rsync-path='/usr/bin/rsync --fake-super' /src/dir backup-user@domain.com:/dst/dir

This example is a push backup, if it were a pull you'd put --fake-super on the local side. Then to do a restore you'd do the same thing in reverse with the reading side (where the xattrs are stored) getting --fake-user:

rsync -avP --rsync-path='/usr/bin/rsync --fake-super' backup-user@domain.com:/src/dir /dst/dir

You can see the attributes for a given file with getfattr:

getfattr -d *

# file: dovecot.index
user.rsync.%stat="100600 0,0 89:89"

If you don't get any output, there are no xattrs for that file.

Leave A Reply

Linux file system IDs

If you need to find the uuid of a partition (for grub.conf) it's pretty simple:

ls -l /dev/disk/by-uuid/

Just look at where the symlinks point and you'll know.

Leave A Reply

Xine + Win32 Codecs

Xine is my new best friend! What a badass free media player! I highly recommend it to anyone whoa wants to play video of any sort! Out of the box the RPMS from FreshRpms.net plays Divx/XVid/M$-Mpeg4 just fine. I was totally stoked! In fact the only thing that I couldn't get it to play was some odd old videos that I had that were using some weird WMA (DivX) audio codec. I finally got Xine to play even those!

According to this part of the FAQ you just have to download some files and put them in the config dir. I'll give you my real world instructions to get Xine up and running for you.

The easiest way is to use the RPMS from FreshRPMS.net and install them. You'll need to install several associated libraries just to get it installed, but they're all available from FreshRPMS. Alternately you can use apt-rpm to install Xine which might alleviate installing all the dependencies. Once you have Xine installed run it and enter the config mode (look for the wrench on the GUI). Make sure everything is set ok for your system and make special note on the Codec tab to the path to win32 codec dlls and extract the files there. Restart Xine and you'll be up and running.

A couple of keys that will be pretty useful: "g" hides the player, "f" goes to fullscreen mode, "enter" plays the file, and "space" pauses the file. Woohoo go Xine!

Update: The links are outdated, I recommend the following site to get your Win32 codec fix!
Leave A Reply

Linux Software RAID

Playing with Linux Software RAID I came across the following error:

mdadm: SET_ARRAY_INFO failed for /dev/md0 Which I found out means that you're trying to assign something to an array that is already in use. Which is what I did. I ripped out the array partitions using fdisk and then tried to recreate the array. You have to tell the kernel to stop using that device as a RAID element. mdadm --stop /dev/md0 Then you're free to create all the new RAID elements that you want. mdadm --create /dev/md0 --level 1 --raid-devices 2 /dev/hda1 /dev/hdb1 mkfs -t ext3 /dev/md0 mount /dev/md0 /mnt/raid1
Later I tore out one partition to (simulate a disk failure) and I wanted to add it back. It's actually pretty easy.

mdadm -a /dev/md0 /dev/hdb1 You can determine the status of your RAID array with two methods. cat /proc/mdstat mdadm --detail /dev/md0
Overall I much prefer the newer mdadm utility to manage RAID elements than the older utilities. Linux software RAID is really quite impressive.
Leave A Reply

Linux utilities

I was just introduced to the nice command.  That's pretty handy, especially for background processes.  I'm going to employ it in some backup scipts I'm using.  I figured out how to get Info-Zip to store the UID/GID as well, so it's my backup solution of choice.
Leave A Reply