How to Take Control of Your Data & Privacy

Data Privacy

You don’t want to hear this, but . . . you are a product. You have forfeited your data and privacy for convenience.

You have grown to love Google, Facebook, Instagram, Twitter and Snapchat. What is there to not to love about these services? They are free and they allow you to connect with people from all over the world? They are great!

Kinda . . .

Every like, every post, every web search and every social interaction you perform online feeds giant Silicon Valley companies with a LOT of personal data about YOU.

But who cares? You like consuming stuff. You don’t care if you see advertisements about things that you like.

We now live in the age of Surveillance Capitalism.

Where do we draw the line? These companies want to create compelling, useful products that get you to use their services. However, we need to be responsible for how much time we spend using their services and how much information we give them. They will not do this for us.

Once you realize that the amount of time you spend on a phone or in front of a computer you may begin to ask yourself; Do I really like this stuff? Did an algorithm tell me to like this stuff? If I spend the vast majority of my day online, are my decisions actually mine, or are my decisions being engineered? Could this affect other aspects of my life, not just my spending habits? Has it impacted me politically? Do I have my own personal beliefs and values or am I subtly being influenced slowly over time every time I get online?

Without your data, their algorithms cannot feed you curated advertising. Without curated advertising, what might your life begin to look like given the fact that we all spend way too much time online? What might happen to the business model’s of these corporations when their curated advertising platforms are no longer as effective because they don’t know anything about  you?

The following steps will help you stop giving these companies as much data.

Browse the Web Privately

Download a private web browser like Brave. This browser will block trackers allowing you to enjoy private, secure and fast browsing. It is private because it blocks trackers. It can be faster because you do not use bandwidth to download ads, they are blocked. You can also get Brave for iOS and Android.

Stop using a search engine that tracks you. Google tracks you. Use DuckDuckGo to search online. It may take some getting used to. It probably isn’t as good as what you are used to. Slowly try to use this search engine more than others. DuckDuckGo claims to be the “search engine that doesn’t track you”. Do  your research. You can never be 100% sure that a 3rd party actually does what they say they do.

Logout of Your Accounts When Browsing

For some people, being continuously logged into services like Facebook, Google, and Twitter is absolutely necessary. If you have to be logged into Google for Gmail at work for example, logging out and logging in every time you want to browse the internet would be very time consuming. In this case, use a traditional browser of your choice: Chrome, Firefox, Safari, etc, for “business as usual” web activities. Just don’t surf the web using this browser. Use Brave as a secondary browser for browsing privately and securely.

If you don’t have a problem logging in and out of all of the various websites you visit, you can use the Brave browser exclusively. You can also use a Brave incognito window. This will allow you to be logged into the services you need to, while remaining private in the incognito window.

Use Encrypted Email

Stop using publicly available free email providers like Gmail. It is difficult to ditch email services. You’ve probably been using the same email address for years. But they are collecting our information at a staggering rate. Use an alternative email provider like ProtonMail. ProtonMail is a privacy-enhanced email service in Switzerland. It offers end-to-end encryption, a Gmail-like user interface, secure compatibility with other email providers, and does not track its users. Do your research. You can never be 100% sure that a 3rd party actually does what they say they do.

Delete Unnecessary Social Media Accounts

This is the hard part.

In the same way that you declutter your house, you must declutter your data presence online. If you haven’t worn a shirt in 3 months, donate it, get rid of it. If you don’t use something, get rid of it. If you aren’t trolling Tinder for hookups anymore, delete your account, delete the app from your phone. The same applies to Facebook, Twitter, Instagram, Snapchat, etc.

If this seems too hard, that’s ok, get rid of what you can. Something is better than nothing. Some accounts might be absolutely necessary for work or for other reasons. Strive to get rid of as many social media accounts as you can. They are all hoarding your data and selling it. If you aren’t using them, they are just a distraction.

This, of all the steps may be the most difficult for most people. The thought of not seeing what your friends are doing may be unbearable. But, there is an entire world around you, waiting for you. People will prevail, while platforms like MySpace and Vine fade to a distant memory. In ten years, the apps you commonly use today may no longer exist.

Stop Using Credit Cards

Every credit card you use shares your information. Some credit cards allow you to “turn off” the sharing of some data. However, the vast majority of the data is shared without the ability to stop it. Don’t believe me? Take a look at Capital One’s Data Sharing Policy. You can only stop three of the seven options.

Here is the deal. I’m not a financial adviser. If you don’t have cash to buy something, you shouldn’t be buying it in the first place. I know what you are going to say. But . . . but . . . but . . . I pay my credit card bill in full every month, and I get free points for using the card. Yes, yes you do. But why are the points FREE? They are free because they want to keep you using the card, hopefully catch you in a bad spot, collect interest, while SHARING YOUR DATA. If you want your purchase history to be kept private, stop using a credit card.

I’m not suggesting that you cut up your cards. Not at all. Those can be useful in emergency situations, like when traveling. What I’m saying is to limit your usage of your cards. You obviously can’t write a check for your Spotify or Netflix subscription. What I am suggesting is that you use cash for day to day expenditures. Use your credit cards for things that most certainly have to be paid using credit Card. If you are really cutting edge and live in an area that supports it, use a crypto currency.

Summary

Take responsibility for your privacy and your data. Do not wait for Government Regulation to protect you. Do not rely on Silicon Valley to reform in order to respect you and your privacy. Do your research. Be an adult, own it, and change your reality.

Gravity Form Google Places API Autocomplete

This demonstrates the autocompletion of an address field in a gravity form using the Google Places API.

Testing

How to Disable Bitnami LAMP Stack for AWS Cloud Caching

On Bitnami LAMP Stack for AWS Cloud, when making code changes, the changes are not immediately visible once the changes have been saved. Even after several refreshes, the server caches the pages. Changes are not visible until the pages are refreshed many times. To disable caching perform the following steps.

Step 1


PageSpeed is enabled. Disable it by editing the httpd.conf file found at: /opt/bitnami/apache2/conf/httpd.conf

Include conf/pagespeed.conf
Include conf/pagespeed_libraries.conf

Comment out the following two lines. Save the file and exit.

Step 2


PHP has Op Cache enabled. Disable it by editing the php.ini file found at: /opt/bitnami/php/etc/php.ini

opcache.enable=1
opcache.enable_cli=1

Disable this by changing the 1 to 0. Save the file and exit.

Step 3


Restart the Bitnami LAMP Stack for AWS Cloud instance.

sudo ./ctlscript.sh restart

Your server should no longer cache the pages. Development work should be much easier. When development is complete, you may want to enable PageSpeed and enable PHP Op Cache.

How to Make Raspberry Pi Bluetooth Proximity Monitor

Introduction

This project uses a Raspberry Pi W Zero to continuously monitor an area for a specific Bluetooth MAC address. When the Bluetooth MAC address is within a certain range, a WeMo connected device is turned on. When the MAC address leaves the area, the WeMo devices is turned off.

There are many use cases for this other than turning a WeMo device on and off. This could easily be modified to initiate any action. For example: send a text or an email when a specific Bluetooth MAC address is near by. Notify you when your kids or wife arrive and leave. Have the device speak a customized greeting using gTTS (Google Text to Speech), etc.

There are many different us-cases.


Hardware Required

Raspberry Pi W Zero Starter Kit

You can get the Raspberry Pi components more cheaply on many websites. However, this one has everything you need to start, including a case and power supply.

SanDisk 16GB SD Card

A large SD card isn’t needed for this project. As stated above, this device will only be used to monitor Bluetooth activity.

Igsignia SD Memory Card Reader

This isn’t 100% necessary. If you have a SD card reader, you do not need this. I personally like this because I can install Raspberry Pi operating systems onto SD cards from any computer.

WeMo Smartplug

This will be used to let the Raspberry Pi turn on the light.


Software Required

NOOBS Lite


Setup the SD Card

Download the NOOBs Lite operating system for your Raspberry Pi

There are several ways to install Raspbian on a SD card. I have chosen to use NOOBs in these instructions because it is the easiest for a beginner. NOOBs light is a lightweight bootable interface that allows you to use a Wi-Fi connection to choose the operating system that you want to install. We will be choosing a lightweight OS called Raspbian Stretch Lite. The reason for this is that this Raspberry Pi will serve only one purpose, Bluetooth monitoring. All of the other bells and whistles found in all other Raspberry Pi operating systems are not needed. This is typically refered to as a headless system, one that operates without a monitor. If you don’t want to use NOOBs, you can install Raspbian Stretch Lite directly by downloading it and flashing your SD card with the image. View instructions on How to Install Raspbian Stretch Lite on SD Card.

Unzip the NOOBs Lite zip file. Extract all of the files to a folder on your computer.

Put the SD card into your SD Card Reader and browse to the SD card folder. Copy all of the files extracted from the NOOBs zip file into the root directory of your SD card.

Remove the SD Card from your SD card reader.


Setting up the Raspberry Pi

Insert your SD card into the Raspberry Pi Zero board.

Plug the micro HDMI cable that came with the kit into the Raspberry Pi. Plug the other end into a display of your choice.

Use the micro USB cable that came with your kit to plug in a keyboard.

Plug the power cable that came with the kit into your Raspberry Pi. Plug the other end into a wall outlet.

The Raspberry Pi will boot for the first time.

You will be prompted to select a Wi-Fi network. Select your network and enter your password. This Wi-Fi connection will be used to download the operating system. You may need to flip flop between a USB mouse and keyboard to go through the prompts.

When prompted to select the operating system, choose: Raspbian Stretch Lite

Once connected, your Raspberry Pi will begin downloading Raspbian Stretch Lite. Once complete, your Raspberry Pi will reboot.

When prompted, you may be prompted to enter the default username and password:

pi:raspberry

It is recommended that you change the default password. It is never a good idea to keep defaults. This can be done using the following command:

sudo passwd

Setting up the Raspberry Pi for Bluetooth Proximity

Let’s make sure everything is up-to-date before installing any packages. Issue the following commands:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install vim
sudo update-rc.d ssh enable

