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 1,861 other subscribers

Archive for the ‘Mac OS X 10.5 Leopard’ Category

whatismylocalip alias (actually more like whataremylocalips) and some sed links

Posted by jpluimers on 2017/01/10

Getting the local IP (actually IPs, but most hosts only have a single IP):

# OS X:
alias whatismylocalip='ifconfig | sed -En '\''s/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'\'''
# Linux:
alias whatismylocalip='ip a | sed -En '\''s/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'\'''

I got them via bash – How to I get the primary IP address of the local machine on Linux and OS X? – Stack Overflow

Mac OS X and BSD have ifconfig, but most Linux distributions don’t use ifconfig any more in favour of iproute2, so you use ip a (which is shorthand for ip address show) there.

Their output is similar enough for the sed to work, though. Which surprised be because I didn’t know about the -E option (it lacks in the manual Linux page but it is in the Mac OS X one) which enables POSIX extended regular expressions. In Linux this is documented as -r, but -E also works.

I learned this through the Sed – An Introduction and Tutorial which compares the various versions of sed which also explains about the -n doing no printing.

–jeroen

Posted in *nix, *nix-tools, Apple, bash, bash, Development, Linux, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, openSuSE, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development, SuSE Linux, Tumbleweed | Leave a Comment »

How to securely delete files in OS X 10.11 ‘El Capitan’ | MacIssues

Posted by jpluimers on 2016/12/23

Interesting: diskutil secureErase freespace LEVEL /Volumes/DRIVENAME

–jeroen

Source: How to securely delete files in OS X 10.11 ‘El Capitan’ | MacIssues

Posted in Apple, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User | Leave a Comment »

installing the joe terminal/console text editor on Mac OS X: brew to the rescue

Posted by jpluimers on 2016/10/07

The most recent versions of Joe don’t even build from stock in OS X any more and there are no direct installers for them.

But there are two most recent older versions that have installers, and a formula recent brew based HomeBrew installation:

  1. joe-3.7-0.pkg – rudix-snowleopard – JOE – Rudix: The hassle-free way to get Unix programs on Mac OS X – Google Project Hosting.
  2. PROJECT DETAIL for Joe’s Own Editor.
  3. Homebrew Formulas – Joe.

After experimenting for a while without brew preferring the first over second, I’ve installed the the third as:

  1. The first actually installs version 3.6, but has the syntax highlighting files installed in the correct place, so you get syntax highlighting.
  2. The second does install version 3.7, but since the syntax highlighting files are in the wrong place: you get no syntax highlighting.
  3. The brew formula has an up to date joe version 4.0 and installs the syntax highlighting in the right place: you get syntax highlighting.

Before making a choice, you might want to consider reading about joe versions in JOE – Joe’s own editor / … /NEWS.md.

Having a background partially in the Linux world, I tried building joe from source on my Mac following the steps at JOE – Joe’s own editor / Discussion / joe-editor-general:Mac binary for 3.3 does not run on OS/X 10.8. It failed because the Mercurial 3.8 branch required automake and autoconf which are not available on  just a Mac + Xcode. So I’m happy that others have bit the bullet and make a good HomeBrew build.

What makes HomeBrew so great is that it is based on a fully versioned git/ruby combination, allows for multiple Python versions, allows for binaries through bintray served bottles and has zillions (well, thousands) of installable formulae, all versioned.

–jeroen

Posted in *nix, *nix-tools, Apple, joe, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User | Leave a Comment »

Builds ChaCha20 version of openssl on Mac OS X static without dylib for use with testssl.sh

Posted by jpluimers on 2016/08/17

A while ago, testssl.sh [WayBack] needed Darwin binaries (for OS X): Supply Darwin binaries + install documentation · Issue #127 · drwetter/testssl.sh [WayBack]

So I created the small Bourne shell (sh) script below to deliver them.

It allows me to update these gists:

The build script itself is in a gist as well: https://gist.github.com/f4de3937630b87753133.git [WayBack]

It helped me to contribute to these testssl.sh issues:

Not all of these binaries are in https://github.com/drwetter/testssl.sh/tree/master/bin [WayBack] as it makes the testssl.sh repository too bloated. Some (including non-OSX builds made by others) are here:

Eventually the script might get merged into https://github.com/drwetter/testssl.sh/blob/master/utils/make-openssl.sh [WayBack] as there is a Darwin switch in this commit: https://github.com/drwetter/testssl.sh/commit/6efc3e90f52e5926b0853d3b2fb221b631dcf452 [WayBack]

Read the rest of this entry »

Posted in Apple, Development, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OpenSSL, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Security, Software Development, xCode/Mac/iPad/iPhone/iOS/cocoa | Leave a Comment »

domain name system – How to test DNS glue record? – Server Fault

Posted by jpluimers on 2016/05/26

Thanks Adrian W for providing the below example in your answer about obtaining GLUE record information for a domain.

It is an excellent showcase for the $IFS Internal Field Separator available in any nx shell.

In this case it is used to get the TLD (top-level domain) from the domain name specified at the command-line.

After that, it obtains the name servers for that TLD, and queries the glue records there, both using dig.

Here is a little shell script which implements Alnitak’s answer:

#!/bin/sh
S=${IFS}
IFS=.
for P in $1; do
  TLD=${P}
done
IFS=${S}

echo "TLD: ${TLD}"
DNSLIST=$(dig +short ${TLD}. NS)
for DNS in ${DNSLIST}; do
  echo "Checking ${DNS}"
  dig +norec +nocomments +noquestion +nostats +nocmd @${DNS} $1 NS
done

Pass the name of the domain as parameter:

./checkgluerecords.sh example.org

–jeroen

via domain name system – How to test DNS glue record? – Server Fault.

Posted in *nix, Apple, bash, Development, DNS, Linux, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, openSuSE, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development, SuSE Linux | Leave a Comment »

OpenVPN – How to connect to Access Server from a Mac – basically says use Tunnelblick

Posted by jpluimers on 2016/03/18

Nice summary for just saying “Use Tunnelblick

This howto article explains how to obtain and setup a Mac openvpn client to connect to the OpenVPN Access Server.

Source: How to connect to Access Server from a Mac

–jeroen

Posted in Apple, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OpenVPN, OS X 10.11 El Capitan, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User | Leave a Comment »

Getting your public IP address from the command-line

Posted by jpluimers on 2016/01/13

Many sites giving your public IP address return a web page with a bloat of html. From the command-line, you are usually only interested in the IP-address itself. Few services return exactly that.

Below are command-line examples to provide the public IP address mostly from a *nix perspective. Usually you can get similar commands to work with Windows binaries for wget and Windows binaries for curl.

In the end, I’ve opted for commands in this format, as I think akamai will last longer than the other sites (but does not include an end-of-line in the http result hence the echo on Mac/*nix):

I’ve not tried aria2 yet, but might provide commands for that in the future.

These are the Linux permutations for akamai:

curl whatismyip.akamai.com && echo
curl ipv4.whatismyip.akamai.com && echo
curl ipv6.whatismyip.akamai.com && echo
curl ipv4.whatismyip.akamai.com && echo && curl ipv6.whatismyip.akamai.com && echo

The last two are convenient when you have both IPv4 and IPv6 configured on “the outside”.

You can replace curl with wget -q -O – (which outputs to stdout) for each command. You can even ommit the http:// (as that is the default protocol for both curl and wget).

Read the rest of this entry »

Posted in *nix, *nix-tools, Apple, bash, bash, Batch-Files, cURL, Development, Linux, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development, SuSE Linux, wget | Leave a Comment »

Mac OS X: getting default route and ip addresses

Posted by jpluimers on 2015/11/30

On Mac OS X, bare route and ifconfig give way too much information to view the most important things at once.

So I used an alias for this:

route -n get default | grep 'gateway' && echo && ifconfig | grep '\: flags\|inet\|inet6'

Later I needed IPv6 support, so I changed it to:

netstat -nr | grep 'Internet\|Gateway\|default' && echo && ifconfig | grep '\: flags\|inet\|inet6'

So you get something like this:

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            192.168.178.1      UGSc           23        0     en4
default            192.168.71.1       UGScI           7        0     en0
Internet6:
Destination                             Gateway                         Flags         Netif Expire
default                                 fe80::3631:c4ff:fe47:13f1%en0   UGc             en0

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    inet6 ::1 prefixlen 128 
    inet 127.0.0.1 netmask 0xff000000 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet6 fe80::6203:8ff:fea2:4814%en0 prefixlen 64 scopeid 0x4 
    inet 192.168.71.40 netmask 0xffffff00 broadcast 192.168.71.255
    inet6 2001:982:2345:1:6203:8ff:fea2:4814 prefixlen 64 autoconf 
    inet6 2001:982:2345:1:4011:119a:e527:e021 prefixlen 64 autoconf temporary 
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet6 fe80::426c:8fff:fe44:95ea%en4 prefixlen 64 scopeid 0xb 
    inet6 fd00::426c:8fff:fe44:95ea prefixlen 64 detached autoconf 
    inet6 fd00::74a7:8f26:cd22:20b7 prefixlen 64 detached autoconf temporary 
    inet 192.168.178.22 netmask 0xffffff00 broadcast 192.168.178.255

–jeroen

via:

Posted in Apple, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User | Leave a Comment »

osx – Toggle AppleShowAllFiles with a simple bash script? – Stack Overflow

Posted by jpluimers on 2015/10/15

LOL:

The if syntax of your script was a bit…well, iffy.

Indeed it is:

#!/bin/bash
#toggle AppleShowAllFiles

current_value=$(defaults read com.apple.finder AppleShowAllFiles)
if [ $current_value = "TRUE" ]
then
  defaults write com.apple.finder AppleShowAllFiles FALSE
else
  defaults write com.apple.finder AppleShowAllFiles TRUE
fi

killall Finder

Even the alternative if statement is:

if [[ $(defaults read com.apple.finder AppleShowAllFiles) == TRUE ]]

–jeroen

via osx – Toggle AppleShowAllFiles with a simple bash script? – Stack Overflow.

Posted in Apple, bash, Development, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development | Leave a Comment »

Restore music and video from iPod: the iPod_Control\Music folder

Posted by jpluimers on 2015/10/09

When you’re not a frequent iTunes user, and recycle computer systems, then every once in a while you will get you in to a situation where you have Music on your iPod, but not on your PC any more.

Whereas iTunes is great at putting music on an iPod, it cannot get it back.

There are numerous paid tools to get the music from your iPod, but doing it manually is not that hard. Below are a few links to get you started, but they all come down to this:

  1. Your iPod has a hidden folder called iPod_Control in the root
  2. Inside the iPod_Control folder is a folder called Music
  3. Inside the Music folder, there are folders named with letters and numbers like F00
  4. Each numbered folder has media (music, video or even photos!) files with a strangely encoded name like B00N.mp3 or 3DUN.m4v with supported media extensions including mp3 m4a m4p jpg gif tif m4v mov.
  5. The media files contain meta data with song, artist, album, etc.

The steps to copy them back

  1. Do not erase your iPod when opening it in iTunes!
  2. Ensure you can mount your iPod as a disk (the “enable disk use” option in iTunes)
  3. Mount your iPod as a disk in Mac or PC
  4. Ensure you can view the hidden files
  5. Copy the Music folder including all subfolders to your Mac or PC
  6. Unhide the Music folder and all Music and Music/F* folders inside it using this chflags trick from Unhiding Unix Directories | Apple Support Communities:
    1. chflags nohidden Music
    2. chflags nohidden Music/F*
  7. Add these to your iTunes library and have iTunes re-generate the correct filenames from the meta-data

Some links explaining this in more detail:

–jeroen

Posted in Apple, iPod, iTunes, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Windows, Windows 7, Windows 8, Windows 8.1, Windows 9 | 2 Comments »