Macbook Pro Wifi Issue When Using 2.4GHz Band

Recently I got a Macbook Pro (model A1990) along with few other items including a USB 10-in-1 hub (EAUSOO model ES-HB003C).  All was well except for one particular vexing issue i.e., once a while computer would stop communicating with wifi router. If I am using browser it would take very long or timeout or running command line utilities that used network would fail.  Many a time the network speed would drop by 90% or more! Initially, without a clue on what was happening, I tried different things including (a) suspecting some application hogging the bandwidth, (b) other devices doing something similar, (c)  relative position of my Mac with a Wifi extender (TP-Link) which I was using with 2.4GHz band and (d) few other things.

It turned out to be the issue with USB hub.  Though some have experienced similar problem with latest (2017 or later) Macs it is somewhat rare.  There is a forum thread where many have expressed frustration with this problem and possible solutions.  For more details see https://discussions.apple.com/thread/8511706.

Since latest Macs are equipped only with usb-c ports for many of external devices one has to use hubs to connect monitors, flash drives, head phones, etc.  The setup would look very similar to one shown below in Intel paper.  And not able to connect them while using wifi became a blocker for me to use this new computer.  Interestingly,  in my case the issue was worse when I connected the hub to the right side ports while left side ports also did poorly.

Wifi_Intel_2012_paper_usb3_noise

Read More »

Set terminal background color based on system name

In small to medium size companies where one has to wear multiple hats and work on different systems at the same time it is critical to take help from the automated systems as much as any other tool to ensure and be aware of the context/system that one is on.   It is not uncommon to have multiple terminal windows open and connected to development, QA, stage and production environments at the same time.

As one switches from one system to another any mistake can have ugly impact especially when dealing with production issues under stress.  A simple “rm” command or “sql drop table on fact” from Vertica vsql, say, can create havoc.   I understand that you can put many checks in place including have appropriate access, aliases (rm=’rm -i’, for example), set prompts (PS1, PS2..) with hostname, color, etc.  But it is also possible to override alias or unalias to delete bunch of files with run “rm -f”.  
With many checks in place, one thing that I always prefer is having the background of the terminal color set based on hostname or system type – dev, production, etc.  On Mac I use following script and name it something like ssh2 and set the $PATH (bash) and have alias for many of these systems like

alias sshProdBox1=’ssh2 shiva@productionBox1.anywhere.com’

Script uses bash shell and AppleScript (http://en.wikipedia.org/wiki/AppleScript and https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptX/AppleScriptX.html and http://en.wikibooks.org/wiki/AppleScript_Programming ) on Mac.

On connecting to remote box background color is appropriately set – red  for production, light blue for QA,  gray for Dev, etc.  and on disconnecting terminal is reverted back to white fonts with black background. 

#!/bin/bash                                                                                                                                              
# Local window font is white on black background.  On exiting from any ssh reset the terminal window to this config (white fonts on black screen).

HOSTNAME=`echo $@ | sed s/.*@//`
# echo $HOSTNAME, $@
if [ ${HOSTNAME} ]; then
    echo “ssh to $HOSTNAME”
else
    echo “Missing ssh host. Exiting.”
    exit 1
fi

set_bg_color () {
    # color values are in ‘{R, G, B, A}’ format, all 16-bit unsigned integers (0-65535)
    osascript -e “tell application \”Terminal\” to set background color of window 1 to $1″
}

set_font_color () {
    osascript -e “tell application \”Terminal\” ” \
              -e    “tell selected tab of front window” \
              -e        “set normal text color to $1” \
              -e    “end tell” \
              -e “end tell”
}

# On exit from connecting revert back to local setting – white fonts on black background
on_exit () {
    set_bg_color   “{0, 0, 0, 50000}”                            # Black bg
    set_font_color “{65000, 65000, 65000, 50000}”   # White font
}
trap on_exit EXIT

# Main
case $HOSTNAME in

    # My dev with white fonts on dark gray)
        set_bg_color    “{15000, 15000, 15000, 50000}”
        ;;

….
….
esac
Remote dev box:
Remote production box:
Remote qa box: