#Mac OS X
| # Extract Files | |
| extract() { | |
| if [ -f $1 ] ; then | |
| case $1 in | |
| *.tar.bz2) tar xvjf $1 ;; | |
| *.tar.gz) tar xvzf $1 ;; | |
| *.tar.xz) tar xvJf $1 ;; | |
| *.bz2) bunzip2 $1 ;; | |
| *.rar) unrar x $1 ;; | |
| *.gz) gunzip $1 ;; |
| ^[\w.%+-]+@(?:[\w-]+\.)+[A-Za-z]{2,4}$ | |
| Explanation: | |
| ^ # Start of string. If searching in-line replace with \b | |
| [\w.%+-]+ # Matches alphanumeric, _, ., %, +, or - repeatedly | |
| @ # name-domain separator | |
| (?: | |
| [\w-]+ # Matches alphanumeric or - repeatedly | |
| \. # Matches dot in domain separator | |
| )+ # Matches for one domain or for multiple subdomains |
After my dad died, I wanted to be able to have access any of his online accounts going forward. My dad was a Safari user and used iCloud Keychain to sync his credentials across his devices. I don’t want to have to keep an OS X user account around just to access his accounts, so I wanted to export his credentials to a portable file.
This is the process I used to create a CSV file of his credentials in the format “example.com,user,pass”. This portable format would be pretty easy to import into 1Password or Safari in the future.
The way I went about this isn’t great; it opens up more opportunities for apps to control one’s Mac through Accessibility APIs, it writes plaintext passwords to disk, and it could use some cleaning up. A better approach might leverage the security command line tool that ships with OS X. That said, I found this method to be a fun illustration of what’s possible us
| #!/bin/sh | |
| # | |
| # git-stack: Push this commit to a branch specified in its | |
| # commit description. | |
| # | |
| # -- IMPORTANT -- this script is for macOS (using BSD sed) | |
| # | |
| # Taken from https://wchargin.github.io/posts/managing-dependent-pull-requests/ | |
| # Copyright (c) 2017 William Chargin. Released under the MIT license. |