Notes and Tips

A simple collection of tips, quotes, and other snippets of things I've learned and found interesting.


Send macOS to sleep immediately via the terminal

pmset sleepnow

List all devices available in Xcode

xcrun simctl list devices

Delete unavailable simulators in Xcode

xcrun simctl delete unavailable

Delete specific devices in Xcode

xcrun simctl delete

Replace strings

sed -i 's/Notes/Posts/g' *.html

Supporting dark theme via the use of meta. Not all browsers support this.

<meta name="color-scheme" content="light dark">
<meta name="theme-color" media="(prefers-colors-scheme: light)" content="#f8f8f8">
<meta name="theme-color" media="(prefers-colors-scheme: dark)" content="#030303">

Lock the screen on a Mac via the terminal


open -a /System/Library/CoreServices/ScreenSaverEngine.app

Apple Script

tell application "/System/Library/CoreServices/ScreenSaverEngine.app"
end tell

List the number of full battery charging cycles (on macOS)

system_profiler SPPowerDataType | grep "Cycle Count" | awk '{print $3}'

Questions to ask when designing software and we need to keep it secure

  1. What am I trying to protect?
  2. What am I trying to protect it from?
  3. How do I want to protect it?

Camera setting for night shooting

  1. ISO 3,200 by default but will increase to 6,400+ when necessary
  2. Aperture priority (‘A’) mode
  3. Aperture value likely to be at the wider end of the scale – usually between F1.2 to F5.6, depending on the subject
  4. Exposure compensation (+/-) used occasionally for fine-tuning exposure
  5. Manual focusing (AF can be too slow). You’ll find that with practice this will become quick and easy, especially when using red focus peaking

Camera setting for urban photography

  1. Aperture priority (‘A’) mode
  2. Auto ISO
  3. Shutter speed min 1/250


"If you aim at nothing, you hit nothing."

"There is nothing outside of yourself that can ever enable you to get better, stronger, richer, quicker, or smarter. Everything is within. Everything exists. Seek nothing outside of yourself."

Miyamoto Musashi, The Book of Five Rings

"The more we detach from things that don’t add value to our lives, the calmer, the freer, and the lighter we feel."

The Minimalists

"Reject what didn’t work for you and move on. You don’t need an adversary. You just need to change. Or, in the words of a dear friend, you shouldn’t 'give a shit about people who don’t give a shit.'"

Mark Twight

"Opt for privacy and solitude. That doesn’t make you antisocial or cause you to reject the rest of the world. But you need to breathe. And you need to be."

Albert Camus, Notebooks

“Less is more, more is lazy.”

Jason McCarthy, GORUCK.

"When you teach your son, you teach your son’s son."

The Talmud

"The mind commands the body and it obeys. The mind orders itself and meets resistance."

Frank Herbert, Dune

Last updated 06 Jun 2023