Raspberry PI for the logic. it’ll have it’s own 802.11n USB adapter


Project Ideas:

The promise, is to use an ESP8266, to control a bunch of relays.  Using the Raspberry PI for logic control.

  1. DIY 1 plug relay – HRV control.
    1. Check to see (via the NEST) if the humidity is high or low, run the HRV
    2. Intermittent running of HRV when
      1. Run HRV if not during peak/high energy rates…
  2. DIY 8 plug power bar, timer on/off control.
    1. Build your own power bar, that is WIFI controlled.
    2. ESP8266 has several GPIO pins.  Wire them up to relays, to get some relay action going.
      1. Printer on demand.
      2. Scanner on demand.
      3. VPN hardware on during weekdays work hours.
      4. Monitors (5watts on standby).
      5. USB power on standby.
      6. Thunderbolt belkin on standby when not in use.
      7. USB External HDs???
  3. DIY 8 plug power bar, timer on/off control.
    1. TV
    2. Set top box
    3. blue-ray player
    4. PS4/XBOX etc…


Watts Ander-Lign Compression fittings

I was looking around, and couldn’t find anything.


Lots of people on home-depot felt that these things were not the greatest.

Problems that people ran into, where reusing the old tubes.  These are meant for a complete system.  It’s color coded for ease.

I was using the 1/4″ tubing so that it’ll fit my under the sink reverse osmosis filtration system.  I needed to connect the tank line to the fridge/icemaker.

I went and bought a T, and another coupler.

I could not find any instructions directly for the watts Ander-Lign compression fittings/coupler.  This is what I found to work (with no leaks):

  1. Do not disassemble the unit.
  2. Finger tighten the assembly
  3. Cut the plastic tube flush
  4. Insert the tube directly into the brass fitting, while the unit is STILL assembled.  Push until it doesn’t go any further.
  5. Using a pair of wrenches, do a 3/4 (three quarter) turn of the nut to compress the brass sleeve.

Items purchased from home depot:

  • Watts (A-12) Ander-Lign Compression Tee
    • For splicing off the reservoir tank
  • Watts (A-4) Ander-Lign Compression Nut
    • For fridge connection
  • Watts Polyethylene Tubing (SPEB25) 1/4″ x 0.170″ x 25 ft

Hope this is helpful for others, as I couldn’t find how much to tighten the nuts.  Seems to work for me… your milage may vary.

BTSync on AWS EC2

Objective: Allow Ubuntu to start BTSync on reboot.



  1. create an EC2 instance, with appropriate storage space.
    • Ubuntu LTS 64bit (currently 14.04)
  2. download the BTSync client
  3. dump the btsync.conf
    1. ./btsync –dump-sample-config > btsync.conf
  4. edit the btsyn.conf for your settings.
  5. sudo su
  6. create /etc/init.d/btsync file
    • See below
  7. chmod 755 /etc/init.d/btsync
  8. update-rc.d btsync defaults
  9. service btsync start
  10. test the connection against other boxes.


  1. Since we’re on EC2, and security is paramount.
  2. Establish a port tunnel
    1. sudo ssh -i ~/.ssh/EC2KEY.pem -L 8888: ubuntu@serverHostNameOrIP
  3. Connect to the system via:
  4. Verify that all is working on the server end.



  1. Connect w/the shared keys.
  2. Verify that the system is working.
  3. Put a file into the shared folder. Notice that the file should go up to the server.


On the Server EC2 instance.

create the file /etc/init.d/btsync


# /etc/init.d/btsync
# @see: source

if (( $EUID != 0 )); then
    echo "Please run as root"

# Carry out specific functions when asked to by the system
case "$1" in
    /USERACCOUNT/.btsync/btsync --config /USERACCOUNT/.btsync/btsync.conf
    killall btsync
    echo "Usage: /etc/init.d/btsync {start|stop}"
    exit 1

exit 0


Update 2014-08-23

  • changed the init.d script to bash, and added root check.
  • Noticed that BTsync does not work well over a VPN connection.

How/What do you backup?

Things of importance

  1. Family photos/videos
  2. Documents
    1. scanned docs
    2. license/registration information for software
  3. Everything else.



How to backup, rule of 3-2-1

3 – (three) copies of everything of importance.

2 – (two) media types at least.  Remember floppies? Remember Zip disks? Beta tapes… yeah…

1 – (one) off site copy.  Home burns down… you’re fine, data wise… and insurance for the rest.

So, how do I implement this:

  • BTsync/dropbox/, to get offsite backups running quick and easy.  Sparkle share was a little too much effort, needing a git repo.
  • BT Sync, will make multiple copies easily across your network, with super ease.
  • my amazon ec2 instance will be a offsite node, which can then push to glacier or s3.

Eventually, I’ll write some crons to do the auto pushing to S3/glacier.  I’ll share them once I do (2014-08-03)

Mass VHOST wildcard; subdomain to folder

I couldn’t find any information as my search terms were incorrect. My google-fu was off when I was searching.

My objective was to make http://* go to /var/www/*/www, where * is a wildcard.

I’m hoping that this will help others; specifically developed that work on multiple projects.

First, I wanted to wildcard my in my hosts file. I knew I couldn’t do this: *

as that’s now how hosts files work.

DNSMASQ to the rescue, to wildcard the hosts file.
Apache mass vhost, is a technique to setup lots of vhosts based on a pattern.

Some applications such as magento likes to have a proper full domain name.  Also makes testing more realistic as well.

Since I’m on OSX, install it via ports.

The instructions are a mash of: and other sites… you may have to restart dnsmasq after you’ve made the changes.

sudo port install dnsmasq
sudo cp /opt/local/etc/dnsmasq.conf /etc/dnsmasq.conf
sudo mkdir -p /System/Library/StartupItems/DNSMASQ
3.) sudo mkdir -p /System/Library/StartupItems/DNSMASQ
4.) sudo nano /System/Library/StartupItems/DNSMASQ/DNSMASQ
. /etc/rc.common
if [ "${DNSMASQ}" = "-YES-" ]; then
  ConsoleMessage "Starting DNSMASQ" 
5.) sudo nano /System/Library/StartupItems/DNSMASQ/Startup Parameters.plist
  Description = "Local DNSMASQ Server";
  Provides = ("DNS Masq");
  OrderPreference = "None";
  Messages = 
  start = "Starting DNSMASQ";
  stop = "Stopping DNSMASQ";
6.) Add line to /etc/hostconfig
7.) sudo chmod +x /System/Library/StartupItems/DNSMASQ/DNSMASQ
8.) sudo /System/Library/StartupItems/DNSMASQ/DNSMASQ
9.) In network settings make sure is in your dns server list.  If you do:
  You should see something like this near the bottom (if not, your network settings need to 
  be applied.. try this to flush dns cache: dscacheutil -flushcache ):
    ;; SERVER:
  # test it.
  : PING ( 56 data bytes
  : 64 bytes from icmp_seq=0 ttl=64 time=0.031 ms

add the line to /etc/dnsmasq.conf
$> sudo nano -w /etc/dnsmasq.conf ## or your favourite editor, as root.


Clear your dns cache.

dscacheutil -flushcache

You may need to setup your network connection to point your DNS to localhost first.

sudo kill -HUP `cat /opt/local/var/run/`

my vhosts Magic

Alias /phpmyadmin /opt/local/www/phpmyadmin

<directory "/www">
	Options -Indexes FollowSymLinks
	AllowOverride AuthConfig FileInfo
	Order allow,deny
	Allow from all

<directory "/opt/local/www/phpmyadmin">
	Options -Indexes FollowSymLinks
	AllowOverride AuthConfig FileInfo
	Order allow,deny
	Allow from all

UseCanonicalName Off

LogFormat "%V %h %l %u %t "%r" %s %b" vcommon
CustomLog logs/access_log vcommon

# include part of the server name in the filenames
VirtualDocumentRoot /www/hosts/%1/www

Automated watering system project notes

The plastic T-connectors broke over the winter.  Not very hardy.  Use the internal ones with hose clamps.

The solenoids kept up, so far.


Lost the code to the automated system.


GPIO pin 7 – Far East solenoid – hanging plants.

GPIO pin 8 – One West of Pin 7 solenoid – walk way floor bed. Soaker hose. North side of garage.

GPIO 24 – not in commission ATM (2014-05-14) reduced watering schedule, to stress plants to help fruit. Back deck.

GPIO 25 – not in commission ATM (2014-05-14) [was in action, but disabled, as overgrown with weeds. South side of garage.


Cron job should be

GPIO pin 7 morning, evening 30 seconds, spray

GPIO pin 8, 60 minutes, morning.

GPIO 24/25, …




Web Status page, for GPIOs…


[fixed] raspbian / debian apt-get connect (101: Network is unreachable)

Are you having issues

When I ran:

$> sudo apt-get install mosh

Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libio-pty-perl libprotobuf7 libutempter0
The following NEW packages will be installed:
libio-pty-perl libprotobuf7 libutempter0 mosh
0 upgraded, 4 newly installed, 0 to remove and 1 not upgraded.
Need to get 767 kB of archives.
After this operation, 2,190 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Err wheezy/main libio-pty-perl armhf 1:1.08-1
Cannot initiate the connection to ( – connect (101: Network is unreachable)



To fix this error:

$> sudo route add default gw

This will add the default gateway to route… as the RPi can’t find it’s way out of the network.


xdebug.ini with phpstorm

[Server xdebug.ini file]
xdebug.remote_connect_back = On

Zero config phpstorm xdebug mode will now work.



[Ensure your router isn’t blocking xdebug]

Port Trogger is turned on

  • Trigger port: 80/tcp
  • Incoming port 9000/tcp


Set your local machine as the DMZ


Port forwarding