Once again Greg has put something into code that I had been pondering. This looks really useful:
Author: ab
Using ShellCheck with BBEdit
Several people I follow in Twitter have pointed a quite useful looking tools called ShellCheck. It will scan shell script code for common problems that may lead to errors later, especially quoting.
However, the script is written in Haskell, which brings with it a rat’s tail of dependencies if you want to install it on your own Mac.
Since I did not want to bother with that I wrote a script that will grab the code from the frontmost BBEdit window and paste it into the webpage:
Drop this in your BBEdit Scripts folder and enjoy!
Dock Master – A Superior Profile Maker for Managing the Dock
I just wish this was a script, but still very useful.
Dock Master – A Superior Profile Maker for Managing the Dock — Error-free IT.
Mac-Scripts by MacMiniVault
I am not a fan of directing the output of curl
directly into bash
. But they also posted the scripts on Github for inspection. Good Stuff!
Signing .mobileconfig Profiles With Keychain Certificates
Check Python Syntax in BBEdit with flake8
There are existing scripts out there that will run flake8 against a python file in BBEdit, but none of them worked quite the way I wanted. So here is mine:
Before you can run this, you need to install flake with sudo easy_install flake8
. Then you need to drop this script in ~/Library/Application Support/BBEdit/Scripts
. You can launch it from the menu with the script icon.
Mac Printing Scripts Mashup
Mac keyboard shortcuts
On Internet Shortcut Files
If you are managing Macs and PCs, then you will frequently connect to other computers or virtual machines through screen sharing, secure shell or other means. Here is a simple trick to make those connections easier:
Open your favored UI text editor (Text Edit will do) and type
vnc://<username>@<hostname>
Replace <username>
and <hostname>
with your username and hostname for a Mac you frequently share the screen with.
Then select the entire text and drag it to the desktop. It will create a file with “@” sign on the icon. When you double click this file, Screen Sharing opens and asks for the password (unless it is stored in the Keychain) and connects the remote session.
Now rename this file to VNC <hostname>
. Then activate Spotlight (cmd-space) and start typing “VNC” and the hostname. After a few characters the VNC link file should be the top result. Hit return and the session starts.
As an extra bonus you can put these files in a folder in your cloud file system of choice (iCloud Drive, Dropbox, Google Drive, Box, etc.) and they will sync to all your Macs.
Other Protocols
You can do the same with any URI scheme:
ssh://<username>@<hostname>:<port>
afp://<username>@<hostname>/<share>
smb://<username>@<hostname>/<share>
http://<hostname/<path>
Microsoft Remote Desktop/RDP
The new Microsoft Remote Desktop application available in the Mac App Store also supports rdp
URI schemes, however the syntax is a bit odd. To connect to a remote host you have to use:
rdp://full%20address=s:<hostname>&username=s:<username>
You can find more options for this URI scheme in this technote. One I have found useful is screen mode id
where a value of 1
means to open the remote screen in a window a value of 2
means full screen mode.
Looking into the files
If inspect the file generated by dragging, you can see that it is a property list file with a single key URL
and a string value containing the link.
Files for a vnc
URI get the .vncloc
extension, http[s]
URIs get the .webloc
extension, ftp
URIs get the .ftploc
extension and everything else seems to get .inetloc
extensions. (There may be more, let me know if you find any.)
This makes it easy to write a short script that simplifies the creation of these internet location files:
Sample use:
./create_netloc.py vnc://user@host.example.com
will create VNC host.vncloc
./create_netloc.py http://munki.example.com/munkireport-php/ Munkireport
will create Munkireport.webloc
./create_netloc.py "rdp://full%20address=s:host.example.com&username=s:name&screen%20mode%20id=i:1"
will create RDP host.inetloc
Note on
rdp
links: since the ‘&’ is special in shell commands you need to quote the uri if any are present.
Fun with find
and git
find ~ -type d -name .git -exec dirname {} \;
will show you all folders in your home directory which have a .git
subfolder — i.e. they are git repositories.
This is useful, but can be extended to:
find ~ -type d -name .git -exec dirname {} \; | tr '\n' '\000' | xargs -0 -n1 -I % git -C "%" status
to show the git status
output of all your git repositories.
Time to clean up!