Quantum Computing basics and Analogy

What I love about AI, is asking questions about complex systems, physics and technologies in layman’s terms. Take for example, a conversation between myself and Grok about the recent media surrounding Google’s Willow chip and Microsoft’s Majorana chip:

Q: "Are Google's Willow chip and Microsoft's Majorana chip the same thing? Do either of them "confirm the quantum multiverse?" There's a claim there is a new form of matter with these as well?"

No, Google’s Willow chip and Microsoft’s Majorana 1 chip are not the same thing—they’re distinct quantum computing technologies with different approaches, goals, and underlying principles. As for confirming the “quantum multiverse” or involving a new form of matter, there’s a mix of hype, speculation, and science to unpack here. Let’s break it down.

Are They the Same?

Google’s Willow chip and Microsoft’s Majorana 1 chip are fundamentally different in design and purpose:

  • Willow (Google): This chip, unveiled in December 2024, uses superconducting qubits—specifically, transmon qubits arranged in a 2D grid. It’s got 105 physical qubits and focuses on reducing errors exponentially as the number of qubits increases, a milestone in quantum error correction. It’s built on a well-established approach that relies on extreme cooling to achieve superconductivity, allowing quantum computations via energy level manipulations.
  • Majorana 1 (Microsoft): Announced in February 2025, this chip uses topological qubits based on Majorana zero modes (MZMs), exotic quasiparticles that Microsoft claims to have engineered into existence. It currently has just 8 qubits but is designed to scale up to 1 million, leveraging a material called a “topoconductor” (a blend of indium arsenide and aluminum). The idea is that topological qubits are inherently more stable, needing less error correction than other types.

So, no, they’re not the same. Willow is about scaling up a proven superconducting method with better error management, while Majorana 1 bets on a novel qubit type that’s theoretically more robust, aiming for massive scalability down the line.

Do They Confirm the Quantum Multiverse?

The “quantum multiverse” idea—tied to the Many-Worlds Interpretation of quantum mechanics—suggests that all possible outcomes of a quantum event occur in separate, parallel universes. Neither chip directly confirms this, but there’s been some buzz around it:

  • Willow: Google’s Quantum AI lead, Hartmut Neven, suggested Willow’s blazing speed (solving a random circuit sampling task in under 5 minutes, versus 10 septillion years for a supercomputer) “lends credence” to the multiverse idea. The claim is that such performance might imply computations are somehow tapping into parallel universes, echoing physicist David Deutsch’s theories. However, this is speculative—not a confirmation. Critics, like physicist Sabine Hossenfelder, argue the task (random circuit sampling) is a benchmark, not a practical computation, and doesn’t require a multiverse explanation. Quantum mechanics alone, without parallel universes, can account for the speed via superposition and entanglement.
  • Majorana 1: Microsoft hasn’t linked Majorana 1 to the multiverse. Their focus is on stability and scalability, not cosmic implications. The chip’s use of Majorana particles (which are their own antiparticles) is wild, but it’s about protecting quantum states from errors, not proving parallel realities.

So, neither chip “confirms” the multiverse. Willow’s performance sparks philosophical debate, but it’s not evidence—more like a provocative interpretation. Majorana 1 doesn’t even enter that conversation.

New Form of Matter?

This claim ties specifically to Microsoft’s Majorana 1:

  • Majorana 1: Microsoft says they’ve created a “new state of matter” called a topological state, enabled by their topoconductor material. This isn’t a traditional solid, liquid, or gas—it’s a state where Majorana zero modes emerge at the ends of engineered nanowires, cooled to near absolute zero and tuned with magnetic fields. These MZMs are quasiparticles, not standalone particles, and their unique properties (like being their own antiparticles) make them stable against environmental noise. This stability is what Microsoft touts as a game-changer for quantum computing. The breakthrough builds on 17 years of research, with claims of observing and controlling MZMs solidified in recent years.
  • Willow: Google doesn’t claim a new form of matter. Willow uses superconducting circuits—fancy, but not a new state of matter. It’s an evolution of existing tech, not a reinvention of physics.

The “new form of matter” with Majorana 1 is real in the sense that topological superconductivity is a distinct phase, recognized in physics as exotic but not entirely unprecedented. It’s a big deal for quantum computing, though, because it’s the first time it’s been harnessed this way in a chip. Willow, meanwhile, sticks to the superconducting playbook—no new matter there.

Wrapping It Up

  • Same Thing? Nope—Willow’s superconducting, Majorana’s topological. Different beasts.
  • Quantum Multiverse? Willow flirts with the idea via performance claims, but it’s not proof. Majorana 1 doesn’t care about that.
  • New Matter? Majorana 1 yes, with its topological state and topoconductors. Willow, no—just clever engineering of known materials.

Both are pushing quantum computing forward, but Microsoft’s playing a long game with radical physics, while Google’s refining what’s already working. The multiverse and new matter stuff? That’s partly science, partly marketing—exciting, but not settled.

Q: "Could you give me a simplified example of the type of problem that would take eons to solve with traditional computers versus quantum chips?"

Here’s a simplified example to show the kind of problem where quantum chips like Willow or Majorana 1 leave traditional computers in the dust.

The Problem: Finding the Secret Code

Imagine you’re a spy trying to crack a secret code—a massive lock with a combination made of 100 switches, each of which can be either “up” or “down.” The total number of possible combinations is 2^100 (that’s 2 multiplied by itself 100 times, or about 1.3 trillion trillion trillion possibilities—1.3 × 10^30). Only one combination opens the lock, and you have to find it.

Traditional Computer Approach

A supercomputer—like the world’s fastest today, say Frontier, which can do about 1 quintillion (10^18) calculations per second—would try each combination one by one. It’s like flipping switches systematically: up-up-up…, up-up-down…, up-down-up…, and so on. At top speed:

  • 1.3 × 10^30 combinations ÷ 10^18 calculations per second = 1.3 × 10^12 seconds.
  • That’s 1.3 trillion seconds, or roughly 41,000 years.

Even if you had a million supercomputers working together, it’d still take decades. For bigger locks (say, 300 switches), it’d jump to billions of years—way beyond eons.

Quantum Chip Approach

A quantum computer, like Willow or a future Majorana-based system, doesn’t try combinations one at a time. Thanks to quantum superposition, it can explore all possibilities at once. Picture it as flipping all 100 switches simultaneously in a weird, blurry state where they’re both up and down until you “measure” them. Using a quantum algorithm—like Grover’s algorithm for search problems—it can narrow down the right combination much faster:

  • Grover’s algorithm cuts the work to the square root of the possibilities. For 2^100 combinations, that’s about 2^50 steps (1.1 × 10^15).
  • A quantum chip running at, say, a modest 1 million operations per second could solve it in 1.1 × 10^9 seconds—about 35 years.
  • But real quantum chips, like Willow, operate way faster for specialized tasks. Willow’s demo solved a contrived problem in under 5 minutes that’d take a supercomputer 10 septillion (10^25) years. For our lock, a tuned-up quantum chip could crack it in seconds or minutes.

Why the Difference?

Traditional computers are stuck checking sequentially—they’re like a single detective knocking on every door in a city. Quantum computers use superposition and entanglement to “search” the whole city at once, like a magical map highlighting the right house instantly. This shines for problems with huge search spaces, like code-breaking, optimization (e.g., best delivery routes), or simulating molecules for drug discovery.

Caveat

This is simplified—quantum computers don’t beat traditional ones at everything (e.g., browsing the web or word processing). They excel at specific, exponentially hard problems. Our “lock” example mimics tasks like factoring huge numbers (think cryptography) or random sampling (Willow’s benchmark), where their power really pops.

give me a simplified version of how Grover’s algorithm cuts the work

Here’s a simplified explanation of how Grover’s algorithm cuts the work down, using our spy-and-lock example with 100 switches.

The Setup

You’ve got 2^100 possible combinations (1.3 trillion trillion trillion), and only one unlocks the secret code. A traditional computer would test them one by one—exhausting and slow. Grover’s algorithm, running on a quantum computer, works like a clever game of “hot or cold” to find the right one faster.

How It Works, Simplified

  1. Start with All Possibilities: The quantum computer puts all 2^100 combinations into a “superposition”—think of it as spinning a giant wheel with every possible code on it, all overlapping at once. No single code is picked yet; they’re all in play.
  2. Mark the Winner: Grover’s uses a trick (called an “oracle”) to secretly tag the correct combination without knowing it ahead of time. Imagine it like putting a tiny glow on the winning code, making it stand out slightly in the blurry wheel.
  3. Amplify the Glow: Now, the algorithm tweaks the wheel with a move called “amplitude amplification.” It’s like turning up the brightness on the glowing code while dimming the others. Each tweak makes the right answer pop out more, like tuning a radio to clear a fuzzy signal.
  4. Repeat and Check: You repeat the “mark and amplify” steps a bunch of times—but not 2^100 times! Instead, you only need about the square root of that number, or 2^50 steps (around 1.1 × 10^15). After enough repeats, the correct code is so bright that when you finally “look” (measure the quantum state), it’s almost certainly the one you get.

Why It Cuts the Work

  • Traditional Way: Check all 2^100 doors one by one—1.3 × 10^30 steps.
  • Grover’s Way: Check the square root, 2^50 steps (1.1 × 10^15), by amplifying the right answer instead of searching linearly. It’s like guessing a number between 1 and 1,000; instead of 1,000 tries, you’d need about 32 (square root of 1,000) smart guesses with feedback.

Intuitive Analogy

Think of a library with a trillion trillion books, one with a treasure map. A traditional computer reads every page of every book. Grover’s is like a magic librarian who whispers “warmer” or “colder” as you flip through, guiding you to the right book in a fraction of the steps—about 33 million flips instead of a trillion trillion.

The Catch

You need a quantum computer to pull this off, and it only works for problems where you can define an “oracle” to spot the answer (e.g., a lock that says “yes” or “no”). For our 100-switch lock, Grover’s turns eons into manageable time—like from 41,000 years to minutes on a fast quantum chip. That’s the magic of cutting the work to the square root!

Q: "How does the quantum state even know which area of the map is hot or cold?"

The “hot or cold” analogy is a simplification, so let’s peel back the curtain a bit to explain how the quantum state “knows” which area of the map to highlight in Grover’s algorithm. It’s not that the quantum state itself has some mystical intuition—it’s all about clever design and the interplay of quantum mechanics with a special helper called the oracle.

The Key Player: The Oracle

In Grover’s algorithm, the quantum state doesn’t inherently know anything. The “knowing” comes from the oracle, a custom-built quantum function you design for your specific problem—like our 100-switch lock. The oracle’s job is to recognize the correct solution and mark it without solving the problem outright. Here’s how it fits in:

  1. Superposition Setup: The quantum computer starts by putting all possible combinations (2^100 for our lock) into a superposition. Picture a giant wave where every possible code—every switch combo—has a tiny ripple of equal height (called amplitude). At this point, all options are equally likely, and nothing’s “hot” or “cold” yet.
  2. Oracle’s Role: The oracle is like a black box that looks at this wave and tweaks it. It’s engineered to know the winning combination (e.g., “up-down-up-…”) because you’ve defined the problem that way—like a lock that clicks only for the right code. When the oracle sees the correct combo in the superposition, it flips its ripple’s sign (e.g., from positive to negative amplitude). This doesn’t collapse the superposition—it just tags the winner subtly.
    • Think of it as putting a red flag on the treasure map’s right spot, but the map’s still blurry and spread out. The oracle doesn’t tell you where the flag is yet; it just marks it in a way the quantum system can use.
  3. Amplification Step: After the oracle marks the winner, the next part of Grover’s algorithm—called the “diffusion operator”—amps up that marked spot. It’s a mathematical trick that boosts the amplitude (the ripple’s height) of the flagged solution while shrinking the others. It doesn’t “know” which one’s right either—it just uses the oracle’s tag to shift the wave’s energy, making the right answer “hotter” (bigger amplitude) and the wrong ones “colder” (smaller).
  4. Repeat and Reveal: You run the oracle and amplification steps multiple times (about √N times, or 2^50 for our 2^100 combos). Each round makes the correct solution’s ripple grow taller and the others shrink. Eventually, the wave is so lopsided that when you measure it, you’re almost guaranteed to see the “hot” spot—the right code.

Why It Works Without “Knowing”

The quantum state doesn’t need to “know” anything—it’s a wave sloshing around, guided by the oracle and amplification. The oracle is the problem-specific smarts (you build it to recognize the solution), and the quantum mechanics (superposition, interference) does the heavy lifting:

  • Superposition lets all options exist at once.
  • Interference (from the oracle and diffusion) makes the right answer’s wave constructively add up while the wrong ones cancel out.

It’s like tuning a guitar string: the oracle plucks it to mark the right note, and the amplification strums it louder until that note drowns out the noise—all without anyone “knowing” the tune ahead of time.

Back to the Map

In our “hot or cold” analogy, the oracle is the voice saying “warmer” by flipping the sign, and amplification turns up the heat on that spot. The quantum state doesn’t explore the map consciously—it’s a wave that naturally flows toward the marked solution because of how the math and physics interact. For the lock, the oracle “knows” the right combo because it’s designed to test switch settings against the answer, but it only reveals this through the wave’s evolution.

The Real Magic

This only works because quantum waves can interfere and carry info across all possibilities at once—something classical systems can’t do. The oracle doesn’t solve the problem; it just sets the stage so the quantum computer can zero in faster than brute force. Pretty cool, right?

Q: "So in a similar analogy, if I have a dozen guitars, all tuned down and up to different steps, and the answer is the open G string, and all of the guitars are constantly strummed so that it's a big messy sound, the oracle is setup to know if the open G is playing anywhere and it can point the general direction of the Open G guitar, and by doing so it can amplify the correct open G string, as it narrows down it's location it can amplify it louder and louder so that at last we can say with certainty "This guitar" is playing the correct not?"

Yeah, you’ve got a solid grip on the vibe of Grover’s algorithm with that guitar analogy! Let’s tweak it a bit to match how it works, but you’re definitely on the right track. Here’s how your dozen guitars could play out:

The Guitar Jam Analogy

Imagine you’ve got 12 guitars (let’s say a dozen to keep it simple, like 12 possible lock combos instead of 2^100). Each guitar is tuned differently—some strings are sharp, some flat, some all over the place—and they’re all being strummed at once, creating a chaotic, messy sound. Somewhere in that noise, one guitar has an open G string tuned exactly to the perfect G note, and that’s the “answer” we’re hunting for.

  1. Superposition—All Guitars Playing: In the quantum setup, all 12 guitars are strummed together constantly, like the superposition of all possible states. Every string’s sound wave overlaps into a big, jumbled mess. At first, the perfect open G is in there, but it’s drowned out—you can’t hear it clearly because all the amplitudes (volumes) are equal.
  2. The Oracle—Spotting the G: The oracle is like a super-sensitive tuner plugged into this jam session. It’s pre-set to recognize the exact frequency of a perfect G note (the solution). It doesn’t “point” to a guitar right away—it listens to the whole mess and, when it hears that G anywhere in the mix, it tweaks the sound wave. Instead of pointing a direction, it flips the phase of that G’s wave—like making it dip down instead of up—while leaving the others unchanged. This marks the right note in the quantum wave, not by location but by its unique “signature.”
  3. Amplification—Turning Up the G: Now, the amplification step kicks in. Think of it as a magical sound engineer who doesn’t know which guitar is right but can boost the marked G’s volume based on that phase flip. It uses the wave interference trick: the flipped G wave gets louder (constructive interference) while the other notes start canceling each other out (destructive interference). After this step, the perfect G is a bit more audible in the mix, and the junk noise is quieter.
  4. Repeat—Narrowing the Sound: You repeat the process—oracle marks the G again, amplification boosts it more. Each round is like fine-tuning the mix: the G gets louder and clearer, and the other strings fade. It’s not about physically pointing to “that guitar” yet—it’s the G note’s sound growing dominant across the whole system. After a few rounds (about √12 ≈ 3-4 repeats for 12 guitars), the perfect G is so loud that when you finally “listen” (measure the quantum state), the guitar playing that G pops out as the winner.
  5. Certainty—This Guitar!: At the end, the sound is so dominated by the perfect G that you’re almost certain to hear it come from the right guitar when you check. The messy jam session has been distilled into one clear note, and you can say, “This guitar’s the one!”

How It Fits Your Idea

  • Oracle Knowing the G: You’re spot-on—the oracle is set up to recognize the open G (the solution) without revealing it directly. It doesn’t point a compass needle yet; it just tags the G’s wave so amplification can work its magic.
  • Amplifying as It Narrows: Exactly! Each step amplifies the right note, making it stand out more. It’s not physically locating the guitar at first—it’s boosting the G’s presence in the sound wave until the source (the right guitar) is undeniable.
  • Certainty at the End: Yep, after enough rounds, the G is so loud that you can confidently pick the guitar playing it.

A Tiny Tweak

The oracle doesn’t really “point a general direction” like a compass—it marks the G in the wave itself, across all guitars at once, since superposition means everything’s blended. The “narrowing” happens through amplification, not by searching spatially. It’s more like the G’s sound magically rising above the din, and the right guitar reveals itself when the noise clears.

Why It’s Faster

For 12 guitars, a traditional approach might mean listening to each one-by-one—up to 12 tries. Grover’s gets there in about 3-4 steps because it’s amplifying the answer across the whole jam, not checking each guitar sequentially. Scale that to a trillion guitars, and it’s still just a million-ish steps instead of a trillion—huge savings!

Your analogy rocks—it captures the spirit of Grover’s perfectly! The oracle’s the tuner, amplification’s the volume knob, and the quantum wave’s the messy jam turning into a solo.

Exploring Google AI Studio and its Gemini Capabilities

