SpinRite: How it got me free dinner and drinks for a month

A couple of years ago, I was out having drinks at my then go to bar, Outback Steakhouse. I was pretty friendly with the bartenders and noticed that every time they would cash a customer out, they had to go out of the bar area, run up front, cash them out and come back. I finally asked them what was going on and they told me that their POS at the bar had gone down and it was going to take the vendor a week to come out to fix it.

Me being me, I offered to take a look at it, the manager agreed. I found that it wasn’t booting its operating system (Windows NT) because of a hard drive failure. I decided to take a shot in the dark and run back to my apartment, flash a usb drive with SpinRite, come back to the bar, booted up SpinRite and told them to let it run overnight.

The next day I came in after work and they had already taken the usb drive out and booted up the POS and it worked! They were so grateful that when I would go in there for dinner or drinks for the next month they would comp everything!

So the next time you get a hard drive failure, try running SpinRite on the drive!

Continue Reading

3 Free Services to Backup your Photos

Google Photos

It still amazes me how many people don’t know about Google Photos. Google Photos is a free app and service for iOS and Android that backs up all the pictures from your phone to your existing Google account—and its unlimited! I highly recommend it to everyone just to have a backup for all of their pictures. Now the free version is unlimited but it does slightly reduce the quality of the photos but it’s so minimal that most people won’t see a difference.

Aside from just having a backup, Google Photos is a great way to free up space on your phone. Once you have all of your pictures uploaded, you can confidently delete them from your phone having peace of mind that they’re backed up on Google’s servers.

Amazon Prime Photos

Another service that people overlook is Amazon Prime Photos. Most people nowadays are Amazon Prime members, but one of the benefits of being a member is they offer unlimited backup of photos from your iOS and Android device. And unlike Google Photos, they backup your photos at their original quality.

Dropbox

If you have a Dropbox account, you can use the service to automatically backup your photos on your iOS or Android device for free. Granted, a Dropbox free account only provides you with two gigs of free storage, but what some people do is use it until it’s completely filled up and then moving all of the pictures to a flash drive or an external hard drive for safe keeping.

Multiple Backups

Those are just three ways to freely have continuous backups of all of your photos. There is no reason why you can’t use all three of these services at the same time, in fact, I recommend it! The typical rule of thumb is your files aren’t completely backed up until there are three different copies in three different locations.

Continue Reading

Starting next month, your iPhone will have a panic button

With the new version of iOS set to come out next month, iOS 11 will now have a “panic button”. Starting with iOS 11, if you rapidly press your power button five times, it will bring up a prompt that will allow you to quickly call for emergency services or to let someone see your emergency medical information if you have set it up in the Health app on your phone.

This feature is also being called “the cop button” because once you trigger it, it will temporarily disable the fingerprint sensor on your phone so you’ll need to enter your passcode to unlock it. After all, law enforcement can make you use your fingerprint to unlock your phone, but they can’t force you to tell them your passcode.

You can disable this feature if you choose by going to Settings and Emergency SOS on your phone.

Continue Reading

No-IP: Give your Dynamic IP Address a Static Hostname

Every once in a while I get in the need of a static IP address for a network that has a dynamic IP address. Now usually, if it’s going to be for something like a permanent server or something, I’ll go ahead and call up the ISP and pay the $10 or $20 extra per month to get a static IP address through them. But if it’s just for a short term project or I’m just tinkering around on something, I’ll use a service called No-IP.

No-IP is a free service that allows you to get a DNS name for your network that also has a script for Windows, Mac or Linux that monitors your connection’s public IP address and when your IP address changes, it will automatically update your DNS record with the new IP address so that host name always resolves to your desired network.

Again, for “mission-critical” applications, I’d much rather recommend getting a static IP address from your internet service provider but if you’re just toying around, check out No IP.

Continue Reading

My Raspberry Pi Setup

I recently had to reconfigure my Raspberry Pi because I bought a bigger micro-sd card for it (128 gb, up from my 8 gb). I thought I’d post my process since typically I do a headless install, meaning getting it up and running without a monitor, mouse or keyboard.

Flashing and Enabling SSH

First since I’m on macOS, I use a script called Pi Filler to flash the sd card with Raspbian. I still use the Raspbian image from April 2017 since the July 2017 image has something funky that messes with the flash process.

To use Pi Filler:

After you have Raspbian onto the sd card, you’ll need to enable SSH to run on boot.

To do this, you’ll need to create a blank file with the file name “ssh” and copy it to the root directory of the partition labeled “boot” on the sd card.

What I do:

  • Open Terminal on your Mac
  • Type the command “vim ssh” followed by “:wq”. This will create the empty file “ssh” in your home directory.
  • Then you can go into Finder and simply drag the “ssh” file to the “boot” partition.
  • Eject the sd card and put it into your Raspberry Pi

Once you connect your Raspberry Pi to power and ethernet, it should now boot up Raspbian with SSH enabled.

Logging in and Post Install