I personally like using Vi or Vim editor. Enable SSH so that you can control the Raspberry Pi remotely if needed. It is a lot easier to SSH into the Raspberry Pi and mange it than to have it plugged into an external display.


Install Python

Our Python program was written for and tested against Python 2.7.13. If you want to use a newer version of Python, you may need to modify the code for the Bluetooth Proximity monitor. Check your version of Python:

python –version
sudo apt-get install python
sudo apt-get install python-pip
sudo apt-get install bluetooth libbluetooth-dev bluez bluez-tools
sudo python -m pip install pybluez

This will install python and pip. It will also install some tools for working with Bluetooth devices.

Navigate to the pi home directory. It should be: /home/pi/

Download the bluetooth proximity monitor python code to your raspberry pi:

sudo wget https://jaydensibert.com/code/bluetooth-monitor.py

Change the permission of the file:

sudo chmod 777 /home/pi/bluetooth-monitor.py

Edit the script, replacing the temporary Bluetooth MAC address with your own MAC address. On an iPhone, you can find your Bluetooth MAC address by going to Settings > General > About > Bluetooth. Save the file, and run the program:

sudo python bluetooth-monitory.py

Setup Script to Control WeMo Device

Install PeeWee:

sudo pip install peewee

Install git:

sudo apt-get install git

Navigate to a directory where you want to install the WeMo Control python libraries. Take note, you will need to modify the bluetooth-monitory.py program to use this path. It would make sense to put it in the pi home directory: /home/pi/, Download the repository:

git clone https://github.com/ericpulvino/wemocontrol

change the permissions of the library:

sudo chmod 755 ./wemocontrol/*.py

Edit the top of your ./wemo_backend.py (it should be inside the directory that was just created in the above step) file to setup a storage location for database and also make nicknames for your WeMos and their IP addresses. I only have one device and the edited portion of the wemo_backend.py file looks like this. Your IP address and name of the device will obviously be different.

db = SqliteDatabase(‘/home/pi/wemocontrol/database.db’)

wemos = [
(“192.168.1.6″,”downstairs”,”Downstairs”)
]

If you do not know the path to your WeMo, you can use a network IP scanning tool to find it. An easy app to use on the iPhone to find the IP address of the WeMo is Fing, but there are many tools available.

Run the following commands to setup the database and populate it with some initial values:

python ./wemo_backend.py
./send_wemo_commands.py multiupdate

Modify bluetooth-monitor.py to turn the lights on and off by modifying the near_cmd and far_cmd. The path to your wemocontrol directory and your WeMo device name may be different

near_cmd = ‘python /home/pi/wemocontrol/send_wemo_commands.py downstairs.on’
far_cmd = ‘python /home/pi/wemocontrol/send_wemo_commands.py downstairs.off’

Also, test running these commands at the command line to test turning your WeMo device on and off outside of the program. If it doesn’t work via the command line, it definitely will not work inside the Python program.

Run the Bluetooth Proximity Program

sudo python ./home/pi/bluetooth-monitor.py

This will run continuously. Test the output of this script by moving your device around the room. You will see debug output indicating whether you are near or far away from the Raspberry Pi. If you have configured your WeMo correctly, and put the correct commands in the near_cmd and far_cmd variable, the light should turn on and off.


Final Touches

If for some reason your Raspberry Pi were to crash or need to be rebooted, you don’t want to have to run this program every single time. You can add the script to the Raspberry Pi startup so that it will execute every time the Raspberry Pi turns on. You can do so by editing the following file: /etc/rc.local

Right above “exit” enter the command to execute your Bluetooth Monitor script. Save the file. Reboot the Raspberry Pi to test. The following command will execute the Python script in the background when the Raspberry Pi boots.

sudo nohup /home/pi/bluetooth-monitor.py &

I like to restart the device daily. In the event that there is a WiFi connectivity problem or a programming problem, restarting nightly can help reconnect and start the Python script. This can easily be done by creating a cronjob. To create a cronjob to run daily at 8 am, issue the following command:

crontab -e

At the bottom of the file, add:

30 8 * * * sudo /sbin/shutdown -r now

This will run the shutdown reboot command every morning at 8:30 am.

Cheers

How to Force Excel to Keep Leading Zeros When Opening a CSV File

If you frequently export data to csv files, I’m sure you are well aware of the problem when opening those files in Excel. Excel automatically chops off any leading zeros on numbers that start with a zero. This can be a problem for IDs or zip codes that start with a zero. This is a major pain in the ass, especially if you do not want your users to have to jump through hoops to solve the problem. The zeros are actually in the csv, Excel for some reason just hides them.

The below solution will solve the dropping of the leading zero problem. It does not require any extra steps by the user. In your csv file, simply wrap the data that contains the number with leading zeros like so:

“=””0000012345″””,Stiglitz,Hugo,123 Some Street, Some town,Some State
“=””0000054321″””,Soze,Keyser,123 Some Street, Some town,Some State
“=””0000045312″””,Christmas,Lloyd,123 Some Street, Some town,Some State

In the above example, all 4 leading zeros on each ID will be maintained in the excel file when it is opened.