Saturday, July 14, 2018

iPhone Data Usage Tips

iPhone Data Usage Tips

If you're on a limited or shared data plan, downloading a bunch of app updates or IOS upgrade over your cellular data can be really frustrating. The good news is, there are several options within IOS 11 to tweak the cellular data usage settings so you can avoid downloading many of the typical bandwidth hogs unless you're on WiFi.

Recommendations

  • Disable Cellular Data - Automatic Downloads
  • Disable Cellular Data - Video Autoplay
  • Disable - Wi-Fi Assist
  • Disable Cellular Data  - Background App Refresh

Automatic Downloads

On IOS 11, go to Settings -> iTunes & App Stores: Set Use Cellular Data to "Off".









Video Autoplay

On IOS 11, go to Settings -> iTunes & App Stores -> Video Autoplay: Set to Wi-Fi Only.

Wi-Fi Assist

On IOS 11, go to Settings -> Cellular: Set Wi-Fi Assist to "Off".

Background App Refresh

On IOS 11, go to Settings -> General -> Background App Refresh -> Background App Refresh On: Set to Wi-Fi.

Disable Cellular Data

If all else fails, you can simply disable use of all cellular data, at least temporarily until your data usage cycle resets. Go to Settings -> Cellular: Set Cellular Data to "Off".


Sunday, July 8, 2018

Running Linux on Windows (WSL)

Running Linux on Windows (WSL: Windows Subsystem for Linux)


The Windows Subsystem for Linux is fully available in Windows 10 release 1709 (Fall Creators Update). This lets you drop into bash from a Windows command prompt. The default distributions available in the Microsoft Store are Ubuntu, openSuse Leap, SUSE Linux Enterprise Server, Debian, and KALI. But what if you want to run another version like CentOS or similar? That's where RoliSoft's WSL Distribution Switcher comes into play. This python based set of scripts allows you to download Docker hub versions of Linux and run them from the WSL command line. Here's what I had to do to get CentOS 7 running on my Windows 10 machine.

Prerequisites


Installing WSL Feature in Windows 10


From the Windows search bar type Windows Feature and you should see the "Turn Windows Features On and Off" program.

Scroll all the way to the bottom of the list and you should now see the "Windows Subsystem for Linux". Check the box to the left and click OK to install. Please note, this will require a reboot of your computer to complete.


Install Python3 for Windows


I have written a separate blog post on installing Python 3.7 for Windows. You can view that here.

Install WSL Distribution Switcher


Before you can run the WSL Distribution Switcher Python scripts, you'll need to prep the WSL environment so everything will work properly. The two basic commands related to WSL you'll need to run are lxrun.exe and wslconfig. By default there isn't a Linux distribution loaded after the WSL feature is enabled. If you only wanted to run one of the distributions available from the Microsoft Store you could simply go there and download/install your flavor of choice. However if you want to run a distribution not currently available on the store, this is what you'll need to do.

Install the Legacy WSL Ubuntu distro:
lxrun.exe /install



Next run the following to verify that the distribution is installed:
wslconfig /list /all

You'll see where any previously installed distributions from the Microsoft Store (Ubuntu in this example) are installed and set to the default. In order for the Distribution Switcher scripts to run however, we need the Legacy distro as the default.

wslconfig /s legacy







In order for everything to install smoothly, the root account needs to be the default user for the bash shell. To set this run:
lxrun /setdefaultuser root


Now that everything is properly prepared for the Distribution Switcher scripts, the installation should run normally. CD to the directory where you downloaded the WSL Distribution Switcher Scripts, in this example E:\Linux and run the installer:
python3 install.py centos:latest


You can see from the above screenshot CentOS 7.5 is installed and I was able to update via a yum update command. To get to the Linux shell from a Windows command prompt simply type bash.

You can now install other Linux distributions from the WSL Distribution Switcher as necessary.

Here's a repository list they support:

Installing Python 3.7 on Windows

Installing Python 3.7 on Windows


Python is a great scripting language and is available for both Linux and Windows. The installation is very simple and straightforward and will allow you to run python scripts directly from a Windows command prompt.

Prerequisites


Download


Start by browsing to the python.org homepage from the link above and select the latest version. This example is for Python 3.7. I am running Windows 10 so I elected to download the Windows x86-64 executable installer.

Installation


Launch the above downloaded application and you should see a typical Windows application install wizard. Be sure to check both boxes for all users, and to add Python to PATH. This makes running python commands from a command prompt much easier.

Click "Install Now" and the installation should progress.


Once you see the "Setup was successful" screen, click the Close button. To verify if Python is now installed and working browse to the installation directory (Default: C:\Users\Username\AppData\Local\Programs\Python\Python37).
If you see python.exe and etc as listed above, you should be able to execute python commands/scripts from the command line. If you want to do some of your own scripting, I would highly recommend an editor such as PyCharm from Jet Brains.