Creating an OS X El Capitan install flash drive

Format the USB Flash Drive using Disk Utils:

http://www.macworld.com/article/2990837/storage/how-to-format-a-startup-drive-in-el-capitan.html

The volume name in the next step is /Volumes/name-you-gave-the-volume-in-the-first-step.

Copy install files to the Flash Drive using createinstallmedia:

http://www.macworld.com/article/2981585/operating-systems/how-to-make-a-bootable-os-x-10-11-el-capitan-installer-drive.html

To boot from the flash drive, reboot your Mac holding down the Option key and the choose the icon for the flash drive.

Changing your git client password to github.com on OS X / adding Personal Access Token for git client

Just ran into this as I had changed my account password a few days back, and the approach to change your password for your git client on OS X is not that obvious. At the same time I enabled Two Factor Authentication for my github account. When using with a command-line git client, this also requires generating a Personal Access Token and passing it with your authentication.

Instructions in this post here – you need to change your password in the Keychain Access app.

Create a Personal Access Token following steps here.

Next, when adding a remote for the repo, pass the token like this:

git remote add github https://github-id:access-token@github.com/path-to/remote-repo.git

Now when you push to the remote repo, you’ll be authenticated with your token, and should be all set.

 

Shell scripting notes – searching matching filenames and matching content

Some random shell scripting notes for future reference:

On OS X: find -E . -regex ‘pattern’

  • -E specifies extended regex support

On Linux flavors: find . -regextype posix-regex -regex ‘pattern’

Posix vs basic vs extended regex character class differences.

Pipe result to newfile > : eg grep ‘pattern’ file > output.txt

Pipe result appending to file > : eg grep ‘pattern’ file >> output.txt

Capture output as String? : $(some expression)

Iterate files:

for f in some-file-pattern or something producing a list of files
do ... done

Use find . -name ‘pattern’ to recurse matching files down subdirs

Find with a regex for multiple patterns:

find -E . -regex ".*ext1|.*ext2|.*ext3"

first line of file:

head -n 1 filename

grep -o : only display match

Match patterns in file and output matches or matched groups:

Match files, patterns in files, and pipe matches to file: