All posts by JamesIsIn

Fuck Comcast

Comcast used to give me a static IP address for five dollars a month.  This is exorbitant (as you will see below), but it was paradise to pay compared to what they are doing today.

First a word about IP addresses.

For IPv4, this pool is 32-bits (232) in size and contains 4,294,967,296 IPv4 addresses. The IPv6 address space is 128-bits (2128) in size, containing 340,282,366,920,938,463,463,374,607,431,768,211,456 IPv6 addresses.

So for IPv4 (what is most commonly used still) there are about 4.2 x 10^9 and for IPv6 (newish but growing slowly) there are about 3.4 x 10^38 total addresses.  If we were limited to IPv4 we would be having some minor difficulty getting addresses assigned around the globe.  Mostly that’s not an issue because mostly individual computers sit on local networks and don’t need public addresses.  These numbers are really only about pubic facing addresses.

Think about that scale for a moment.  Let’s look at the math.

340282366920938463463374607431768211456 ÷ 7631836561 = 4.458721884×10²⁸

So, every human on the planet could have their own pool of addresses (just from IPv6 because at this point the IPv4 address aren’t even a rounding error by comparison) and they would get a pool of about 4.5 x 10^28 addresses.  To put that in perspective the weight of the earth in grams is The mass of the earth is 5.98 x 1027 grams.  How much is a gram of dirt worth?  This is the scale we are at with addresses.

Comcast will charge $30 per month for an IP address (a static address).  Let’s break that down.  In order to get a static address you must have a business account which is an increase in your monthly fee of (at least) $5.  Then you will need to pay the monthly fee they charge for the static lease which is now $15.  Finally, you must rent a modem from Comcast at $10 every month.  (I may have those numbers reversed but either way it’s the same math.)

You may think “oh, I’ll save some money and buy my own modem”.  Good thought.  That’s what I did.  But it turns out they are now geared to fuck anyone who tries to escape that fee.  They are currently refusing to assign static leases to customer-owned modems.

They will tell you it’s not possible, but this is what I do for a living.  You can assigned a static lease to any device on your network by several various means, and it doesn’t matter who owns that device, who made that device, or what sort of device it is.  You only need the MAC address of the device (which is easy to provide and which I have repeated offered).

They are lying.  In addition to it being technically possible, I also know this from experience with Comcast.  Remember this is what I do for a living.  I have set up businesses around town with their own modems, with Comcast as an ISP, and with static addresses many times over the years.  I know too of specific business with this arrangement currently.

So, in short Comcast is charging any customer who asks for one thirty dollars for one-tenth of one gram of dirt.

Fuck Comcast.

Share

HowTo: Copy an Array in bash

If you want to make a copy of an array as an array in bash, you must use this specific syntax in order to get the elements parsed as individual elements.

##

export -a "$newArray=(${oldArray[*]})"

#

The asterisk gives access to each element within the original array, and the parentheses ensure the new array is populated also as an array with multiple elements.

Share

Windows Hates USB Drives

Not sure why but Windows is always throwing little tantrums when I attach a USB drive.  None of the other operating systems I use complain, but Windows complains nearly every time.  I think it can smell the Unix.

When I first attach a drive it will probably confront me with this terrifying message of doom.

What to do?
What to do?

Continuing without scanning always works fine, but if I should ask it to scan and fix (as they so thoughtfully recommend) I get the obligatory “are you sure?”, because (of course) “Scan and fix” means “scan and… that’s it”.

Er... repair?
Er… repair?

Oh, shit.  They found errors!  Better fix them.  I mean it’s the only option at this point.  (Canceling is just giving up.)

The No Error!
The No Error!

I’m pretty much doomed.  Save yourself!

Share

So You Wanna Do C++ Programming on Windows

You must update Win10 to the latest version before you will be able to enable the Windows Subsystem for Linux and Ubuntu (which is where you will find bash). It is best to do this over a wired connection as it will go faster and more smoothly.

Enable the subsystem:

  • Hit the Windows key and locate the Control Panel
  • Now locate the Programs and Features panel and double-click on it
  • Click the “Turn Windows features on or off” link on the left
  • Check the box for “Windows Subsystem for Linux” and click the “Ok” button

Enable developer mode:

  • Hit the Windows key and click the Settings gear on the left of the Start menu
  • Choose Update & Security (it’s the last entry)
  • Choose “For developers” on the left
  • Choose the “Developer mode” radio button

Setting up bash:

  • Open a command prompt (cmd), a PowerShell prompt, or a Terminal in Visual Studio Code and type bash
    • (This will cause bash to run through a basic set up.)
  • Enter new UNIX username:
    • Use your Windows username as that’s easiest to remember
  • Enter new UNIX password:
    • Use your login password for Windows again because it’s easiest
  • Retype your UNIX password:
    • Type your login password again so you’re sure it’s correct

If cmd complains bash doesn’t exist…

  • Open the Microsoft Store application
    • Win –> type store
  • Install Ubuntu
    • search for Ubuntu or bash
    • Click the “Get the apps” button in the “C:\> Linux on Windows?” box
    • Choose Ubuntu (free)
    • Click the “Get” button
  • Go back to “Setting up bash” above except you’ll need to locate and launch Ubuntu from the Windows Start menu

Update Ubuntu (the subsystem which is running bash):

  • sudo apt update
    • (you will be asked to invisibly enter your password)
  • sudo apt upgrade
    • (answer y)
  • sudo apt autoremove
  • sudo apt autoclean

(Those last two are not strictly necessary but are a good practice to use. If too much time passes between any of these sudo commands you will be asked to enter your password again.)

Install the g++ compiler:

  • sudo apt install g++
    • (answer y)

The final piece of this puzzle is the (optional but pleasant enough) Code (free) version of Visual Studio.  You can get that for Windows, Mac, and Linux directly from this site.

Remember to have fun!

Share

How to Be Unobvious

A user wrote in because they button they were using to show the Desktop was no longer present.  We all had a good laugh when we saw their attached image.

Original Screen Capture
Original Screen Capture

The problem was were all laughing for the wrong reason.

They were not in fact using the close button on a window to show the Desktop as the above may suggest.  No.  They were actually using the Show Desktop button at the far end of the Taskbar.  We should have been laughing at the oddness of the image.

Take a closer look.

The Minimizer
The Minimizer

In reality it is important to understand what the other is saying.  This will ensure that you are laughing for all the right reasons.

Share

Mac Lock Screen Keyboard Shortcut(s)

The following is a method for creating a keyboard shortcut on a Mac such that the shortcut will lock the screen. This method involves using the Mac’s Automator and a bit of shell script. It is also important to set certain settings. We are going to show two different shortcut options. They can be run in parallel if desired. They also may be modified within reason and remain equally effective.

Launch Automator

  • From Automator choose File –> New –> Service which will open a new automation dialog
  • Here you have two (inclusive) options:
    • From the automation dialog select Utilities from the left-hand pane and then Run Shell Script
    • From the automation dialog select Utilities from the left-hand pane and then Start Screen Saver (pictured)
Utilities: Run or Start
Utilities: Run or Start
  • What’s the difference?
    • The shell script puts the system directly into the suspended state.
    • Suspending the system (via script) is slower but requires no additional settings.
    • Launching the screen saver does just that.
    • Launching the screen saver requires certain screen saver settings (below) and is faster.

The Automation (Two Options)

  • This is the line of code for you to copy and paste as below: /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
  • Again you will follow either the Run Shell Script path or the Start Screen Saver path:
    • Note the “no input” and the “any application” settings in both drop-downs for both methods below.

Via Shell Script (using Suspend):

  • Call the Run Shell Script something clear: LockViaSuspendShortcut
  • This is the line of code for you to copy and paste as above: /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
    • You will see the argument -switchToUserID for CGSession as well. This does not lock the screen. Do not use it.)
  • The Shell Script method (using suspend):
Lock via Script
Lock via Script

Via the Screen Saver:

  • … or Call the Start the Screen Saver something clear: LockViaScreenSaver
  • The Start the Screen Saver method:
Lock via Screen Saver
Lock via Screen Saver

Note:

  • If you need to delete an Automator Workflow, you can locate them in ~/Library/Services/
  • It may be possible to make an automation available to all users (untested) by placing it in /Library/Application Support/Apple/Automator/

Set Up the Keyboard Shortcut(s)

  • Once you have created these automations, you will only need to assign a shortcut for each.
  • Navigate to System Preferences –> Keyboard –> Shortcuts –> Services
  • Since you have used clear names per the above, you will have no difficulty identifying which automation is which.
Shortcuts
Shortcuts
  • The field to the right of the name of the automation holds the key combination.
  • Choose what you’d like and choose wisely.
    • LockViaScreenSaverShortcut is set as ctrl-alt-L
    • LockViaSuspendShortcut is set as shift-super-L
  • The mouse may need to be out of a VM in order for the shortcuts to be captured by the Mac.

Additional Screen Saver Settings

  • Open System Preferences –> Desktop & Screen Saver –> Screen Saver
  • Set “Start after:” as “5 Minutes
  • Open System Preferences –> Security & Privacy –> General
  • Set “Require password” as “5 seconds
    • These fives seconds will give you a small buffer to keep your screen from locking if you are reading an article and it goes blank.
Share