Subnet Cheat-sheet

Using the cheat-sheet has really helped cut back on the binary conversion for subnetting. I work in a unique environment where people deal with subnetting all of the time and one of my colleagues showed me a simple way to calculate IP ranges and subnets by using this. It seems like a lot at first, but once you use it a few times, it really becomes simple and makes sense.

      128   192   224   240   248   252   254   255  (Subnet)
      128    64    32    16    8     4     2     1   (Binary)
1 A    1     2     3     4     5     6     7     8   <------
2 B    9    10    11    12    13    14    15    16   CIDR
3 C    17   18    19    20    21    22    23    24
4 D    25   26    27    28    29    30    31    32

So, if I was to look at a random address:

In order to use the chart above, I first have to look at the CIDR.  Find the corresponding top number from the CIDR area in the sheet above.  Since it’s /26, it’s in the last row, so that tells you it’s a D class network.  Following the same logic, find the top number and it’s 192.  So this means that your subnet is

Now that you have the subnet, look at the second row.  The value is 64 (which is what you get when you follow /26 up to the second row).  That tells you that your network ranges count by 64.  So, you look see what range the provided address is in… the last octet is .4, so it falls within 0-63 (which is 64 numbers).  Now you have your first two numbers… 0 and 63.  That is the Network Address and the Broadcast.

Finding the range is the easy part… just add one to the Network address and subtract one from the broadcast.  That is 1-62.

So, is a host address within the following:

N (Network Address) –

F (First Host) –

L (Last Host) –

B (Broadcast)

Again, hopefully, this doesn’t confuse anyone more than it helps.  Once you practice this a few times, it really starts to make better sense.

Subnetting IPv4… I think

Until recently, I didn’t really grasp the importance or relevance of subnetting.  After reading this week’s chapter, and watching some videos on YouTube, I realized how it works now and I have a larger understanding of how the IP is restricted based on the subnet (or at least I think I do).  

I had always assumed that the subnet was “another” IP address that you could create many networks from within.  But after this chapter, it has made it more clear to me that the subnet is more of a “locking” mechanism for network addressing.

I get the binary approach, in fact, breaking binary has always been easy for me, it was just the application to subnetting that was confusing.  I think the easiest way for me to remember this now is that the subnet locks the other digits so that your ranges are better defined…

My example is a home network:

IP Address or 


The /27 denotes subnet is locked at 27 characters, so

11111111.11111111.11111111.11100000 or

lining them up helped me determine a few things:

11000000.10101000.00000001.001 00000  (ip)
11111111.11111111.11111111.111 00000  (subnet)

Everything to the left of the break can’t change because of the subnet.  So, to find the basic information like network address and broadcast address is as simple as finding the top range and bottom range of the IP. 

Since, in this case, the first 3 digits can’t change in the last octet, the address, you just have to work the numbers that can change:

00100000 (or .32) = Network address

00111111 (or .64) = Broadcast address

That would leave you with through for usable addresses.

Minecraft PE Server Without Xbox Live Requirement

Yeah, a Minecraft server… Probably one of the most annoying games that most children are completely addicted to. The issue I have with this game is the requirement for an Xbox Live account in order to play on a server. Not the traditional online server, but rather the local server. Like most parents, I’d like to have a little control over what my kids do on the internet, and playing a game with strangers at their age isn’t something I’m ready for. And, since they both enjoy playing together but still want to play in the same world when each other aren’t around, having to self-host a local game doesn’t seem to solve their problem.

So, I set out on a mission to find the best way to solve this. The solution seemed simple, host a server and bypass the Microsoft requirement so I don’t have to give them an Xbox account. This wasn’t as much of a problem as I had anticipated based on what options are provided from the Bedrock Server edition.

Simply switching ‘online-mode’ to false in the allowed local server connections. The benefit is that no outsiders can join because I control port forwarding.

My choice for server was the Bedrock edition because of the simplicity and ease of setup coupled with the basic configuration. Another great benefit was the ability to take on of the save files from their tablets and upload it as a server world (so they didn’t have to “start over”).

Installing on Arch Linux was pretty intuitive. I downloaded the server files from Mojang’s website, unzipped it to my /srv folder and launched the server (from within ‘screen’).

In the default folder is the properties file, that was easy to configure as well. I changed all of the game settings for the server to match one of the world’s they created (seed, name, difficulty, etc)and FTPed the files to the ‘worlds’ folder. The last thing I did was change the settings to disable online mode. This allowed them both to join without having an Xbox account.

C++ Programming: Image Blur Code

Another block of code that simulates blurring an image. This reads the position of x and y of a pixel and the surrounding values and applies a simple algorithm to find the average of all values and reapply the new value resulting in a blurry effect.

void blur(int img[][MAX_COL], int h, int w) {

  //for loop to cycle through the image positions
  for ( int x = 0; x < h; x++ ) {
    for ( int y = 0; y < w; y++ ) {
      //formula to calculate the values of the surrounding pixels
      int sum = 2 * ( img[x][y] + //center center
                      img[x-1][y-1] + //top left
                      img[x-1][y] + //top center
                      img[x-1][y+1] + //top right
                      img[x][y-1] + // center left
                      img[x][y+1] + //center right
                      img[x+1][y-1] + //bottom left
                      img[x+1][y] + //bottom center
                      img[x+1][y+1] //bottom right
      // position modifier with the new value
      img[x][y] = sum/14;

If there is a better way to accomplish this, please leave a comment. I am always open to learning new ways to code.

C++ Programming: Converting Time Between 12/24 Hours

I decided to stick my code in a place that I would keep track of it all. I had to write this program to demonstrate the use of functions. While it might not be the most intuitive way of accomplishing the task, I think it will do just fine.

/* * * * * * * * * * * * * * * * * * * * * * 
 * This program will convert a user inputted time between 12 and 24 hours
 * based on the selection.  The user will be able to use the program until
 * they quit.  This program will demonstrate the use of multiple fucntions
 * to complete the task.
 * * * * * * * * * * * * * * * * * * * * * * */

#include <iostream>
#include <string>

//Used to convert time to/from 12/24 hour.
//o is option, h is hour, m is minute, p is period
std::string convertTime( int o, int h, int m, char p ) {
  //default statement for time
  std::string time = "\nThe time is: ";

  //declared for AM or PM
  std::string period;

  //if the option is 1, convert hour to 24 hours
  if ( o == 1 ) {
    if ( p == 'p') {
      h += 12;
  //if the option is 2, convert hours to 12 hours
  //if the time is greater than 12, then subtract 12 from hour
  if ( o == 2 ) {
    period = "AM";
    if ( h > 12 ) {
      h -= 12;
      period = "PM";

  //convert time to strings
  std::string hour = std::to_string(h);
  std::string minute;

  // if minutes are less than 10, add the leading zero
  if ( m < 10 ) {
    minute = std::to_string(m);
    minute = '0' + minute;
  } else {
    minute = std::to_string(m);

  //concactinate the time
  time += hour + ":" + minute;
  //add the period to the end of the time
  if ( o == 2 ) {
    time += " " + period;

  //return the time
  return time;

//used to store the menu option
void menu() {
  std::cout << "Options -- " << std::endl;
  std::cout << "1: To convert time from 12-hour notation to 24-hour notation." << std::endl;
  std::cout << "2: To convert time from 24-hour notation to 12-hour notation." << std::endl;
  std::cout << "0: To quit the program." << std::endl;
  std::cout << "Choose: ";

//main program
int main() {
  //declared variables for user input
  int option, hour, minutes;
  char period;

  //continuous loop until user chooses to quit
  do {
    //display the menu

    //queue user for option from the menu
    std::cin >> option;

    //if an invalid option is chosen, tell user to choose valid option
    if ( (option < 1 || option > 2) && option != 0 ) {
      std::cout << "\nNot a valid option, please choose a valid option. \n" << std::endl;
      std::cin >> option;

    //if user chooses to quit
    if (option == 0 ) {

      //end the program with success
      return 0;

    //ask user for hours and minutes
    if ( option == 1 ) {
      do {
      std::cout << "\nEnter hours: ";
      std::cin >> hour;

      //check if hours are valid entry
      if ( hour > 12 ) {
        std::cout << "Not a valid entry, minutes must be less than or equal to 12.";

      } while ( hour > 12 );

    //ask user for hours and minutes
    if ( option == 2 ) {
      do {
      std::cout << "\nEnter hours: ";
      std::cin >> hour;

      //check if hours are valid entry
      if ( hour > 24 ) {
        std::cout << "Not a valid entry, minutes must be less than or equal to 24.";

      } while ( hour > 24 );

  do {
    std::cout << "Enter minutes: "; 
    std::cin >> minutes;

    //check if minutes are valid entry
    if ( minutes > 59 ) {
      std::cout << "Not a valid entry, minutes must be less than 60.\n";

    } while ( minutes > 59 );

    //if user wants to convert 12 to 24 hour, ask for period
    if ( option == 1 ) {
      std::cout << "Enter AM/PM (A or P): ";
      std::cin >> period;

      //if invalid option is chosen, ask user for valid option
      while ( period != 'a' && period != 'p' ) {
        std::cout << "\nInvalid period of day, please choose A or P: ";
        std::cin >> period;

      //forces period to lowercase
      period = std::tolower(period);

    //displays the time based on the convertTime function
    //passes option, hour, minutes and period variables to 
    //convertTime input variables 'o', 'h', 'm' and 'p'
    std::cout << convertTime(option,hour,minutes,period) << "\n\n";

  } while ( option > 0 );

  //end program with success
  return 0;

Using ‘winetricks’ with Steam’s Proton

After spending some time testing out Proton, I’ve noticed that there are games, not officially supported by Proton yet, that don’t function properly without some required wine packages. particularlly Starpoint Gemini 2 (appid 236150) and Sacred 2 (appid 225640). In the case of these two games, they require xact and physx to be installed via winetricks. The solution is simple, but you have to know where you’re games are stored. On Arch Linux, the location is default to ~/.steam/steam/compatdata/APPID/pfx/. To use winetricks, just set your wineprefix to the desired appid folder and run winetricks.

$ WINEPREFIX=~/LOCATION winetricks xact physx

This process works with all of the Windows-based games that Proton creates a profile for. Simply find the appid and you can run winetricks to install packages that are required for play.

Updating SSL Certificates with ‘certbot’

I found the easiest way to update certificates with certbot (on my server) is to temporarily stop apache / nginx and to run the following command. Once you have the congratulations line, you can restart your web services.</p>

$ sudo systemctl stop nginx
$ sudo certbot certonly --standalone --email [EMAIL-ADDRESS] -d,,[ALL OTHER SUBDOMAINS]

Playing Windows Games on Steam in Linux

Gaming on Linux has come a long way, but one of the faults is the ability to play games strictly designed for Windows.  Wine is one solution, but it requires a lot of configuration when it comes to Steam.  Especially if you have a custom built Steam box for casual gaming in your living room.  Perhaps that runs Arch Linux?  Well ut seems that the Steam team has been working on a solution with Proton; a modified Wine launching system that allows you to play Windows exclusive Steam games natively from the Steam interface.  It seems fairly simple to serup up as well, you need to install Proton:

$ yaourt -S proton

Once that’s done, you will need to put your Steam Client into beta mode and enable all games to use Proton (in the Steam Play section of the settings).

After that, windows games will be able to install and launch from your Steam Client on Linux.

Enable Wifi Hotspot on Android Pie

Enabling your Android Pie device to activate a hotspot is still pretty easy. All you have to do is add the following line to your build.prop file.  I used the Build.Prop Editor app in the Google Store.


Install Magisk on Pixel 2 XL with Android Pie

With the recent update to Android Pie, a lot of us have lost our root access again. The process to re-root is pretty simple if you plan on sticking with Magisk.

You will need:

  • Magisk APK installed on your Pixel 2 XL.
  • The latest boot.img from the factory image. (I wouldn’t trust anything you download unless it’s from Google). The boot.img is located in ‘taimen-ppr1.180610.009/image-taimen-ppr1.180610.009’. You will have to unzip the ppr1 file as well.
  • Remove the security pin for the lock screen if you have one set up.


  • Unlock the bootloader.
  • Push the boot.img to your internal storage with:
    • adb push boot.img /sdcard/Download
  • Open Magisk and click the install button. Click Install again, and then select the “Patch Boot Image File” and navigate to your boot.img.
  • Once this is complete, download the patched_boot.img from your device back to your computer.
    • adb pull /sdcard/MagiskManager/patched_boot.img
  • Reboot your device into the bootloader.
    • adb reboot bootloader
  • Flash the patched boot image
    • fastboot flash boot patched_boot.img
  • Reboot with fastboot (this is the only way I didn’t get stuck in a bootloop).
    • fastboot reboot