How to Setup Motion (WebCam Streaming) on the Raspberry Pi 3 Model B

it’s always good to start with :

sudo apt-get update
sudo apt-get upgrade

This just makes sure the system is up to date. Then you need to install the actual motion software

sudo apt-get install motion

then I had to change the permissions of a few files so that the pi user could read and write to them. I had seen that motion was going to create a new user for itself but as of today it’s running as the default user. I didn’t go out of my way to change that behavior since it appears to be the default now on a clean install.

sudo chown root:pi /etc/motion/motion.conf
sudo chown root:pi /var/lib/motion
sudo chown root:pi /tmp/motion.log
sudo chmod 774 /etc/motion/motion.conf
sudo chmod 774 /var/lib/motion
sudo chmod 774 /tmp/motion.log

if you’re having trouble try manually starting motion with

sudo motion

This will let you see the output from the startup and check to make sure video is coming through on port 8081. Also take a close look at the motion.conf file. It’s got tons of explanations of the options and everyone’s setup will be a little different.

Once I changed all the permissions and testes just reboot the Pi to get the daemon up and running. It should start automatically from now on which makes it robust to power outages and disruptions.

Side note: My web cam is 1080 but the processor in the pi couldn’t really support more than 640 x 480 streaming resolution. Good luck!

Handy Linux Commands

Get the size of the folders in any directory

