<commit_before>#!/usr/bin/env zsh
echo_title "Defining OS X options"

# Set wallpaper
#osascript -e "tell application \"System Events\" to set picture of every desktop to \"~/Dropbox/wallpapers/example.jpg\""

COMPUTER_NAME="$USER"
COMPUTER_MODEL=`sysctl -n hw.model`
if [[ $COMPUTER_MODEL == "iMac"* ]]
then
  COMPUTER_NAME="i$COMPUTER_NAME"
elif [[ $COMPUTER_MODEL == "MacBook"* ]]
then
  COMPUTER_NAME="Mac$COMPUTER_NAME"
fi
# notifying computer name update only if name will be changed
if [[ $COMPUTER_NAME != $(sudo scutil --get ComputerName) ]]
then
  echo_info "Computer name set to $COMPUTER_NAME"
fi
sudo scutil --set ComputerName $COMPUTER_NAME
sudo scutil --set HostName $COMPUTER_NAME
sudo scutil --set LocalHostName $COMPUTER_NAME
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $COMPUTER_NAME

###
# SecAssessment system policy security
###
if type spctl  &> /dev/null
then
  # Allow apps downloaded from "Anywhere"
  sudo spctl --master-disable
fi

###
# pmset -a: for all (-b battery, -c charger)
###

if type pmset  &> /dev/null
then
  # Computer sleep: Never
  sudo pmset -a sleep 0

  # Display sleep: 10 min
  sudo pmset -a displaysleep 10

  # Wake for network access
  sudo pmset -a womp 1

  # Automatically reduce brightness before display goes to sleep
  sudo pmset -a halfdim 0

  # Start up automatically after a power failure
  sudo pmset -a autorestart 1

  # Never wake the machine if lib open or when power source changes
  sudo pmset -a lidwake 0
  sudo pmset -a acwake 0
fi

###
# Enable access for assistive devices
###
if ls /private/var/db/.AccessibilityAPIEnabled &> /dev/null
then
  # /usr/bin/osascript -e 'tell application "System Events" to set UI elements enabled to true'
  echo -n 'a' | sudo tee /private/var/db/.AccessibilityAPIEnabled > /dev/null 2>&1
  sudo chmod 444 /private/var/db/.AccessibilityAPIEnabled
fi

# Never require password after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 0

# Startup sound chime effect (disable: %00)
sudo nvram SystemAudioVolume=%10﻿

# Enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2

# recovery_message 'If this Mac is found, please call +33 6 78 13 54 39 - Si vous trouvez ce Mac, merci d\'appeler le 06 78 13 54 39': }
# https://github.com/boxen/puppet-osx/blob/master/manifests/recovery_message.pp
<commit_msg>Play sound feedback when adjusting volume<commit_after>#!/usr/bin/env zsh
echo_title "Defining OS X options"

# Set wallpaper
#osascript -e "tell application \"System Events\" to set picture of every desktop to \"~/Dropbox/wallpapers/example.jpg\""

COMPUTER_NAME="$USER"
COMPUTER_MODEL=`sysctl -n hw.model`
if [[ $COMPUTER_MODEL == "iMac"* ]]
then
  COMPUTER_NAME="i$COMPUTER_NAME"
elif [[ $COMPUTER_MODEL == "MacBook"* ]]
then
  COMPUTER_NAME="Mac$COMPUTER_NAME"
fi
# notifying computer name update only if name will be changed
if [[ $COMPUTER_NAME != $(sudo scutil --get ComputerName) ]]
then
  echo_info "Computer name set to $COMPUTER_NAME"
fi
sudo scutil --set ComputerName $COMPUTER_NAME
sudo scutil --set HostName $COMPUTER_NAME
sudo scutil --set LocalHostName $COMPUTER_NAME
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $COMPUTER_NAME

###
# SecAssessment system policy security
###
if type spctl  &> /dev/null
then
  # Allow apps downloaded from "Anywhere"
  sudo spctl --master-disable
fi

###
# pmset -a: for all (-b battery, -c charger)
###

if type pmset  &> /dev/null
then
  # Computer sleep: Never
  sudo pmset -a sleep 0

  # Display sleep: 10 min
  sudo pmset -a displaysleep 10

  # Wake for network access
  sudo pmset -a womp 1

  # Automatically reduce brightness before display goes to sleep
  sudo pmset -a halfdim 0

  # Start up automatically after a power failure
  sudo pmset -a autorestart 1

  # Never wake the machine if lib open or when power source changes
  sudo pmset -a lidwake 0
  sudo pmset -a acwake 0
fi

###
# Enable access for assistive devices
###
if ls /private/var/db/.AccessibilityAPIEnabled &> /dev/null
then
  # /usr/bin/osascript -e 'tell application "System Events" to set UI elements enabled to true'
  echo -n 'a' | sudo tee /private/var/db/.AccessibilityAPIEnabled > /dev/null 2>&1
  sudo chmod 444 /private/var/db/.AccessibilityAPIEnabled
fi

# Never require password after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 0

# Startup sound chime effect (disable: %00)
sudo nvram SystemAudioVolume=%10﻿

# Play sound feedback when adjusting volume
defaults write -g com.apple.sound.beep.feedback -boolean true

# Enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2

# recovery_message 'If this Mac is found, please call +33 6 78 13 54 39 - Si vous trouvez ce Mac, merci d\'appeler le 06 78 13 54 39': }
# https://github.com/boxen/puppet-osx/blob/master/manifests/recovery_message.pp

{'fraction_non_alphanumeric': 0.09354518371400199, 'fraction_numerical': 0.016683217477656404, 'mean_word_length': 4.128309572301426, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4478306', 'n_tokens_mistral': 1752, 'n_tokens_neox': 1624, 'n_words': 597}