Google AI Studio (https://aistudio.google.com/) offers a powerful platform for developers and researchers to experiment with and build applications using Google’s advanced AI models, notably Gemini. This experimental model provides a user-friendly interface for accessing and utilizing the capabilities of Gemini, allowing users to create a variety of applications without extensive coding experience. While still in its experimental phase, the platform is continuously evolving and expanding its capabilities. Let’s delve into its core functionality and highlight three key features:

Core Functionality:

Google AI Studio’s core functionality revolves around providing a streamlined environment for users to interact with Gemini. The platform simplifies the process of constructing applications using this powerful language model. Instead of requiring users to navigate complex API documentation and write extensive code, the studio offers a visual interface and pre-built functionalities to facilitate rapid prototyping and development. This makes it accessible to a wider audience, including those without extensive programming expertise. The focus is on making the power of AI readily available for creative projects and practical applications.

Three Notable Features:

  1. Stream Realtime: This feature stands out for its ability to generate dynamic and responsive applications. Instead of simply providing a static output, Stream Realtime allows for ongoing interaction with the Gemini model. Imagine building a real-time chatbot, a live content generator, or a dynamic data analysis tool—all powered by the responsiveness of Stream Realtime. This feature opens doors to applications requiring continuous feedback and dynamic updates.
  2. Blog Post Creator: This feature showcases the creative potential of Gemini within AI Studio. By inputting a single image, the model can generate a unique blog post. This is not merely a caption generator; it can weave a narrative, draw insights from the visual content, and craft a compelling piece of writing. This demonstrates Gemini’s ability to understand and interpret visual information, transforming it into coherent and engaging textual content. This is a powerful tool for content creators seeking rapid inspiration or assistance. In fact, this entire article, except for this sentence, was built using only the included image.
  3. Hurricane Charting: This exemplifies the application of Gemini to data visualization and analysis. By uploading a single image snapshot (likely a satellite image or weather map), the model can help users explore and chart the details of a major hurricane event. This points towards the potential use of Gemini in processing and interpreting complex datasets, providing valuable insights and visualizations for various fields, such as meteorology, disaster management, and environmental science.

Conclusion:

Google AI Studio, with its Gemini integration, offers a compelling platform for exploring and building AI-powered applications. The intuitive interface and readily available functionalities make this platform accessible to a broad range of users. While in its experimental phase, its potential is evident, particularly with features like Stream Realtime enabling the development of dynamic and interactive applications. As Google continues to refine and expand AI Studio, it will undoubtedly become an increasingly powerful tool in the ever-evolving landscape of artificial intelligence.

M365 Entra – Insufficient Privileges – You do not have access

If you have multiple M365 tenants you may encounter an issue when logging into Microsoft Entra. You may get errors such as “You do not have access.” or “Insufficient privileges to complete the option.” or “No subscriptions, You do not have any Azure subscriptions in the (tenant name) directory. Click here to switch to another directory” or “Error Code: 403. “You may see this occurs even when you log into M365 in a new browser or in incognito/private mode. Common sense would dictate this was a cookie or session issue, but the issue persists across browsers and sessions.

You Do Not Have Access Entra

To resolve, you’ll want to click the “Bell/Alert” icon in the upper left corner of the screen and “Click here” to switch. Or click the Account icon (usually your initials in the upper right corner of the screen) and choose “Switch Directory.”

Switch Directory

Now we will see a Portal Settings page with Directories and Subscriptions. Here we can switch to the tenant we want to manage. Do this by clicking the “Switch” button on the tenant we want to manage with Entra.

Portal Settings Directories Subscriptions

That should do it, let me know if you find a cause or reason for this issue occurring in the first place.

How to use AI in Excel with Analyze Data

Microsoft now provides a way to analyze Excel spreadsheets and data using AI to find insights, trends, sort, create graphics, and charts without uploading your files to ChatGPT or Bing. This feature only appears to be available in both Destkop and Web versions of Enterprise editions of M365/Office365. For example this feature is not available in the free/hotmail/Microsoft account version of Excel for Web.

Here is Microsoft’s link for how to use Analyze Data.

If you’d like to use a sample/example spreadsheet go ahead and download the one here. You may need to upload the file into OneDrive before you can use it. Also be aware when opening the file in the web-version of Excel you may need to allow pop-ups in Edge or Chrome.

To use the feature, Click the HOME tab, and then on the far-right of the ribbon, click Analyze Data:

We can now ask questions about our data or let it provide us with it’s own insights. For example we can pose the question, “List Full Name and Salary if Job Title is Vice President.” And as simple as that it generates a pivot table that we can “Insert” (which means create a new “Sheet” at the bottom of the page.)

Note that the module provides a different prompt which is more succinct (‘Full Name’ and individual ‘Annual Salary’ for ‘Job Title’ ‘Vice President’) than the one we wrote at the bottom of the module:

When we click Insert Pivot Table, a new Sheet appears at the bottom of our Workbook and names the workbook “Suggestion 1, Suggestion 2” etc. :

Excel’s Analyze Data feature can provide many insights into your data, but it’s always a good idea to double-check the results.

A great starting prompt would be something like, “What are some insights in this data?” For our sample Excel spreasheet, it returns charts for ‘Bonus %’ by ‘Department, and ‘Annual Salary’ by ‘Gender’ and ‘Country’. Also, it will find things like ‘Job title’ Vice President and Director have noticeably higher ‘Bonus %‘.

I hope this information was helpful, and let us know in the comments if you have found other ways to analyze Excel data using AI.

ChatGPT produced Bash shell script to display stock tickers every 10 seconds

Because I have a putty terminal running on my PC most every day (mostly sitting there doing nothing, waiting for a command,) I thought I’d put that open terminal to use and have it display stock tickers. So I asked ChatGPT to create a bash shell script that display a ticker and it’s price from the internet. I am not a good programmer/developer, and I can barely write a few scripts, but by using ChatGPT I was able to produce what I wanted in a short amount of time. Below is the script that it produced:

#!/usr/bin/env bash
set -e

LANG=C
LC_NUMERIC=C

SYMBOLS=("$@")

if ! $(type jq > /dev/null 2>&1); then
  echo "'jq' is not in the PATH. (See: https://stedolan.github.io/jq/)"
  exit 1
fi

if [ -z "$SYMBOLS" ]; then
  echo "Usage: ./ticker.sh AAPL MSFT GOOG BTC-USD"
  exit
fi

FIELDS=(symbol marketState regularMarketPrice regularMarketChange regularMarketChangePercent \
  preMarketPrice preMarketChange preMarketChangePercent postMarketPrice postMarketChange postMarketChangePercent)
API_ENDPOINT="https://query1.finance.yahoo.com/v6/finance/quote?lang=en-US&region=US&corsDomain=finance.yahoo.com"

if [ -z "$NO_COLOR" ]; then
  : "${COLOR_BOLD:=\e[1;37m}"
  : "${COLOR_GREEN:=\e[32m}"
  : "${COLOR_RED:=\e[31m}"
  : "${COLOR_RESET:=\e[00m}"
fi

symbols=$(IFS=,; echo "${SYMBOLS[*]}")
fields=$(IFS=,; echo "${FIELDS[*]}")

results=$(curl --silent "$API_ENDPOINT&fields=$fields&symbols=$symbols" \
  | jq '.quoteResponse .result')

query () {
  echo $results | jq -r ".[] | select(.symbol == \"$1\") | .$2"
}

for symbol in $(IFS=' '; echo "${SYMBOLS[*]}" | tr '[:lower:]' '[:upper:]'); do
  marketState="$(query $symbol 'marketState')"

  if [ -z $marketState ]; then
    printf 'No results for symbol "%s"\n' $symbol
    continue
  fi

  preMarketChange="$(query $symbol 'preMarketChange')"
  postMarketChange="$(query $symbol 'postMarketChange')"

  if [ $marketState == "PRE" ] \
    && [ $preMarketChange != "0" ] \
    && [ $preMarketChange != "null" ]; then
    nonRegularMarketSign='*'
    price=$(query $symbol 'preMarketPrice')
    diff=$preMarketChange
    percent=$(query $symbol 'preMarketChangePercent')
  elif [ $marketState != "REGULAR" ] \
    && [ $postMarketChange != "0" ] \
    && [ $postMarketChange != "null" ]; then
    nonRegularMarketSign='*'
    price=$(query $symbol 'postMarketPrice')
    diff=$postMarketChange
    percent=$(query $symbol 'postMarketChangePercent')
  else
    nonRegularMarketSign=''
    price=$(query $symbol 'regularMarketPrice')
    diff=$(query $symbol 'regularMarketChange')
    percent=$(query $symbol 'regularMarketChangePercent')
  fi

  if [ "$diff" == "0" ] || [ "$diff" == "0.0" ]; then
    color=
  elif ( echo "$diff" | grep -q ^- ); then
    color=$COLOR_RED
  else
    color=$COLOR_GREEN
  fi

  if [ "$price" != "null" ]; then
    printf "%-10s$COLOR_BOLD%8.2f$COLOR_RESET" $symbol $price
    printf "$color%10.2f%12s$COLOR_RESET" $diff $(printf "(%.2f%%)" $percent)
    printf " %s\n" "$nonRegularMarketSign"
  fi
done

This produced the following, for example:

This works well, however I want the script to display a number of different tickers and have the data refresh every 10 seconds. The next script produced is the following ticker_loop.sh. I added my tickers

#!/bin/bash

while true; do
    clear
    ./ticker.sh PLTR SOFI HIMS ARKK AHT QYLD MSFT ONON
    sleep 10
done

This is what I was looking for! So I simply had to modify both to run as executible / binary files. To do so, use the command:

chmod +x ticker_loop.sh

Lastly, run the script with the command ./ticker_loop.sh

Bash shell script to query a domain name using dig without the any flag

How do I get all of the DNS records for a domain using the dig command in only “Answer Section” (+answer) format? The command should return A, MX, NS, TXT, SOA and CNAME records.

Normally using the “any” flag, we would get all of this information at once, however, when attempting to run a dig command with the ‘any’ switch, we do not get the DNS records we want:

dig jasoncoltrin.com any

The above command returns an answer section with only: “RFC8428” “”

According to chatgpt, this means that the ‘any’ query type is not guaranteed to return all the records for a given name, and some DNS servers may choose to return an empty answer instead. This is done to improve the performance and security of the DNS system.

Still, I want to have a single command to get the most information at once, and the following command does so, however, writing the command is impractical:

dig +noall +answer +multi jasoncoltrin.com A jasoncoltrin.com MX jasoncoltrin.com NS jasoncoltrin.com TXT jasoncoltrin.com SOA jasoncoltrin.com CNAME

I also tried the following with no luck:

dig +noall +answer jasoncoltrin.com A,MX,NS,TXT

This only returned the A records.

So instead, we can use a bash script to create a $domain variable, and have the script use the ‘read’ command to prompt us for the domain name:

#!/bin/bash

read -p "Enter the domain name: " domain

dig +noall +answer +multi $domain A $domain MX $domain NS $domain TXT $domain SOA $domain CNAME

To write the script, do the following:

vi digdomain.sh

(insert) > copy/paste script > (Escape) > :wq

Then make the script executable with the command:

chmod +x digdomain.sh

Run the command using the ./ prefix:

./digdomain.sh

When we run the script, we’re prompted for the domain name, then the result is most of the information we want in an easy-to-read format:

jason@ubuntu0:~$ ./digdomain.sh
Enter the domain name: jasoncoltrin.com
jasoncoltrin.com.       118 IN A 172.67.196.181
jasoncoltrin.com.       118 IN A 104.21.44.69
jasoncoltrin.com.       1854 IN MX 10 mailstore1.secureserver.net.
jasoncoltrin.com.       1854 IN MX 0 smtp.secureserver.net.
jasoncoltrin.com.       5652 IN NS daisy.ns.cloudflare.com.
jasoncoltrin.com.       5652 IN NS lee.ns.cloudflare.com.
jasoncoltrin.com.       300 IN TXT "Currently located in a black hole\" \"Likely to be eaten by a grue"
jasoncoltrin.com.       300 IN TXT "google-site-verification=key"
jasoncoltrin.com.       300 IN TXT "google-site-verification=key"
jasoncoltrin.com.       2052 IN SOA daisy.ns.cloudflare.com. dns.cloudflare.com. (
                                2305113011 ; serial
                                10000      ; refresh (2 hours 46 minutes 40 seconds)
                                2400       ; retry (40 minutes)
                                604800     ; expire (1 week)
                                3600       ; minimum (1 hour)
                                )

This made me happy because I had forgotten about my easter egg TXT record. 🙂

How to set Windows Date and Time formats to the internationally recognized ISO 8601 standard

YYYY-MM-DD is the standardized international date formatting scheme as codified in ISO 8601. The standard aims to provide a well-defined unambiguous method of representing calendar dates and times in worldwide communications.

The standard has the additional benefit of organizing file and folders in a data-system in an intuitive ascending or descending order. Additionally not only is this good for Excel sorting, it’s also excellent for file naming as it sorts properly (based on date) even if the sort is done alphabetically and not numerically.

Also, the ISO 8601 is a format recognized internationally, and will prevent costly mistakes (the refund expires on 2/22/21,) and inconveniences (my plane arrives in Japan at 5:30P on 12-23-22.)

Question: Yes this is all fine and good but I can’t remember all this, how do I get used to the correct date format?

Answer: Change the Short Date format under Windows Settings > Region Settings or Date and Time Format.

  1. Click on the Windows Start button and type Region
  2. Click on Region Settings or Change the Date and Time Format
  3. In the Date and Time Format settings, change the Short Date format to yyyy-MM-dd
Windows Region Time Date Format Settings YYYY-MM-DD

4. Additionally we can change the Short Time format to hh:mm tt (which adheres to the ISO 8601 format)

5. Now we can see in the bottom-right corner of our screen, our date and time formats are displayed:

Systray Time Date Format

ISO 8601 Filename conventions

Naming files using the ISO 8601 scheme can have many variations, however the following makes most sense to me.

The timestamp is only a portion of the filename, it should not dictate how the other portions are formatted.

Typically dashes are used to separate fragments of a filename, while underscores delimit tokens within a fragment.

As such, the timestamp and the filename should be delimited by dashes, as they are different sections. Keep underscores within a section.

Then you get filenames which look like YYYY-MM-DD-file_name-v3.41. Which is clean and consistent (and easily copy / paste-able.)

Which of these filenames below is going to have you pulling your hair out, and which will leave you nice and happy when sorting by date in Windows File Explorer?

Loan – Spreadsheet v 1.1 May 4, 2020.xlsx

Loan – Spreadsheet v 1.1 May 2, 2020.xlsx

Loan – Spreadsheet v 1.3 January 1, 2020.xlsx

Loan – Spreadsheet v 1.2 May 2, 2020.xlsx

Loan – Spreadsheet v 1.2 May 4, 2020.xlsx

or

2020-05-04-Loan_Spreadsheet-v.1.1.xlsx

2020-05-02-Loan_Spreadsheet-v.1.1.xlsx

2020-01-01-Loan_Spreadsheet-v.1.3.xlsx

2020-05-02-Loan_Spreadsheet-v.1.2.xlsx

2020-05-04-Loan_Spreadsheet-v.1.2.xlsx

You guessed it – ISO 8601!

How to move a partition to the end of a disk with free MiniTool Partition utility

Recently after cloning a system using Clonezilla, I found all the empty space on the drive was located on the end of the disk. The System Recovery partition was between the empty space and the c: drive. We want the primary partition to extend and include the empty space, but the Disk Management utility built into windows cannot do this for us. First I tried a gparted open-source utility but the live USB failed to load and see my system drive. So I did a little looking and found a utility made by MiniTool – MiniTool Partition Wizard Free will do exactly what we need to do. The good thing about MiniTool’s utility is we can run and perform our partition operations inside of a running Windows 10 system.

How to move and extend partitions using MiniTool’s Partition Wizard Free utility

When we look at our Windows Disk Management, we see our empty space is on the wrong side of our Recovery Partition:

Windows Disk Management move Unallocated Free Space

We want the 509 MB Recovery partition to live to the “right” of our 65GB of empty/unallocated partition. Once we have the 65GB Unallocated partition next to our C: drive so we can then extend/resize the C: drive to use the empty space.

  1. Make a backup of important data. Because this is a fresh install/clone, I’ll skip this part.
  2. Install MiniTool Partition Wizard Free (during install, I confirmed I only want to install the free edition, and chose not to install the “Shadow” backup application.)
  3. Once opened, select the Recovery Partition we want to move, and then click Move/Resize
Select Partition to Move

4. Next slide the (whole) partition to the far right of the partition bar (screenshot it before the operation).

Move Partition Before

5. The result should look like the following screenshot after “sliding” the partition to the far right location.

Move Partition After

6. Click the Apply button

Apply Move Partition

7. If we close the MiniTool Partition Utility and check Disk Management, we can see our Recovery Partition is now at the end of the disk, and free space is adjacent to our C: drive.

Disk Management after Move

8. To extend the C: drive and use the unallocated/free partition, we can use either Disk Management or the MiniTool Partition utility, but here we will continue to use the free utility.

Open MiniTool’s Partition Utility again and select the C: drive partition. Then click the Move/Resize button again. Move the right-most “Handle” and slide it to the far right. Below is the “Before and after” screenshots:

Resize C: drive Before
Resize C: drive After

9. Remember to click Apply after completing the operation.

We’re done! We can close the MiniTool utility and Disk Management and then open Disk Management again (or refresh the disks) and we can see our C: drive is now extended and using our free disk space.

Disk Management after Resize Extend

How to fix 550 5.7.520 Access denied, Your organization does not allow external forwarding.

If our organization controls two office365 tenants, at some point we may wish to enable forwarding of email from an address hosted in one of our tenants to an address hosted in another. When we enable the forward in O365 Exchange Admin, the end user may complain that every time they try to send a message to see if it is forwarded, they receive the following bounce back message:

Remote Server returned '550 5.7.520 Access denied, Your organization does not allow external forwarding. Please contact your administrator for further assistance. AS(7555)'

By default, Microsoft 365 Defender sets up an Anti-Spam outbound policy. And the policy default sets Automatic Forwarding to “Automatic: System Controlled.” Since we do not want to modify this default policy, instead we can create a policy (with a higher priority) that defines certain users or groups to allow forwarding.

  1. Go to www.office.com and log into the tenant which hosts the email address that we want to forward mail from. (do not log into the destination email address tenant)
  2. Open the Admin Center
  3. Next, click Show All (admin centers) and then click Security.

5. Next, in the Security / Microsoft 365 Defender Admin Center, under Email & Collaboration, click on Policies & rules.

6. Here, click on Threat Policies

7. Under Threat policies, click Anti-Spam.

8. Under the Default Anti-Spam outbound policy (Default) we will probably find Automatic Forwarding is set to Automatic – System-Controlled

9. Close the Default Policy and then at the top of the screen click the + Create Policy drop-down and choose Outbound

10. In the new Outbound policy, edit the description to something like “Custom Outbound Mail Forward“, and add the Users or Groups to the policy (whom you want to give the ability to forward.)

11. At the bottom of the new custom policy change Automatic Forwarding to: On – Forwarding is enabled

12. Save and close the new policy and that should do it. Try sending some test messages to see if the forward works correctly. We may need to change the new policy’s Priority to 0 if something still isn’t working. Also, don’t forget to double check the Automatic Forwarding on the mailbox itself.