du -sh folder_location/*

Get the size of folders in the current directory

sudo du -chax --max-depth=1 . | grep -E "M|G"

Search for content of a file from the command line

grep [--include=file_pattern.extension] -rnwl "matching pattern"

Create a new SVN Repo

sudo svnadmin create /svn/repos/repo_name
sudo chown -R www-data:www-data /svn/repos/repo_name

Remove Directory and Contents

rm -r mydir

List CPU Usage of running processes


Get Wireless Signal Information


will save in /tmp/file_list_$FOLDER an alphabetically ordered list of all the files inside $FOLDER, complete with the corresponding sub-folders

find $FOLDER -type f | cut -d/ -f2- | sort > /tmp/file_list_$FOLDER

Display all processes accessing a folder or drive (source)

sudo fuser -mv /folder

zpool change mount location (source)

zfs set mountpoint=/myspecialfolder mypool

lsof command to get the process ID of the process holding the lock files (source)

sudo lsof /var/lib/dpkg/lock
sudo lsof /var/lib/apt/lists/lock
sudo lsof /var/cache/apt/archives/lock

Get all processes running “apt” and kill those processes (source)

ps aux | grep -i apt
sudo kill -9 <process_id>

How to Migrate DNS Servers from Old Hosting

When migrating servers it’s best to leave a few months overlap on your old hosting contract. It’s a pain to pay double for a while but it’s critical to preventing downtime.

The first thing to do is get all your files moved over to the new server and test to make sure everything is working the same. Once you are satisfied that your new server is operating properly you can do a “full test run” with the DNS server configurations.

On your old hosting remove the DNS A Records for your old hosting server. It will typically be in there by default. Add a new custom DNS A record pointing to your new server.

This effectively redirects all traffic from your old hosting to the copy on the new hosting. Sometimes it takes as much as 48 hours for these changes to go into effect but in my experience, 15 minutes is more reasonable. Now all the traffic is headed to your new server and since you tested ahead of time (right??) everything is working as it should be.

Now you can migrate your domain names over to the new hosting provider without fear of 48 hours of downtime when your site and apps will be unreachable.

1and1 Cloud Hosting Odoo Install – Ubuntu 14.04

You can install Odoo from the Bitnami package but I wanted to have it from source so that I could make changes and get updates with the git commands.

I followed this guide to get started

Which got me most of the way there but I still had 2 problems.


1 creating the database gave me an error

DataError: encoding UTF8 does not match locale en_US DETAIL: 
The chosen ****** setting requires encoding LATIN1.

To fix this I ran the following commands

sudo su postgres


update pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8' lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;

update pg_database set datistemplate=true where datname='template1';



Then once I had created my database I got an error at the top of the page

/usr/bin/env : node: No such file or directory in ovoo v9
– /website/static/src/less/import_bootstrap.less
– /web/static/src/less/variables.less
– /web/static/src/less/enterprise_compatibility.less
– /web/static/src/less/utils.less
– /web/static/src/less/modal.less
– /web/static/src/less/notification.less
– /base_import/static/src/less/import.less
– /web_tip/static/src/less/tip.less
– /web_calendar/static/src/less/web_calendar.less
– /web_diagram/static/src/less/diagram_view.less
– /web_kanban/static/src/less/kanban_dashboard.less
– /web_kanban/static/src/less/kanban_view.less
– /web_settings_dashboard/static/src/less/dashboard.less

To fix follow the instructions from the NodeJS Website:

curl -sL | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g npm

Then install Less and accessories:

 sudo npm install -g less less-plugin-clean-css

Cleanup Ubuntu /boot directory

use the ‘df’ command to confirm that boot is full
cd /boot
ls -la //to see the files

You will notice a lot of files that seem to have old versions. It’s safe to remove all but the most recent of these files.

sudo rm *.0-23-* //to remove the version numbers that are unnecessary
repeat the process until you only have one latest version left. If you delete the latest version you will seriously mess up your system so be careful.

a final ‘df’ will confirm that you have freed enough space

Leftover Juice Day

I’ve recently found myself with a leftover 2 days of a 3 day juice cleanse and I’ve been challenged to experience it for myself. It all seems a little bit absurd that drinking nothing but sugar water could have a positive impact on my health. I plan to record the experience here just for the record. As I sit here pondering the correct time to have my “1 to 2 cups of coffee” for the day, and thinking I will probably fall asleep somewhere around 3pm, I’m starting to think this isn’t such a good idea. When it comes to coffee the right time is always now.

Juice 1 – Green (edit: this juice is called Sweet Spin)

Just finished juice one. Sweet spin is basically a green fruit juice with rice milk for protein. The flavor was pretty good. Sweet from pineapple without being so sweet because of the greens. I started drinking it as soon as I started feeling a little hungry for lunch. By the end of it I still feel hungry but probably not any more so. I refilled the empty bottle with water and downed that also. I feel like I just drank 2 glasses of water back to back. Not sloshing around yet but definitely liquid.

Juice 2 – Spicy Lemonade

It’s actually pretty spicy. However, now I’m in a bad mood. I wanted this juice an hour ago but it was still a solid block of ice. I tried to drink it anyway only to find the juice was concentrated and all the water was in ice form. So it was a flaming hot & sour syrup devil’s potion. I quickly decided against drinking that. Maybe I’m just pissed at my printer and the fact I’ve been doing paperwork for 2 hours. Spicy lemonade in with-water form is actually pretty tasty. I may need to figure out how to make this on my own. The ingredients are Lemon, Maple Syrup, Cayenne Pepper, Water.

It seems that the time in between juices is growing shorter. Despite my early day juice rationing I may not survive the day. Juice 3 is close enough to thaw so I’m going for it.

Juice 3 – Dr Green – This one is literally named Green unlike Juice 1 which I was too lazy to look at the name

As I look at this bottle of semi solid juice, I cant help but think this is probably a giant marketing scheme. Maybe Jus by Julie is really just 6 fancy juices that no one wanted to buy in a store. Why would anyone buy a juice that says “Kale” as it’s first ingredient. Kale doesn’t make juice? This is like vegetable goop. First sip was a giant ice ball. Vegetable goop with giant ice balls in it. Not a good start. Back on topic, this juice cleanse concept is clearly just a way to convince people to buy 18 juices in one swoop. I can see the marketing team now. Sara say’s I’m fired if I don’t sell 6 cases of juice before the end of the quarter so I convinced everyone in my yoga class that we had a “cleanse.” Help me put these numbered stickers onto the bottles and I’ll take you out for beer and wings.

To which Sara’s reasonable friend responded, “do you think that’s even safe? People are going to just live off juices? ” Sara’s inevitable response would be “I googled it and the internet thinks 3 days is pretty safe. Less talking more stickers.” The juice cleanse was born.

That whole rant seems a little harsh, This green vegetable goop mixed with rice milk (rice goop?) actually probably has more healthy benefits than say 5 cookies. Which coincidentally is what I would like to be eating right now.

Juice 4 – Chia Berry – AKA Strawberry daiquiri

I begin to feel slightly optimistic as I realize there are roughtly 5 hours left of awake time today and still 3 juices. The juice rationing has worked! However, I still have 0 additional beers to drink which unfortunately has been the case all day. This fills me with dread. As I drink this virgin tropical drink I wonder why so many of these have lots of sugar. Aside from the obvious fruit ingredients, can there be a more sinister motive? Perhaps the people who buy juice diets typically lead extremely low sugar lives. If they choose to subsist mostly on grasses and plants, I can see how a diet with 100 grams of sugar per day would indeed make them feel invigorated.

Perhaps in a more positive light, the frontal lobe which controls higher brain functions runs almost exclusively on sugars. That’s why when you get hungry you have a harder time putting up with stupid coworkers and juice diets. Maybe it’s easier for people to suppress their desire for cookies and bailing on juices when their frontal lobes are saturated with sugar. How much effort did Julie put into designing these juices? Is #4 tropical drink flavored to help you survive the commute home and #3 is all fiber to get you through the mid afternoon slump? It’s hard to be sure, the juices don’t come with a schedule.

Juice 5 – Island Coconut

I guess the theme of this juice is that I’m pretty much over juice. Why would anyone want to do this for 3 days? I saw a family member eating cold, leftover turkey chunks out of a ziplock bag and couldn’t help but envy him. It’s been weeks since Thanksgiving so that is not fresh ziplock bag turkey.

I looked down at the back of my milky white, grainy juice and thought, “why is this all sugar. They should have put some fiber powder or something in here.” I feel like I’ve had 7 soft-drinks today and 14 Triscuits. There’s still one more drink to be had after this one. I suppose I’ll suck it down before bed. I keep looking ahead to the morning and wondering what would make this worth the hassle. I guess if my life was like a new beginning with baby soft skin and limitless energy. Rose petals falling from a sunny cloud floating over my head. As long as they cleaned themselves up. No one wants to be that guy who leaves a trail of rose petals.

As a side note I think this probably would make an excellent mixer or chaser. All natural coconut and cinnamon mixed with rum. Blended or on the rocks would probably be excellent. Can this stuff be purchased by the bottle?

Juice 6 – X-treme Greens

One last dose of Kale, Spinach and Hemp Seeds. It has a nice aroma very reminiscent of an orange grove. Earthy and fruity. The flavor is surprisingly neutral with a dominant orange juice flavor that quickly fades. Aside from that this seems like one of the healthier ones. It’s middle of the road on both Fiber and Sugars but has the most protein. Just a few ounces ago I thought juices would be the death of me but this one is surprisingly satisfying. A mix of endorphins as a result of the end of the era of juices, and lightly chilled green goo. It feels very full circle, from the green we are born and to the green we will return.

Final Thoughts

The concept of drinking juices for days just seems absurd to me. I didn’t feel especially hungry at any point in the day today but there were definitely times when I was sick of juice and very full of liquids. There were other times when I was struck by sudden urges to eat foods that I knew to be in the house but hadn’t seen in a long time. All of these seem like my body attempting to balance the nutrition I was receiving. If you’re into extreme diets, into punishing yourself with food or obsessed with juices this might be something you would want to try. It’s great way to have 5 of the same juices instead of food 3 days in a row to rid yourself of any or all of those desires. Alternatively, if you want a moderately health snack once in a while these might be a good option.

Some nutrition information below if you’re interested.

The first juice (Sweet Spin) seems like the best option for anyone looking for a juice / snack hybrid. 4 grams of fiber and 4 grams of protein make it the most balanced with only 18 grams of sugar in 16 ounces. 18 grams is actually the lowest sugar content of all the juices with Spicy Lemonade producing 18 grams of sugar and 0 fiber or protein.

Dr Green is the most substantial with 20 grams of sugar, 6 grams of fiber and 4 grams of protein.

The Simple Way to Mount a Network Drive on Lubuntu – Ubuntu – Debian

There are lots of answers out there for this problem and they are all absurdly complicated. Here’s the easy way to do it and it takes about 2 minutes.

If you don’t have cifs installed then you’ll need to install the utils package. It’s not installed by default with lubuntu. The command is “sudo apt-get install cifs-utils

Create a director to map this folder to in your media folder “sudo mkdir /media/{your folder name}

Then you need to edit your fstab file. “sudo leafpad /etc/fstab

To the end of the file add the following line; remember to replace the sections in brackets with your information
//{your drive IP address}/{any sub folders you want} /media/{your folder name} cifs username={drive_username},password={drive_password}

To test if it’s working type “sudo mount -a” if you did it wrong this will give you some useful error messages. Unfortunately cifs only supports IP addresses currently so you’re stuck with that. It’s generally a good idea to give things like a network drive a static IP address.

Earlier today I installed some updates and ended up having a problem with my mount. I had to add a version flag to the end of my fstab line to get it to work. vers=1.0 I tried vers=2.0 and vers=3.0 which did not work for me.
// /media/nas cifs username=****,password=****,vers=1.0

Odoo 9 Step By Step Install Guide – Linux Ubuntu Lubuntu Debian

Unfortunately Odoo has intentionally made their community edition a little on the difficult side to install. I can only assume this is to drive people to their paid SaaS model. To balance this I’ve put together a guide to getting Odoo up and running and I’ll add updates as I implement and deploy new functionality.

  1. Download Odoo from their website – You’ll want to pick Odoo 9 Community for Linux
    The pick “Latest Debian 9.0” as your download

The install script does a pretty good job setting up new users and getting things installed and put into the correct place. One very critical step that it does leave out is getting Postgresql configured properly. So that’s step 2. You will see a 500 Internal Server Error if you try to access http://localhost:8069 at this point

  1. Setup Postgresql user
    1. Postgresql should have already been installed but if it wasn’t you can use this command to do it from the terminal “sudo apt-get install postgresql
    2. if you get the message “No passwd entry for user postgres” you probably need to do t his
  2. Well need to create a new user and password that odoo can use to access the database – You can do that with these 2 commands
    1. Switch to postgresql user “sudo su – postgres”
    2. Execute the command “createuser –createdb –username postgres –no-createrole –no-superuser –pwprompt odoo
    3. You will be asked to create and confirm a password – This is the password that will protect your odoo database so make it something good and then remember it – you will need it again
    4. Type “exit” to get back to your previous user
  3. Edit the Odoo config file which is cryptically still called “openerp” even though they changed the name of the software quite some time ago
    1. the file is located in “/etc/odoo/openerp-server.conf
    2. on Lubuntu the command would be “sudo leafpad /etc/odoo/openerp-server.conf” just replace leafpad with “gedit” if you are on ubuntu or your favorite text editor
    3. You need to change the 2 lines for “db_user” and “db_paspsword” to odoo and the password you chose before
    4. also add “logfile =/var/log/odoo/odoo-server.log” to the end of the config file so you can track down log files if you need to
  4. You should now have Odoo up and running at “http://localhost:8069“!
    1. You will get a first configuration screen to setup a new database for your instance
    2. Go ahead and pick your password which will be the default password for your administrator user
    3. The default user name (which it wont tell you) is “admin” with the password you picked
    4. Note: if you change the email address of the admin user you will then login with that email address instead of admin


Let me know if you run into trouble!

Windows 10 Tips – Get the Most out of your free upgrade

Many people wont remember and maybe never knew about the Aero features in Windows 7. They didn’t add much functionality but they were essentially the beginning of the redesign we saw in Win 8 and has reached a polished state in Win 10.

You probably know of Alt+Tab as a shortcut to switch between active programs. This still works great in Windows 10. The new addition which adds a lot of value is Windows Key + Tab. This shortcut pulls up a new screen highlighting open windows on the screen they are active. If you’re using multiple monitors this could be a life saver! Use your monitors to organize your windows even when switching between tasks. See a Screen Shot Below!

WinTab ScreenShot

Screen shot of the windows view with the new desktop feature

Force your computer to upgrade to Windows 10

It’s actually very trivial for a user to get the Windows 10 update without having to wait for their reservation from microsoft.

To do so simply navigate to this page and follow the prompts.

Most Likely you will want to Download the 64 Bit Version. Once you have done so it will as you to select the correct Windows Option. Be sure to do this CORRECTLY. You can only update to the same version as you currently have. If you have Windows 8 Home then you need to stick with Home. Windows 8 Pro can upgrade to Pro. There are also options for  Windows N or KN. If you’re in the US these wont apply to you. They are special versions of Windows because various countries have forced Microsoft to remove features from Windows. Just get the normal Windows 8 Pro or Home and you’re off!