The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,224 other subscribers

Archive for the ‘Mac OS X / OS X / MacOS’ Category

I learned: MacOS has a Unicode Hex Input keyboard

Posted by jpluimers on 2023/05/25

A while ago, I learned that MacOS has had a Unicode Hex Input keyboard since ages.

It is not installed by default, so you have to manually add it:

  1. Start the System Preferences.app
  2. Open the Keyboard icon
  3. Choose the Input Sources tab
  4. Click the plus (+) icon
  5. Search for Unicode or Hex to get so Unicode Hex Input is the only entry in the list
  6. Click the Add  button
  7. Choose the Keyboard tab
  8. Enable Show keyboard and emoji viewers in menu bar

Now in the menu bar, you can select the Unicode Hex Input.

After that, when holding the Option key, any 4-digit Unicode sequence will get you a Unicode character.

Read the rest of this entry »

Posted in Apple, Development, Encoding, Mac OS X / OS X / MacOS, Power User, Software Development, Unicode | Leave a Comment »

veltman/clmystery: A command-line murder mystery; an interactive tutorial for learning the *n*x command-line

Posted by jpluimers on 2023/01/18

Since I’m on a series of interactive tutorial sites, yesterday’s The SQL Murder Mystery made me bump into a project by [Archive] Noah Veltman (@veltman) / Twitter: [Wayback/Archive] veltman/clmystery: A command-line murder mystery

There’s been a murder in Terminal City, and TCPD needs your help.

To figure out whodunit, you need access to a command line.

Once you’re ready, clone this repo, or download it as a zip file.

Open a Terminal, go to the location of the files, and start by reading the file ‘instructions’.

I did a quick [Archive] clmystery – Twitter Search / Twitter and found the first ever Twitter mention to be this one from 2013 (boy, have I been living under a stone <g>): [Archive] RoR Group on Twitter: “A command-line murder mystery (clmystery) …” / Twitter.

Cool things:

–jeroen

Posted in *nix, *nix-tools, Apple, Development, Interactive Tutorials, Learning/Teaching, LifeHacker, Linux, Mac OS X / OS X / MacOS, Power User, Software Development, Terminal | Leave a Comment »

Getting your public IP address from the command-line when http and https are blocked: use DNS

Posted by jpluimers on 2022/12/28

Years ago, I wrote Getting your public IP address from the command-line. All methods were http based, so were very easy to execute using cURL.

But then in autumn 2021, Chris Bensen wrote this cool little blog-post [Wayback/Archive] Chris Bensen: How do I find my router’s public IP Address from the command line?:

dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com

At first sight, I thought it was uncool, as the command was quite long and there was no explanation of the dig command trick.

But then, knowing that dig is a DNS client, it occurred to me: this perfectly works when http and https are disabled by your firewall, but the DNS protocol works and gives the correct result:

# dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com
"80.100.143.119"

This added the below commands and aliases to my tool chest for *nix based environments like Linux and MacOS (not sure yet about Windows yet :), but that still doesn’t explain why it worked. So I did some digging…

IPv4

  • command:
    dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com
  • command removing outer double quotes:
    dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com | xargs
  • alias:
    alias "whatismyipv4_dns=dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com | xargs"

IPv6

  • command:
    dig -6 TXT +short o-o.myaddr.l.google.com @ns1.google.com
  • command removing outer double quotes:
    dig -6 TXT +short o-o.myaddr.l.google.com @ns1.google.com | xargs
  • alias:
    alias "whatismyipv6_dns=dig -6 TXT +short o-o.myaddr.l.google.com @ns1.google.com | xargs"

How it works

Let’s stick to dig and IPv4 as that not having IPv6 (regrettably still) is the most common situation today:

# dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com
"80.100.143.119"

What it does is request the DNS TXT record of o-o.myaddr.l.google.com from the Google DNS server ns1.google.com and returns the WAN IPv4 address used in the DNS request, which is for instance explained in [Wayback/Archive] What is the mechanics behind “dig TXT o-o.myaddr.l.google.com @ns1.google.com” : linuxadmin.

Since these are TXT records, dig will automatically double quote them, which xargs can remove (see below how and why):

# dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com | xargs
80.100.143.119

The DNS query will fail when requesting the Google Public DNS servers 8.8.8.8 or 8.8.4.4:

# dig -4 TXT +short o-o.myaddr.l.google.com @8.8.8.8
"2a00:1450:4013:c1a::103"
"edns0-client-subnet 80.101.239.0/24"

Or, with quotes removed (the -L 1 ensures that xargs performs the quote-pair removal action on each line):

