CIS Apple 10.11 Benchmark suggestion

Save yourself some time if you are ever testing some of your hardware against the Centre for Information Security’s (CIS) Apple OSX 10.11 Benchmark by changing the command in 2.1.1. It recommends:

system_profiler | grep "Bluetooth:" -A 20 | grep Connectable

Instead use:

system_profiler SPBluetoothDataType | grep "Bluetooth:" -A 20 | grep Connectable

The first command takes 43.395s vs 0.227s for the latter on one of the machines where I timed the execution.

If you have to convince your infosec auditor, just search for system_profiler in the document. Every other instance drills down lower and they must have missed this optimization that will hopefully show up in future revisions of the benchmark or new benchmarks documents for subsequent OSX releases like macOS Sierra.

Fixing a dyld error

I use homebrew on my Mac and recently ran into the error below:

dyld: Library not loaded: /usr/local/lib/libpcre.1.dylib
Referenced from: /usr/local/opt/yara/lib/libyara.3.dylib
Reason: image not found
Trace/BPT trap: 5

The homebrew documentation has a wonderful troubleshooting section.

The three commands below fixed my error, but the last might be all that is required if you have the same issue.

$ brew update && brew update && brew doctor
$ brew unlink pcre && brew link --overwrite pcre
$ Error: No such keg: /usr/local/Cellar/pcre
$ brew install pcre

Converting NSDate to String using Swift 2.2

I recently had to convert NSDate to String and thought I’d post it here in case it helps someone else.

Let’s say you have a date created of: 2015-08-27 04:32:57 +0000

To return NSDate as String in the exact same format, use the code below:

let formatter = NSDateFormatter()
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss ZZZ"
formatter.timeZone = NSTimeZone(abbreviation: "UTC")
let dateCreated = formatter.stringFromDate(attributes[NSFileCreationDate] as! NSDate)
print(dateCreated)

Hat tip to this StackOverflow answer.

A Year of TED talks: 2nd Week

One of my goals for 2016 is to watch 365 TED talks, one for each day of the year. Ideally, I’m going to try to watch one daily but I recognize that sometimes that might not be possible. I’m keeping track of the talks I watch because I noticed that several appear on more than one curated playlist.Welcome to Week 2. If you would like to see the list from the previous week, click here.

8. Dan Gilbert: The Surprising Science Of Happiness
via: Matt Mullenweg

9. Scott Dinsmore: How to find work you love

10. Emily Jackson: Uncompromising

11. Hans Rosling: The best stats you’ve ever seen
via: a TED curated playlist: 11 must-see TED Talks

12. David Christian: The history of our world in 18 minutes
via: a TED curated playlist: 11 must-see TED Talks

A Year of TED talks: 1st Week

One of my goals for 2016 is to watch 365 TED talks, one for each day of the year. Ideally, I’m going to try to watch one daily but I recognize that sometimes that might not be possible. I’m keeping track of the talks I watch because I noticed that several appear on more than one curated playlist.

All the TED talks for this week come from a curated playlist called Talks to form better habits.

1. Matt Cutts: Try Something New For 30 Days

2. Sandra Aamodt: Why dieting doesn’t usually work

3. Emily Ballets: Why some people find exercise harder than others

4. Shlomo Benartzi: Saving for tomorrow, tomorrow

5. Dean Ornish: Your genes are not your fate

6. Guy Winch: Why we all need to practice emotional first aid

7. Dan Buttoner: How to live to be 100+

Click here to go to Week 2.