You will need to figure out the ip address of your Raspberry Pi in order to SSH into it. For myself, the quickest way to do this is to login to my router and look at the DHCP client table. If you don’t have access to your router, you can use a script called Pi Finder.

Once you find the local ip address of your Raspberry Pi, you can now login to it. For macOS and Linux, you just need to open your Terminal and type:

ssh pi@xxx.xxx.xxx.xxx

Where “xxx.xxx.xxx.xxx” is the ip address of the Raspberry Pi and enter the default password “raspberry”.

If you’re on Windows, you can use Putty to SSH in.

You can either decide to leave your Raspberry Pi on DHCP which means it’s ip address will change over time or you can set either the ethernet or the wireless adapter to always use a static IP address. I somewhat cheat on this, I setup DHCP Reservation on my router so every time I rebuild my Raspberry Pi, my router automatically recognizes my Pi and gives the ethernet adapter the IP address of 192.168.1.201 and gives the wireless adapter the IP address of 192.168.1.200.

The very first command that you will want to give your Raspberry Pi once you get logged in via SSH is: sudo apt-get update

This will make sure that your Pi knows where to go look for the latest software updates.

Just because I’m me and can’t stand not having my favorite text editor, vim, I usually install that next by typing: sudo apt-get install vim

After that it comes time to run: sudo raspi-config

This is a utility developed within Raspbian to configure it for the Raspberry Pi. The first option that comes up is to change the default password for the “pi” user. I usually do that first.

Then I go into Boot Options and Desktop/CLI. I always use Console with Autologin. Since I don’t use a monitor or VNC with any of my Pi’s there’s no point in it wasting memory and processor usage on loading up the GUI.

Finally, I go down to Advanced and hit Expand Filesystem. This repartitions your sd card to use the entire free space on your card.

After all of that, when you quit raspi-config it should prompt you to restart but if it doesn’t, enter: sudo shutdown -r now to go ahead and reboot your Pi.

Finally, the last thing that I do after it comes back up is: sudo apt-get upgrade This will upgrade all of the packages on your Pi to the latest versions.

Optional: Setup Wireless

I usually always run my Raspberry Pi’s off of wi-fi just to be able to put them anywhere I want and out of the way.

To setup your Raspberry Pi to automatically connect to your wireless network, type in the following command in your SSH prompt: sudo vim /etc/wpasupplicant/wpasupplicant.conf

At the end of that file add:

network={
ssid="Your wireless network name"
psk="Your wireless network password”
}

Once you do that, your Raspberry Pi will automatically connect to your wireless network the next time you reboot.

Optional: Setup External Hard Drive

I have a one terabyte external hard drive connected to my Raspberry Pi just to give me some extra space.

To add an external hard drive, firstly create the directory where you will want to access the drive. For myself, I usually use: /mnt/e so at your SSH prompt, type sudo mkdir /mnt/e

Then you’ll need to identify the device name for your drive. Typing: sudo fdisk -l will list all of the storage devices connected to your Raspberry Pi. You should be able to tell which device is your external drive based on capacity. But more than likely, if you only have one additional drive connected, it’s going to be /dev/sda1

If this is a new drive, you’ll want to format it to the Linux file system, ext4. To do this, at the SSH prompt, type: sudo mkfs.ext4 /dev/sda1

Lastly, you’re going to want to make that drive mount on boot, so type sudo vim /etc/fstab and at the end of that file, add the line: /dev/sda1 /mnt/e ext4 defaults 0 0

And there you have it! The next time your Raspberry Pi reboots, it will mount your drive on the directory /mnt/e!

Continue Reading

My Web Server Backup Script

I thought I would share this simple script that I wrote for my web server to back it up every night.

This simple python script:

  • Creates a temporary directory to copy everything to
  • Copies everything in my home directory
  • Copies everything from my root web directory
  • Copies my php.ini file (I hate resetting up my php.ini file)
  • Dumps all of the databases that I may have in MariaDB into a nice SQL dump file
  • Tars everything up into a single file
  • Then uses one of my favorite Linux CLI tools, RClone to copy the tar file to my Google Drive
  • Cleans up the temp directory that it created
#!/usr/bin/python

import os, time

f=str(time.time())
c="cwfraziercom"
p="/var/backup/"

os.popen("mkdir "+p)
os.popen("cp -r /root "+p)
os.popen("cp -r /var/www/ "+p)
os.popen("cp /etc/php.ini "+p)
os.popen("mysqldump -u root -pPassword > "+p+"sql.sql --all-databases")
os.popen("tar -zcvf /var/backup.tgz "+p)
os.popen("/root/rclone/rclone copy /var/backup.tgz g:/Backups/WebServers/"+c+"/"+f+"/")
os.popen("rm -rf "+p)
os.popen("rm -rf /var/backup.tgz")

I then just schedule the script to run every night by scheduling it as a cron job.

Also, just in case you’re wondering, the reason that I assign the file name as the value of the current epoch time is so each backup file has a unique file name. I keep all of my backups forever so the last thing I want is overlapping file names and accidentally overwriting old backups.

Continue Reading

Digital Ocean: Great VPS for Personal Projects

When I first started my business, the first thing that I had to host for a client was their email and website. I forget how I found them but for a couple years I rented a VPS from a company called Server Intellect which I later upgraded to a full on dedicated server. And then I came across Amazon Web Services and used their EC2 service to launch and run servers for my clients whenever I needed to. In fact, I was the consultant that helped manage one of my local community colleges, (Taft College) transition from hosting their website on-premise to Amazon Web Services.

I’ve always preferred AWS over Microsoft’s Azure or Google’s Compute Cloud quite honestly just because I am so familiar with it and already had my account setup as well as server images for different setups that I had.

However, probably around a year ago I switched all of my personal stuff such as scripts and my website over to Digital Ocean. Although I still advise businesses to use Amazon Web Services just because they have so many more advanced options and integrations with their other services, I recommend Digital Ocean for people like me who essentially just want to tinker around or just need to have a VPS for personal use in the cloud.

Digital Ocean refers to its server instances as “Droplets”. One of the things that I love about them is that all of their droplets comes with SSD hard disks (and you can really tell). Also, their entry level prices are unbeatable, starting at $5 for a droplet. But probably the thing that I love most about them is the simplicity of their console. They make it ridiculously simple to spin up a new VPS in a matter of minutes.

So the next time you need a VPS, give Digital Ocean a look!

Continue Reading

Software Subscriptions: Why I can’t be mad at them (and neither should you)

Remember when a new version of Windows came out and those of us that were capable of upgrading our computers ourselves, we would all go to our local computer shop and buy a copy of it on a CD and that was it. We owned that version of Windows. There wasn’t an on-going monthly or annual cost, wasn’t that great?!

There has been a trend going on for the past few years that has been becoming increasingly popular among software companies known as software-as-a-service or SaaS or subscription pricing models. So instead of putting out $50 or $100 for a piece of software once, you pay a minimal amount every month to have access to the piece of software.

This trend was made mainstream when Adobe started selling their flagship product, Photoshop as a subscription. Then Microsoft followed by offering Office as a subscription. But where this model has really taken off has been with smaller software development companies, for instance, Evernote has always been a subscription, my journaling app DayOne has recently switched to a subscription model, hell, the app I’m using to write this right now, Ulysses switched this past week.

Nobody I know likes this trend, in fact, everyone loathes it. But I have a different take on it because of personal experience. For the first half of my business career, I made approximately 80% of my income developing custom databases and software for local businesses. I would go in and spend a few months trying to understand the clients workflows and processes and then when I got a good grasp on what they needed, I would spend the next six months to a year building their software for usually in between $6,000 – $12,000. It was great! I was happy, the clients were (usually) happy with the end product, everything was good…until it wasn’t.

What I learned was that software is never truly “done”. Just to keep it running as is, there’s always the inevitable maintenance that needs to be performed. And in my case, the software I developed always had a database backend so that meant that servers had to get paid every month, security patches applied religiously and of course backed up constantly. Aside from general maintenance, on every occurrence, for every system I developed, once it was in place, a few months would go by before I’d get a “what if…” email with a question or a request that someone thought about would make the system work better. That’s all well and good but the problem was that even if the client was willing to pay for the extra work (which typically wasn’t the case), I had already moved onto my next project and didn’t have the time to put the energy in that it needed. After all, I still had to live, I HAD to move onto the next project in order for cash to keep coming in to be able to pay rent, eat, pay whoever I had working for me at the time, etc.

This is why I think more and more software companies are moving to subscription based pricing models. Because the people who are writing the actual software have mortgages, families to take care of, car payments, dogs to feed, etc. Good software is very hard work and the people that do the work deserve to get paid for it.

Continue Reading

Electronic Frontier Foundation’s Let’s Encrypt

In the early days of my business, one of the first services that we offered was web development and design, to be quite honest because it was fairly easy to sell at a large profit margin. However, with me being me and having an intense background in system and server administration, we not only designed and developed the websites, we would also provide the hosting and maintenance for those sites.

All well and good except that some of those websites had either e-commerce built into the site or collected sensitive information from their customers or patrons. So it was a must to use SSL certificates to secure the data while in transport from the user’s browser to our servers (I’ll get into securing and encrypting that data at rest some other day). Back when we were doing it, you had to go find a trusted certificate authority that you actually trusted such as Verisign or Norton that usually came out to a few hundred dollars every year, generate your public and private certificates on your server then getting them to work with whichever web server you had. It was a mess. By far the thing that I hated doing the most for web hosting.

That’s why I was so stoked when I found out about a year and a half ago that The Electronic Frontier Foundation (EFF), in an effort to make SSL connections the new default, not only was becoming a certificate authority, they developed a tool called Lets Encrypt that makes it ridiculously simple to enable SSL on your website. All you have to do is go to https://letsencrypt.org, choose your operating system and web server and it will download the appropriate script. Oh yeah, it’s completely free!

Since Let’s Encrypt has came out, I have used it for every web server that I’ve set up whether it needs it or not. It literally on takes about five minutes to setup so why not?

Continue Reading