# dig -4 TXT +short o-o.myaddr.l.google.com @8.8.8.8 | xargs -L 1
2a00:1450:4013:c1a::103
edns0-client-subnet 80.101.239.0/24

This request is both slower than requesting the ns1.google.com server and wrong.

The reason is that only ns1.google.com understands the special o-o.myaddr.l.google.com hostname which instructs it to return the IP address of the requesting dig DNS client.

That 8.8.8.8 returns a different IP address and an additional edns0-client-subnet with less accurate information is explained in an answer to [Wayback/Archive] linux – Getting the WAN IP: difference between HTTP and DNS – Stack Overflow by [Wayback/Archive] argaz referring to this cool post: [Wayback/Archive] Which CDNs support edns-client-subnet? – CDN Planet.

Not just ns1.google.com: any DNS server serving the google.com domain

Since o-o.myaddr.l.google.com is part of the google.com domain, the above works for any DNS server serving the google.com domain (more on that domain: [Wayback/Archive] General DNS overview  |  Google Cloud).

Getting the list of DNS servers is similar to getting the list of MX servers which I explained in Getting the IP addresses of gmail MX servers, replacing MX record type (main exchange) with the NS record type (name server) and the gmail.com domain with the google.com domain:

# dig @8.8.8.8 +short NS google.com
ns3.google.com.
ns1.google.com.
ns2.google.com.
ns4.google.com.

The ns1.google.com DNS server is a special one of the NS servers: it is the start of authority server, which you can query using the SOA record type that also gives slightly more details for this server:

# dig @8.8.8.8 +short SOA google.com
ns1.google.com. dns-admin.google.com. 410477869 900 900 1800 60

The difference between using NS and SOA records with dig are explained in the [Wayback] dns – How do I find the authoritative name-server for a domain name? – Stack Overflow answer by [Wayback/Archive] bortzmeyer who also explains how to help figuring out SOA and NS discrepancies (note to self: check out the check_soa tool originally by Michael Fuhr (I could not find recent content of him, so he might have passed away) of which source code is now at [Wayback/Archive] Net-DNS/check_soa at master · NLnetLabs/Net-DNS).

So this works splendid as well using ns4.google.com on my test system:

# dig -4 TXT +short o-o.myaddr.l.google.com @ns4.google.com | xargs
80.100.143.119

The xargs removes outer quotes removal trick

[Wayback/Archive] string – Shell script – remove first and last quote (“) from a variable – Stack Overflow (thanks quite anonymous [Wayback/Archive] user1587520):

> echo '"quoted"' | xargs
quoted

xargs uses echo as the default command if no command is provided and strips quotes from the input.

More on https versus DNS requests

Some notes are in [Wayback/Archive] How to get public IP address from Linux shell, but note the telnet trick now fails as myip.gelma.net is gone (latest live version was archived in the Wayback Machine in august 2019).

Via

–jeroen

Posted in *nix, *nix-tools, Apple, bash, bash, Batch-Files, Communications Development, Development, DNS, Internet protocol suite, Linux, Mac, Mac OS X / OS X / MacOS, Power User, Scripting, Software Development, TCP | Leave a Comment »

Some notes on Input Director and alternatives: what about multiple platforms and mixing local plus remote access?

Posted by jpluimers on 2022/07/29

More than 10 years ago, I wrote about 7 screens; 3 computers; 1 keyboard/mouse to direct them all: Input Director and started with

At home, I have 7 screens on 3 computers on the same desk. That sounds like a clutter, but all these keyboards and mice hooked up to them add even more clutter. Until I found out about Input Direct…

In the mean time, I’ve mainly used a Mac with MacOS as a front-end to virtually logon to remote machines using both the internal display and one or two external monitors.

Especially when doing video (think Covid-19 and especially on-line meetings!) in addition to software development work, this is far from ideal.

So here are some things on my list of potential enhancements to this situation:

–jeroen

 

Posted in Apple, Hardware, Keyboards and Keyboard Shortcuts, KVM keyboard/video/mouse, Mac OS X / OS X / MacOS, Power User, Uncategorized, Windows | Leave a Comment »

Finger print as factor in authentication?

Posted by jpluimers on 2022/07/27

A finger print as authentication factor: be sure it is not the only factor, and devise a way to delete it just in case some party wants to force you to use it as an authentication factor.

Some links for my archive:

–jeroen

Posted in *nix, Apple, Mac OS X / OS X / MacOS, Power User | Leave a Comment »

 
%d bloggers like this: