adapted osx_settings.sh

adapted osx_settings.sh

changed to my liking

#!/usr/bin/env bash

# ~/osx.sh — Originally from https://mths.be/osx

# Ask for the administrator password upfront
sudo -v

# Keep-alive: update existing `sudo` time stamp until `osx.sh` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &

###############################################################################
# General UI/UX                                                               #
###############################################################################

# Set computer name (as done via System Preferences → Sharing)
#sudo scutil --set ComputerName "0x6D746873"
#sudo scutil --set HostName "0x6D746873"
#sudo scutil --set LocalHostName "0x6D746873"
#sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "0x6D746873"

# Set standby delay to 24 hours (default is 1 hour or 3600)
#sudo pmset -a standbydelay 86400

# Disable the sound effects on boot
#sudo nvram SystemAudioVolume=" "

# Disable transparency in the menu bar and elsewhere on Yosemite
#defaults write com.apple.universalaccess reduceTransparency -bool true

# Menu bar: hide the Time Machine, Volume, and User icons
#for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do
#    defaults write "${domain}" dontAutoLoad -array \
#        "/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \
#        "/System/Library/CoreServices/Menu Extras/Volume.menu" \
#        "/System/Library/CoreServices/Menu Extras/User.menu"
#done
defaults write com.apple.systemuiserver menuExtras -array \
    "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \
    "/System/Library/CoreServices/Menu Extras/AirPort.menu" \
    "/System/Library/CoreServices/Menu Extras/Battery.menu" \
    "/System/Library/CoreServices/Menu Extras/Clock.menu"

# Set highlight color to green
#defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600"

# Set sidebar icon size to medium
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1

# Increase window resize speed for Cocoa applications
#defaults write NSGlobalDomain NSWindowResizeTime -float 0.001

# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true

# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true

# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false

# Automatically quit printer app once the print jobs complete
#defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true

# Disable the “Are you sure you want to open this application?” dialog
#defaults write com.apple.LaunchServices LSQuarantine -bool false

# Remove duplicates in the “Open With” menu (also see `lscleanup` alias)
#/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

# Display ASCII control characters using caret notation in standard text views
# Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt`
#defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true

# Disable Resume system-wide
#defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false

# Disable automatic termination of inactive apps
#defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true

# Disable the crash reporter
#defaults write com.apple.CrashReporter DialogType -string "none"

# Set Help Viewer windows to non-floating mode
defaults write com.apple.helpviewer DevMode -bool true

# Fix for the ancient UTF-8 bug in QuickLook (https://mths.be/bbo)
# Commented out, as this is known to cause problems in various Adobe apps :(
# See https://github.com/mathiasbynens/dotfiles/issues/237
#echo "0x08000100:0" > ~/.CFUserTextEncoding

# Reveal IP address, hostname, OS version, etc. when clicking the clock
# in the login window
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName

# Restart automatically if the computer freezes
sudo systemsetup -setrestartfreeze on

# Never go into computer sleep mode
#sudo systemsetup -setcomputersleep Off > /dev/null

# Set the computer to sleep after 60 minutes
#sudo systemsetup -setcomputersleep 60

# Check for software updates daily, not just once per week
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1

# Disable Notification Center and remove the menu bar icon
#launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null

# Disable smart quotes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false

# Disable smart dashes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false

###############################################################################
# SSD-specific tweaks                                                         #
# You might want to disable these if you are not running an SSD               #
###############################################################################

# Disable local Time Machine snapshots
#sudo tmutil disablelocal

# Disable hibernation (speeds up entering sleep mode)
#sudo pmset -a hibernatemode 0

# Remove the sleep image file to save disk space
#sudo rm -f /private/var/vm/sleepimage
# Create a zero-byte file instead…
#sudo touch /private/var/vm/sleepimage
# …and make sure it can’t be rewritten
#sudo chflags uchg /private/var/vm/sleepimage

# Disable the sudden motion sensor as it’s not useful for SSDs
#sudo pmset -a sms 0

###############################################################################
# Trackpad, mouse, keyboard, Bluetooth accessories, and input                 #
###############################################################################

# Trackpad: enable tap to click for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1

# Trackpad: map bottom right corner to right-click
#defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
#defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
#defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
#defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true

# Disable “natural” (Lion-style) scrolling
#defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false

# Increase sound quality for Bluetooth headphones/headsets
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40

# Enable full keyboard access for all controls
# (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3

# Use scroll gesture with the Ctrl (^) modifier key to zoom
defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
# Follow the keyboard focus while zoomed in
defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true

# Disable press-and-hold for keys in favor of key repeat
#defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false

# Set a blazingly fast keyboard repeat rate
#defaults write NSGlobalDomain KeyRepeat -int 0

# Set language and text formats
#defaults write NSGlobalDomain AppleLanguages -array "en"
#defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD"
#defaults write NSGlobalDomain AppleMeasurementUnits -string "Inches"
#defaults write NSGlobalDomain AppleMetricUnits -bool false

# Set the timezone; see `sudo systemsetup -listtimezones` for other values
#sudo systemsetup -settimezone "America/New_York" > /dev/null

# Disable auto-correct
#defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false

# Stop iTunes from responding to the keyboard media keys
#launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null

###############################################################################
# Screen                                                                      #
###############################################################################

# Require password immediately after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0

# Save screenshots to the desktop
#defaults write com.apple.screencapture location -string "${HOME}/Desktop"

# Save screenshots to the Pictures/Screenshots
mkdir ${HOME}/Pictures/Screenshots
defaults write com.apple.screencapture location -string "${HOME}/Pictures/Screenshots"

# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
defaults write com.apple.screencapture type -string "png"

# Disable shadow in screenshots
#defaults write com.apple.screencapture disable-shadow -bool true

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

# Enable HiDPI display modes (requires restart)
#sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true

###############################################################################
# Finder                                                                      #
###############################################################################

# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
defaults write com.apple.finder QuitMenuItem -bool true

# Finder: disable window animations and Get Info animations
#defaults write com.apple.finder DisableAllAnimations -bool true

# Set Desktop as the default location for new Finder windows
# For other paths, use `PfLo` and `file:///full/path/here/`
#defaults write com.apple.finder NewWindowTarget -string "PfDe"
#defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/"

# Show icons for hard drives, servers, and removable media on the desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true

# Finder: show hidden files by default
#defaults write com.apple.finder AppleShowAllFiles -bool true

# Finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true

# Finder: show status bar
defaults write com.apple.finder ShowStatusBar -bool true

# Finder: show path bar
defaults write com.apple.finder ShowPathbar -bool true

# Finder: allow text selection in Quick Look
defaults write com.apple.finder QLEnableTextSelection -bool true

# Display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true

# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"

# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

# Enable spring loading for directories
#defaults write NSGlobalDomain com.apple.springing.enabled -bool true

# Tweak the spring loading delay for directories
#defaults write NSGlobalDomain com.apple.springing.delay -float .5

# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

# Disable disk image verification
#defaults write com.apple.frameworks.diskimages skip-verify -bool true
#defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
#defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true

# Automatically open a new Finder window when a volume is mounted
#defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
#defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
#defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true

# Show item info near icons on the desktop and in other icon views
#/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
#/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
#/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist

# Show item info at the bottom of the icons on the desktop
#/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom true" ~/Library/Preferences/com.apple.finder.plist

# Enable snap-to-grid for icons on the desktop and in other icon views
#/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
#/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
#/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist

# Set grid spacing for icons on the desktop and in other icon views
#/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 50" ~/Library/Preferences/com.apple.finder.plist
#/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 50" ~/Library/Preferences/com.apple.finder.plist
#/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 50" ~/Library/Preferences/com.apple.finder.plist

# Set the size of icons on the desktop and in other icon views
#/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 24" ~/Library/Preferences/com.apple.finder.plist
#/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 24" ~/Library/Preferences/com.apple.finder.plist
#/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 24" ~/Library/Preferences/com.apple.finder.plist

# Use list view in all Finder windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"

# Disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false

# Empty Trash securely by default
defaults write com.apple.finder EmptyTrashSecurely -bool true

# Enable AirDrop over Ethernet and on unsupported Macs running Lion
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true

# Enable the MacBook Air SuperDrive on any Mac
#sudo nvram boot-args="mbasd=1"

# Show the ~/Library folder
chflags nohidden ~/Library

# Remove Dropbox’s green checkmark icons in Finder
#file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns
#[ -e "${file}" ] && mv -f "${file}" "${file}.bak"

# Expand the following File Info panes:
# “General”, “Open with”, and “Sharing & Permissions”
defaults write com.apple.finder FXInfoPanesExpanded -dict \
    General -bool true \
    OpenWith -bool true \
    Privileges -bool true

###############################################################################
# Dock, Dashboard, and hot corners                                            #
###############################################################################

# Enable highlight hover effect for the grid view of a stack (Dock)
#defaults write com.apple.dock mouse-over-hilite-stack -bool true

# Set the icon size of Dock items to 36 pixels
#defaults write com.apple.dock tilesize -int 36

# Change minimize/maximize window effect
defaults write com.apple.dock mineffect -string "scale"

# Minimize windows into their application’s icon
#defaults write com.apple.dock minimize-to-application -bool true

# Enable spring loading for all Dock items
#defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true

# Show indicator lights for open applications in the Dock
defaults write com.apple.dock show-process-indicators -bool true

# Wipe all (default) app icons from the Dock
# This is only really useful when setting up a new Mac, or if you don’t use
# the Dock to launch apps.
#defaults write com.apple.dock persistent-apps -array

# Don’t animate opening applications from the Dock
#defaults write com.apple.dock launchanim -bool false

# Speed up Mission Control animations
#defaults write com.apple.dock expose-animation-duration -float 0.1

# Don’t group windows by application in Mission Control
# (i.e. use the old Exposé behavior instead)
#defaults write com.apple.dock expose-group-by-app -bool false

# Disable Dashboard
#defaults write com.apple.dashboard mcx-disabled -bool true

# Don’t show Dashboard as a Space
defaults write com.apple.dock dashboard-in-overlay -bool true

# Don’t automatically rearrange Spaces based on most recent use
defaults write com.apple.dock mru-spaces -bool false

# Remove the auto-hiding Dock delay
#defaults write com.apple.dock autohide-delay -float 0
# Remove the animation when hiding/showing the Dock
#defaults write com.apple.dock autohide-time-modifier -float 0

# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true

# Make Dock icons of hidden applications translucent
defaults write com.apple.dock showhidden -bool true

# Disable the Launchpad gesture (pinch with thumb and three fingers)
#defaults write com.apple.dock showLaunchpadGestureEnabled -int 0

# Reset Launchpad, but keep the desktop wallpaper intact
#find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete

# Add iOS Simulator to Launchpad
#sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app" "/Applications/iOS Simulator.app"

# Add a spacer to the left side of the Dock (where the applications are)
#defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
# Add a spacer to the right side of the Dock (where the Trash is)
#defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}'

# Hot corners
# Possible values:
#  0: no-op
#  2: Mission Control
#  3: Show application windows
#  4: Desktop
#  5: Start screen saver
#  6: Disable screen saver
#  7: Dashboard
# 10: Put display to sleep
# 11: Launchpad
# 12: Notification Center
# Top left screen corner → Mission Control
#defaults write com.apple.dock wvous-tl-corner -int 2
#defaults write com.apple.dock wvous-tl-modifier -int 0
# Top right screen corner → Desktop
#defaults write com.apple.dock wvous-tr-corner -int 4
#defaults write com.apple.dock wvous-tr-modifier -int 0
# Bottom left screen corner → Start screen saver
defaults write com.apple.dock wvous-bl-corner -int 4
defaults write com.apple.dock wvous-bl-modifier -int 0

###############################################################################
# Safari & WebKit                                                             #
###############################################################################

# Privacy: don’t send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true

# Press Tab to highlight each item on a web page
#defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true
#defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true

# Show the full URL in the address bar (note: this still hides the scheme)
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true

# Set Safari’s home page to `about:blank` for faster loading
defaults write com.apple.Safari HomePage -string "about:blank"

# Prevent Safari from opening ‘safe’ files automatically after downloading
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false

# Allow hitting the Backspace key to go to the previous page in history
#defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true

# Hide Safari’s bookmarks bar by default
#defaults write com.apple.Safari ShowFavoritesBar -bool false

# Hide Safari’s sidebar in Top Sites
defaults write com.apple.Safari ShowSidebarInTopSites -bool false

# Disable Safari’s thumbnail cache for History and Top Sites
#defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2

# Enable Safari’s debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true

# Make Safari’s search banners default to Contains instead of Starts With
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false

# Remove useless icons from Safari’s bookmarks bar
#defaults write com.apple.Safari ProxiesInBookmarksBar "()"

# Enable the Develop menu and the Web Inspector in Safari
#defaults write com.apple.Safari IncludeDevelopMenu -bool true
#defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
#defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true

# Add a context menu item for showing the Web Inspector in web views
#defaults write NSGlobalDomain WebKitDeveloperExtras -bool true

###############################################################################
# Mail                                                                        #
###############################################################################

# Disable send and reply animations in Mail.app
#defaults write com.apple.mail DisableReplyAnimations -bool true
#defaults write com.apple.mail DisableSendAnimations -bool true

# Copy email addresses as `foo@example.com` instead of `Foo Bar <foo@example.com>` in Mail.app
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false

# Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app
#defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" -string "@\\U21a9"

# Display emails in threaded mode, sorted by date (oldest at the top)
defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes"
defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "no"
defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date"

# Disable inline attachments (just show the icons)
defaults write com.apple.mail DisableInlineAttachmentViewing -bool true

# Disable automatic spell checking
defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled"

###############################################################################
# Spotlight                                                                   #
###############################################################################

# Hide Spotlight tray-icon (and subsequent helper)
#sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search
# Disable Spotlight indexing for any volume that gets mounted and has not yet
# been indexed before.
# Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
#sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
# Change indexing order and disable some search results
# Yosemite-specific search results (remove them if your are using OS X 10.9 or older):
#   MENU_DEFINITION
#   MENU_CONVERSION
#   MENU_EXPRESSION
#   MENU_SPOTLIGHT_SUGGESTIONS (send search queries to Apple)
#   MENU_WEBSEARCH             (send search queries to Apple)
#   MENU_OTHER
#defaults write com.apple.spotlight orderedItems -array \
#    '{"enabled" = 1;"name" = "APPLICATIONS";}' \
#    '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
#    '{"enabled" = 1;"name" = "DIRECTORIES";}' \
#    '{"enabled" = 1;"name" = "PDF";}' \
#    '{"enabled" = 1;"name" = "FONTS";}' \
#    '{"enabled" = 0;"name" = "DOCUMENTS";}' \
#    '{"enabled" = 1;"name" = "MESSAGES";}' \
#    '{"enabled" = 1;"name" = "CONTACT";}' \
#    '{"enabled" = 0;"name" = "EVENT_TODO";}' \
#    '{"enabled" = 0;"name" = "IMAGES";}' \
#    '{"enabled" = 1;"name" = "BOOKMARKS";}' \
#    '{"enabled" = 1;"name" = "MUSIC";}' \
#    '{"enabled" = 0;"name" = "MOVIES";}' \
#    '{"enabled" = 1;"name" = "PRESENTATIONS";}' \
#    '{"enabled" = 0;"name" = "SPREADSHEETS";}' \
#    '{"enabled" = 1;"name" = "SOURCE";}' \
#    '{"enabled" = 0;"name" = "MENU_DEFINITION";}' \
#    '{"enabled" = 0;"name" = "MENU_OTHER";}' \
#    '{"enabled" = 0;"name" = "MENU_CONVERSION";}' \
#    '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \
#    '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \
#    '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}'
# Load new settings before rebuilding the index
#killall mds > /dev/null 2>&1
# Make sure indexing is enabled for the main volume
#sudo mdutil -i on / > /dev/null
# Rebuild the index from scratch
#sudo mdutil -E / > /dev/null

###############################################################################
# Terminal & iTerm 2                                                          #
###############################################################################

# Only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4

# Use a modified version of the Solarized Dark theme by default in Terminal.app
#osascript <<EOD
#
#tell application "Terminal"
#
#    local allOpenedWindows
#    local initialOpenedWindows
#    local windowID
#    set themeName to "Solarized Dark xterm-256color"
#
#    (* Store the IDs of all the open terminal windows. *)
#    set initialOpenedWindows to id of every window
#
#    (* Open the custom theme so that it gets added to the list
#       of available terminal themes (note: this will open two
#       additional terminal windows). *)
#    do shell script "open '$HOME/init/" & themeName & ".terminal'"
#
#    (* Wait a little bit to ensure that the custom theme is added. *)
#    delay 1
#
#    (* Set the custom theme as the default terminal theme. *)
#    set default settings to settings set themeName
#
#    (* Get the IDs of all the currently opened terminal windows. *)
#    set allOpenedWindows to id of every window
#
#    repeat with windowID in allOpenedWindows
#
#        (* Close the additional windows that were opened in order
#           to add the custom theme to the list of terminal themes. *)
#        if initialOpenedWindows does not contain windowID then
#            close (every window whose id is windowID)
#
#        (* Change the theme for the initial opened terminal windows
#           to remove the need to close them in order for the custom
#           theme to be applied. *)
#        else
#            set current settings of tabs of (every window whose id is windowID) to settings set themeName
#        end if
#
#    end repeat
#
#end tell
#
#EOD

# Enable “focus follows mouse” for Terminal.app and all X11 apps
# i.e. hover over a window and start typing in it without clicking first
#defaults write com.apple.terminal FocusFollowsMouse -bool true
#defaults write org.x.X11 wm_ffm -bool true

#start_if_needed() {
#  local grep_name="[${1:0:1}]${1:1}"
#
#  if [[ -z $(ps aux | grep -e "${grep_name}") ]]; then
#    if [ -e ~/Applications/$1.app ]; then
#      open ~/Applications/$1.app
#    else
#      if [ -e /Applications/$1.app ]; then
#        open /Applications/$1.app
#      fi
#    fi
#  fi
#
#  true
#}
#
## Install the Solarized Dark theme for iTerm
#start_if_needed iTerm
#open "${HOME}/init/Solarized Dark.itermcolors"
#
## Don’t display the annoying prompt when quitting iTerm
#defaults write com.googlecode.iterm2 PromptOnQuit -bool false

###############################################################################
# Time Machine                                                                #
###############################################################################

# Prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true

# Disable local Time Machine backups
#hash tmutil &> /dev/null && sudo tmutil disablelocal

###############################################################################
# Activity Monitor                                                            #
###############################################################################

# Show the main window when launching Activity Monitor
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true

# Visualize CPU usage in the Activity Monitor Dock icon
defaults write com.apple.ActivityMonitor IconType -int 5

# Show all processes in Activity Monitor
defaults write com.apple.ActivityMonitor ShowCategory -int 0

# Sort Activity Monitor results by CPU usage
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
defaults write com.apple.ActivityMonitor SortDirection -int 0

###############################################################################
# Address Book, Dashboard, iCal, TextEdit, and Disk Utility                   #
###############################################################################

# Enable the debug menu in Address Book
#defaults write com.apple.addressbook ABShowDebugMenu -bool true

# Enable Dashboard dev mode (allows keeping widgets on the desktop)
#defaults write com.apple.dashboard devmode -bool true

# Enable the debug menu in iCal (pre-10.8)
#defaults write com.apple.iCal IncludeDebugMenu -bool true

# Use plain text mode for new TextEdit documents
#defaults write com.apple.TextEdit RichText -int 0
# Open and save files as UTF-8 in TextEdit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4

# Enable the debug menu in Disk Utility
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
defaults write com.apple.DiskUtility advanced-image-options -bool true

###############################################################################
# Mac App Store                                                               #
###############################################################################

# Enable the WebKit Developer Tools in the Mac App Store
#defaults write com.apple.appstore WebKitDeveloperExtras -bool true

# Enable Debug Menu in the Mac App Store
#defaults write com.apple.appstore ShowDebugMenu -bool true

###############################################################################
# Messages                                                                    #
###############################################################################

# Disable automatic emoji substitution (i.e. use plain text smileys)
#defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false

# Disable smart quotes as it’s annoying for messages that contain code
#defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false

# Disable continuous spell checking
#defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false

###############################################################################
# Kill affected applications                                                  #
###############################################################################

for app in "Activity Monitor" "Contacts" \
    "Dock" "Finder" "Mail" "Messages" \
    "Safari" "SystemUIServer" "iCal"; do
    killall "${app}" > /dev/null 2>&1
done
echo "Done. Note that some of these changes require a logout/restart of your OS to take effect.  At a minimum, be sure to restart your Terminal."

error: pathspec 'osx_settings.sh' did not match any file(s) known to git


clean script

clean script

#!/bin/bash

rm *.class
rm *.png
rm *.dot

error: pathspec 'output/clean.sh' did not match any file(s) known to git


show status at condor

show status at condor

name=${1}
output=${2}
outputDir=${3}

time=`date "+%Y%m%d%H%M"`

all=`ls ${name} | grep job | wc -l`
echo "There are ${all} jobs in the task ${name}"

mkdir -p ${outputDir}/${output}
mkdir -p ${outputDir}/OLD/${output}_old_${time}
touch ${outputDir}/${output}/file
mv ${outputDir}/${output}/* ${outputDir}/OLD/${output}_old_${time}/

source Merge_output2.sh ${name} ${outputDir}/${output}/
finished=`more ${outputDir}/${output}/*_total.txt | wc -l`
echo "${finished} jobs produced output"

source ShowResults_condor.sh ${name}

echo "Calculating lumi..."
lumiCalc2.py overview -i ${outputDir}/${output}/lumi.json 1>lumi.out 2>lumi.err
tail lumi.out -n 4

touch Resubmit_now.sh
rm -f Resubmit_now.sh
echo "source Resubmit_condor.sh resubmit ${name}" > Resubmit_now.sh
chmod +x Resubmit_now.sh
echo "To resubmit failed jobs do ./Resubmit_now.sh"

error: pathspec 'config/ShowStatus_condor.sh' did not match any file(s) known to git


add check.sh

add check.sh

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/hikelee/cinema.git/'


Fix some bugs

Fix some bugs

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/LolexOrg/Lolex-Tools.git/'


Use the multi-core version of gzip if available

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B-LUC/AdminTools.git/'


Create create_dirs.sh

Create create_dirs.sh

#!/bin/bash
# File: windowsist/StartHere/create_dirs.sh
# Info: Create directories and soft links (shortcuts) to existing directories
#       to create the directories that usually show up in the Linux home folder

here=$(pwd)     # if you are not in the home folder, let's save where you are
cd ~            # Go to the home folder
mkdir bin       # ~/bin is a special directory for you to run programs you've created without a preceeding './'

# Most of your files on the C drive can be found in /mnt/c.
# We will create the softlinks to go to the directories you are used to.
# NOTE: This will NOT link your OneDrive directories.  Those will be linked differently.
userpath="/mnt/c/Users/$username"
ln -s $userpath WinHome   # See why you should use your Windows username as your Linux username?

# Create your basic shortcuts
# I highly recommend you store your stuff not in the Linux home where it could be lost
for d in Desktop Documents Downloads Music Pictures Videos
  if [ ! -d $userpath/$d ]; then
    ln -s $userpath/$d
  fi
done

# Create shortcuts to any cloud based services you use
# TODO: Watch this next line.
for d in "Google Drive" "Dropbox" "OneDrive"
  if [ ! -d $userpath/$d ]; then
    ln -s $userpath/$d
  fi
done

# Create Folders and Shortcuts to store downloaded Software,
# downloaded Repositories, your repositories which should be in Projects,
# and use a Sandbox to as a place to play around with code
for d in Projects Repositories Sandbox Software
  if [ ! -e $userpath/$d ]; then
    mkdir $usrpath/$d
  fi
  if [ ! -d $userpath/$d ] then
    ln -s $userpath/$d
  fi
done

cd $here      # return to where you were

error: pathspec 'StartHere/create_dirs.sh' did not match any file(s) known to git


added folder for extra stuffs

added folder for extra stuffs

green=$( tput setaf 2 )
white=$( tput setaf 7 )
reset=$( tput sgr0 )
PS1="\[$green\]\h\[$white\]:\w$\[$reset\]"
PS1_ALT="\[$green\]\w\n$\[$reset\]"

error: pathspec 'vt18/extra/linux-kmom02/prompt.bash' did not match any file(s) known to git


docker upgrade check + docker-compose pull

Added the following commands:
* sudo apt-get --only-upgrade install docker-engine
* sudo curl -L
  https://github.com/docker/compose/releases/download/1.13.0/docker-compose-`uname
  -s`-`uname -m` > /usr/local/bin/docker-compose
* docker-compose pull

Also move the docker-compose pull command to occur before all containers
are stopped.  This allows the image pull to take as long as it needs
before stopping all running containers.

Todo:
* Only restart the containers that are upgraded
* Query github for the latest version of docker-compose.  Currently a
  docker-compose version is hard-coded in the script

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/bnestelroad/htpc.git/'


Unify function syntax

Unify function syntax

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/mettatw/probable-octo-guacamole.git/'


WIP rustls

WIP rustls

#!/bin/bash
source environ.sh

BROKEN

GIT=https://github.com/redox-os/rustls.git
DIR=rustls

CARGO_ARGS="--no-default-features"
CARGO_BINS=""
cargo_template $*

error: pathspec 'ports/rustls.sh' did not match any file(s) known to git


Run some demo servers

Run some demo servers

#!/bin/bash

PORT=8001 venv/bin/sp -c examples/etc/spanky enroll -n api-nodes -H localhost python server.py &
PORT=8002 venv/bin/sp -c examples/etc/spanky enroll -n api-nodes -H localhost python server.py &
PORT=8003 venv/bin/sp -c examples/etc/spanky enroll -n api-nodes -H localhost python server.py &

error: pathspec 'demo-server.sh' did not match any file(s) known to git


Escape characters used in escape sequence to avoid triggering bugs in Apple Terminal

Closes #45 #57 #58 #86.

#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title
#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
#Fully support screen, iterm, and probably most modern xterm and rxvt
#Limited support for Apple Terminal (Terminal can't set window or tab separately)
function title {
  if [[ "$TERM" == "screen" ]]; then
    print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
  elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
    print -Pn "\e]2;$2:q\a" #set window name
    print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
  fi
}

ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"

#Appears when you have the prompt
function precmd {
  if [ "$DISABLE_AUTO_TITLE" != "true" ]; then
    title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
  fi
}

#Appears at the beginning of (and during) of command execution
function preexec {
  if [ "$DISABLE_AUTO_TITLE" != "true" ]; then
    local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
    title "$CMD" "%100>...>$2%<<"
  fi
}

#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title
#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
#Fully support screen, iterm, and probably most modern xterm and rxvt
#Limited support for Apple Terminal (Terminal can't set window or tab separately)
function title {
  if [[ "$TERM" == "screen" ]]; then
    print -Pn "\ek$1\e\\" #set screen hardstatus, usually truncated at 20 chars
  elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
    print -Pn "\e]2;$2\a" #set window name
    print -Pn "\e]1;$1\a" #set icon (=tab) name (will override window name on broken terminal)
  fi
}

ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"

#Appears when you have the prompt
function precmd {
  if [ "$DISABLE_AUTO_TITLE" != "true" ]; then
    title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
  fi
}

#Appears at the beginning of (and during) of command execution
function preexec {
  if [ "$DISABLE_AUTO_TITLE" != "true" ]; then
    local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
    title "$CMD" "%100>...>$2%<<"
  fi
}


zsh-completion: improved cache validation

allows a user to control how long to keep various caches without
defining their own function to override ours.

The default duration was changed from 7 days to 1 day. which seems a bit
more useful for people who don't have a static number of hosts like
myself.

#compdef salt salt-call salt-cp salt-run salt-key
# The use-cache style is checked in a few places to allow caching minions, modules,
# or the directory salt is installed in.
# you can cache those three with:
# zstyle ':completion:*:salt(|-cp|-call|-run|-key):*' use-cache true
# and/or selectively:
# zstyle ':completion::complete:salt-key:set-option-a-1:'             use-cache false
# zstyle ':completion::complete:salt(|-cp|-call):minions:'            use-cache true
# zstyle ':completion::complete:salt(|-call):modules:'                use-cache true
# zstyle ':completion::complete:salt(|-cp|-call|-run|-key):salt_dir:' use-cache true
#
# cache validation can be controled with the style cache-ttl.
# it expects two arguments: number (days|hours|weeks|months)
# to invalidate the minion cache after four days:
# zstyle ':completion::complete:salt(|-cp|-call):minions:'            cache-ttl 4 days

local state line curcontext="$curcontext" salt_dir

_modules(){
    local _funcs expl curcontext=${curcontext%:*}:modules

    if ! zstyle -m ":completion:$curcontext:" cache-policy '*'; then
        zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
    fi

    if _cache_invalid salt/modules || ! _retrieve_cache salt/modules; then
        _funcs=( ${(M)${(f)"$(command salt-call --local -d 2>/dev/null)"}##[[:alnum:]._]##} )
        _store_cache salt/modules _funcs
    fi

    _wanted modules expl modules _multi_parts "$@" . _funcs
}

_runners(){
    local _runs expl curcontext=${curcontext%:*}:runners

    if ! zstyle -m ":completion:$curcontext:" cache-policy '*'; then
        zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
    fi

    if _cache_invalid salt/runners || ! _retrieve_cache salt/runners; then
        _runs=( ${(M)${(Q)${(f)"$(command salt-run -d 2>/dev/null)"}}##[[:alnum:]._]##} )
        _store_cache salt/runners _runs
    fi

    _wanted modules expl runners _multi_parts "$@" . _runs
}

_minions(){
    local type requested_type include_all key expl; typeset -A _peons

    # when completing the minion argument for salt and salt-cp, set the argument section
    # of the context to `minion' not `argument-1'
    if [[ $service = salt(|-cp) ]]; then
       curcontext=${curcontext%:*}:minions
    fi

    # only pass the argument accepted, unaccepted, rejected, denied or all to -t/-T
    # the argument is used as part of an tag, accepted-minions, rejected-minions, etc.
    # while un, acc, den, etc will work, you will possibly ignore user customized tags.
    zparseopts -D -E 't+:=requested_type' 'T+:=include_all'

    if ! zstyle -m ":completion:$curcontext:" cache-policy '*'; then
        zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
    fi

    if _cache_invalid salt/minions || ! _retrieve_cache salt/minions; then
        # it would be awesome if salt-key could prefix or suffix a word to denote
        # the key's state. It would remove the need for this loop, calling salt-key N times.
        for type in accepted unaccepted rejected denied; do
            salt-key -l $type 2>/dev/null | while read -r key; do
              [[ $key == *' Keys:' ]] && continue
              _peons+=( "$key" $type )
            done
        done
        _store_cache salt/minions _peons
    fi

    # if salt-key's --include-all option isn't on the line, ignore the -T options
    (( words[(I)--include-all] )) || unset include_all

    if (( requested_type[(I)all] )); then
        requested_type=( -t accepted -t unaccepted -t rejected -t denied )
        unset include_all
    fi

    for type in ${${requested_type:#-t}:-accepted} ${include_all:#-T}; do
        _wanted $type-minions expl minion compadd "$@" -M 'r:|.=* r:|=*' ${(k)_peons[(R)$~type]}
    done
}

(( $+functions[_salt_caching_policy] )) ||
_salt_caching_policy() {
    local oldp ttl d t
    zstyle -a ":completion:$curcontext:" cache-ttl ttl

    if (( $#ttl >= 2 )); then
      [[ $ttl[1] == <-> ]] && integer t=$ttl[1]

      case $ttl[2] in
        seconds#)d=s;;
        months#) d=M;;
        weeks#)  d=w;;
        hours#)  d=h;;
        *)       d=d;;
      esac
    fi

    oldp=( "$1"(Nm${d:-d}+${t:-1}) )
    (( $#oldp ))
}

local -a _{target,master,logging,minion}_options _{common,out}_opts _target_opt_pat
_target_opt_pat=(
    '(-[ELGNRCIS]|--(pcre|list|grain(|-pcre)|nodegroup|range|compound|pillar|ipcidr))'
    '(-E --pcre -L --list -G --grain --grain-pcre -N --nodegroup -R --range -C --compound -I --pillar -S --ipcidr)'
)

_target_options=(
    "$_target_opt_pat[2]"{-E,--pcre}'[use pcre regular expressions]:pcre:'
    "$_target_opt_pat[2]"{-L,--list}'[take a comma or space delimited list of servers.]:list:'
    "$_target_opt_pat[2]"{-G,--grain}'[use a grain value to identify targets]:Grains:'
    "$_target_opt_pat[2]--grain-pcre[use a grain value to identify targets.]:pcre:"
    "$_target_opt_pat[2]"{-N,--nodegroup}'[use one of the predefined nodegroups to identify a list of targets.]:Nodegroup:'
    "$_target_opt_pat[2]"{-R,--range}'[use a range expression to identify targets.]:Range:'
    "$_target_opt_pat[2]"{-C,--compound}'[Use multiple targeting options.]:Compound:'
    "$_target_opt_pat[2]"{-I,--pillar}'[use a pillar value to identify targets.]:Pillar:'
    "$_target_opt_pat[2]"{-S,--ipcidr}'[Match based on Subnet (CIDR notation) or IPv4 address.]:Cidr:'
)

_common_opts=(
    "--version[show program's version number and exit]"
    "--versions-report[show program's dependencies version number and exit]"
    '(-h --help)'{-h,--help}'[show this help message and exit]'
    '(-c --config-dir)'{-c,--config-dir}'[Pass in an alternative configuration directory.(default: /etc/salt/)]:Config Directory:_files -/'
    '(-t --timeout)'{-t,--timeout}'[Change the timeout for the running command; default=5]:Timeout (seconds):'
)

_master_options=(
    '(-s --static)'{-s,--static}'[Return the data from minions as a group after they all return.]'
    "--async[Run the salt command but don't wait for a reply]"
    '(--state-output --state_output)'{--state-output,--state_output}'[Override the configured state_output value for minion output. Default: full]:Outputs:(full terse mixed changes)'
    '--subset[Execute the routine on a random subset of the targeted minions]:Subset:'
    '(-v --verbose)'{-v,--verbose}'[Turn on command verbosity, display jid and active job queries]'
    '--hide-timeout[Hide minions that timeout]'
    '(-b --batch --batch-size)'{-b,--batch,--batch-size}'[Execute the salt job in batch mode, pass number or percentage to batch.]:Batch Size:'
    '(-a --auth --eauth --extrenal-auth)'{-a,--auth,--eauth,--external-auth}'[Specify an external authentication system to use.]:eauth:'
    '(-T --make-token)'{-T,--make-token}'[Generate and save an authentication token for re-use.]'
    '--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir/returners" -g "[^_]*.py(\:r)"'
    '(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
    '--args-separator[Set the special argument used as a delimiter between command arguments of compound commands.]:Arg separator:'
)

_minion_options=(
    '--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir"/returners" -g "[^_]*.py(\:r)"'
    '(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
    '(-g --grains)'{-g,--grains}'[Return the information generated by the salt grains]'
    {*-m,*--module-dirs}'[Specify an additional directory to pull modules from.]:Module Dirs:_files -/'
    '--master[Specify the master to use.]:Master:'
    '--local[Run salt-call locally, as if there was no master running.]'
    '--file-root[Set this directory as the base file root.]:File Root:_files -/'
    '--pillar-root[Set this directory as the base pillar root.]:Pillar Root:_files -/'
    '--retcode-passthrough[Exit with the salt call retcode and not the salt binary retcode]'
    '--id[Specify the minion id to use.]:Minion ID:'
    '--skip-grains[Do not load grains.]'
    '--refresh-grains-cache[Force a refresh of the grains cache]'
)

_runner_options=(
    '--hard-crash[raise any original exception rather than exiting gracefully]'
    '(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
)

_key_options=(
    '(-u --user)'{-u+,--user=}'[specify user to run salt-key]:user:_users'
    '--hard-crash[raise any original exception rather than exiting gracefully]'
    '(-q --quiet)'{-q,--quiet}'[quiet mode]'
    '(-y --yes)'{-y,--yes}'[assume yes]'
    '--rotate-aes-key[prevents the master from refreshing the key session when keys are deleted or rejected]:boolean:(true false)'
    '--gen-keys=[set a name to generate a keypair for use with salt]:key name'
    '--gen-keys-dir=[set the directory to save the generated keypair]: : _directories'
    '--keysize=[set the size for keypair]:key size'
    '--gen-signature[create a signature file of the masters public-key]'
    '--priv=[the private-key file to create a signature with]:private key:_files'
    '--signature-path=[the path where the signature file should be written]: : _directories'
    '--pub=[the public-key file to create a signature for]:public key:_files'
    '--auto-create[auto-create a signing key-pair if it does not yet exist]'
    '--include-all[include non-pending keys when accepting/rejecting]'
    - '(set)'
    {-l+,--list=}'[list public keys]:key type:((
        preaccepted\:"unaccepted/unsigned keys" unaccepted\:"unaccepted/unsigned keys" un\:"unaccepted/unsigned keys"
        accepted\:"accepted/signed keys" acc\:"accepted/signed keys"
        rejected\:"rejected keys" rej\:"rejected keys"
        den\:"denied keys" denied\:"denied keys" all
      ))'
    {-a+,--accept=}'[accept key]:key:_minions -t unaccepted -T rejected'
    {-A,--accept-all}'[accept all keys]'
    {-r+,--reject=}'[reject key]:key:_minions -t rejected -T accepted'
    {-p+,--print=}'[print the specified public key]:key:_minions -t all'
    {-P,--print-all}'[print all public keys]'
    {-d+,--delete=}'[delete the specified public key]:key:_minions -t all'
    {-D,--delete-all}'[delete all public keys]'
    {-f+,--finger=}'[print the specified key'\''s fingerprint]:key:_minions -t all'
    {-F,--finger-all}'[print the fingerprint of all keys]'
)

_logging_options=(
    '(-l --log-level)'{-l,--log-level}'[Console logging log level.(default: warning)]:Log Level:(all garbage trace debug info warning error critical quiet)'
    '--log-file[Log file path. Default: /var/log/salt/master.]:Log File:_files'
    '--log-file-level=[Logfile logging log level.Default: warning]:Log Level:(all garbage trace debug info warning error critical quiet)'
)

_out_opts=(
    '(--out --output)'{--out,--output}'[Print the output using the specified outputter.]:Outputters:_path_files -W "$salt_dir/output" -g "[^_]*.py(\:r)"'
    '(--out-indent --output-indent)'{--out-indent,--output-indent}'[Print the output indented by the provided value in spaces.]:Number:'
    '(--out-file --output-file)'{--out-file,--output-file}'[Write the output to the specified file]:Output File:_files'
    '(--no-color --no-colour)'{--no-color,--no-colour}'[Disable all colored output]'
    '(--force-color --force-colour)'{--force-color,--force-colour}'[Force colored output]'
)

_salt_comp(){
    case "$service" in
        salt)
            _arguments -C \
                "${words[(r)$_target_opt_pat[1]]+!}:minions:_minions" \
                ':modules:_modules' \
                "$_target_options[@]" \
                "$_common_opts[@]" \
                "$_master_options[@]" \
                "$_logging_options[@]" \
                "$_out_opts[@]"
            ;;
        salt-call)
            _arguments -C \
                ':modules:_modules' \
                "$_minion_options[@]" \
                "$_common_opts[@]" \
                "$_logging_options[@]" \
                "$_out_opts[@]"
            ;;
        salt-cp)
            _arguments -C \
                "${words[(r)$_target_opt_pat[1]]+!}:minions:_minions" \
                "$_target_options[@]" \
                "$_common_opts[@]" \
                "$_logging_options[@]" \
                ':Source File:_files' \
                ':Destination File:_files'
            ;;
        salt-run)
            _arguments -C \
                ":runners:_runners" \
                "$_runner_options[@]" \
                "$_common_opts[@]" \
                "$_logging_options[@]"
            ;;
        salt-key)
            _arguments -C \
                "$_key_options[@]" \
                "${_common_opts[@]:#'-t --timeout\)'*}" \
                "${_logging_options[@]:#'(-l --log-level)'*}"
            ;;
    esac
}

() {
    local curcontext=${curcontext%:*}:salt_dir
    if ! zstyle -m ":completion:$curcontext:" cache-policy '*'; then
        zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
    fi

    if _cache_invalid salt/salt_dir || ! _retrieve_cache salt/salt_dir; then
        salt_dir="${$(python2 -c 'import salt; print(salt.__file__);')%__init__*}"
        _store_cache salt/salt_dir salt_dir
    fi
}

_salt_comp "$@"

#compdef salt salt-call salt-cp salt-run salt-key
# The use-cache style is checked in a few places to allow caching minions, modules,
# or the directory salt is installed in.
# you can cache those three with:
# zstyle ':completion:*:salt(|-cp|-call|-run|-key):*' use-cache true
# and/or selectively:
# zstyle ':completion::complete:salt-key:set-option-a-1:'             use-cache false
# zstyle ':completion::complete:salt(|-cp|-call):minions:'            use-cache true
# zstyle ':completion::complete:salt(|-call):modules:'                use-cache true
# zstyle ':completion::complete:salt(|-cp|-call|-run|-key):salt_dir:' use-cache true

local state line curcontext="$curcontext" salt_dir

_modules(){
    local _funcs expl curcontext=${curcontext%:*}:modules

    if ! zstyle -T ":completion:$curcontext:" cache-policy; then
        zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
    fi

    if _cache_invalid salt/modules || ! _retrieve_cache salt/modules; then
        _funcs=( ${(M)${(f)"$(command salt-call --local -d 2>/dev/null)"}##[[:alnum:]._]##} )
        _store_cache salt/modules _funcs
    fi

    _wanted modules expl modules _multi_parts "$@" . _funcs
}

_runners(){
    local _runs expl curcontext=${curcontext%:*}:runners

    if ! zstyle -T ":completion:$curcontext:" cache-policy; then
        zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
    fi

    if _cache_invalid salt/runners || ! _retrieve_cache salt/runners; then
        _runs=( ${(M)${(Q)${(f)"$(command salt-run -d 2>/dev/null)"}}##[[:alnum:]._]##} )
        _store_cache salt/runners _runs
    fi

    _wanted modules expl runners _multi_parts "$@" . _runs
}

_minions(){
    local type requested_type include_all key expl; typeset -A _peons

    # when completing the minion argument for salt and salt-cp, set the argument section
    # of the context to `minion' not `argument-1'
    if [[ $service = salt(|-cp) ]]; then
       curcontext=${curcontext%:*}:minions
    fi

    # only pass the argument accepted, unaccepted, rejected, denied or all to -t/-T
    # the argument is used as part of an tag, accepted-minions, rejected-minions, etc.
    # while un, acc, den, etc will work, you will possibly ignore user customized tags.
    zparseopts -D -E 't+:=requested_type' 'T+:=include_all'

    if ! zstyle -T ":completion:$curcontext:" cache-policy; then
        zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
    fi

    if _cache_invalid salt/minions || ! _retrieve_cache salt/minions; then
        # it would be awesome if salt-key could prefix or suffix a word to denote
        # the key's state. It would remove the need for this loop, calling salt-key N times.
        for type in accepted unaccepted rejected denied; do
            salt-key -l $type 2>/dev/null | while read -r key; do
              [[ $key == *' Keys:' ]] && continue
              _peons+=( "$key" $type )
            done
        done
        _store_cache salt/minions _peons
    fi

    # if salt-key's --include-all option isn't on the line, ignore the -T options
    (( words[(I)--include-all] )) || unset include_all

    if (( requested_type[(I)all] )); then
        requested_type=( -t accepted -t unaccepted -t rejected -t denied )
        unset include_all
    fi

    for type in ${${requested_type:#-t}:-accepted} ${include_all:#-T}; do
        _wanted $type-minions expl minion compadd "$@" -M 'r:|.=* r:|=*' ${(k)_peons[(R)$~type]}
    done
}

(( $+functions[_salt_caching_policy] )) ||
_salt_caching_policy() {
    local -a oldp
    oldp=( "$1"(Nm+7) )
    (( $#oldp ))
}

local -a _{target,master,logging,minion}_options _{common,out}_opts _target_opt_pat
_target_opt_pat=(
    '(-[ELGNRCIS]|--(pcre|list|grain(|-pcre)|nodegroup|range|compound|pillar|ipcidr))'
    '(-E --pcre -L --list -G --grain --grain-pcre -N --nodegroup -R --range -C --compound -I --pillar -S --ipcidr)'
)

_target_options=(
    "$_target_opt_pat[2]"{-E,--pcre}'[use pcre regular expressions]:pcre:'
    "$_target_opt_pat[2]"{-L,--list}'[take a comma or space delimited list of servers.]:list:'
    "$_target_opt_pat[2]"{-G,--grain}'[use a grain value to identify targets]:Grains:'
    "$_target_opt_pat[2]--grain-pcre[use a grain value to identify targets.]:pcre:"
    "$_target_opt_pat[2]"{-N,--nodegroup}'[use one of the predefined nodegroups to identify a list of targets.]:Nodegroup:'
    "$_target_opt_pat[2]"{-R,--range}'[use a range expression to identify targets.]:Range:'
    "$_target_opt_pat[2]"{-C,--compound}'[Use multiple targeting options.]:Compound:'
    "$_target_opt_pat[2]"{-I,--pillar}'[use a pillar value to identify targets.]:Pillar:'
    "$_target_opt_pat[2]"{-S,--ipcidr}'[Match based on Subnet (CIDR notation) or IPv4 address.]:Cidr:'
)

_common_opts=(
    "--version[show program's version number and exit]"
    "--versions-report[show program's dependencies version number and exit]"
    '(-h --help)'{-h,--help}'[show this help message and exit]'
    '(-c --config-dir)'{-c,--config-dir}'[Pass in an alternative configuration directory.(default: /etc/salt/)]:Config Directory:_files -/'
    '(-t --timeout)'{-t,--timeout}'[Change the timeout for the running command; default=5]:Timeout (seconds):'
)

_master_options=(
    '(-s --static)'{-s,--static}'[Return the data from minions as a group after they all return.]'
    "--async[Run the salt command but don't wait for a reply]"
    '(--state-output --state_output)'{--state-output,--state_output}'[Override the configured state_output value for minion output. Default: full]:Outputs:(full terse mixed changes)'
    '--subset[Execute the routine on a random subset of the targeted minions]:Subset:'
    '(-v --verbose)'{-v,--verbose}'[Turn on command verbosity, display jid and active job queries]'
    '--hide-timeout[Hide minions that timeout]'
    '(-b --batch --batch-size)'{-b,--batch,--batch-size}'[Execute the salt job in batch mode, pass number or percentage to batch.]:Batch Size:'
    '(-a --auth --eauth --extrenal-auth)'{-a,--auth,--eauth,--external-auth}'[Specify an external authentication system to use.]:eauth:'
    '(-T --make-token)'{-T,--make-token}'[Generate and save an authentication token for re-use.]'
    '--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir/returners" -g "[^_]*.py(\:r)"'
    '(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
    '--args-separator[Set the special argument used as a delimiter between command arguments of compound commands.]:Arg separator:'
)

_minion_options=(
    '--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir"/returners" -g "[^_]*.py(\:r)"'
    '(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
    '(-g --grains)'{-g,--grains}'[Return the information generated by the salt grains]'
    {*-m,*--module-dirs}'[Specify an additional directory to pull modules from.]:Module Dirs:_files -/'
    '--master[Specify the master to use.]:Master:'
    '--local[Run salt-call locally, as if there was no master running.]'
    '--file-root[Set this directory as the base file root.]:File Root:_files -/'
    '--pillar-root[Set this directory as the base pillar root.]:Pillar Root:_files -/'
    '--retcode-passthrough[Exit with the salt call retcode and not the salt binary retcode]'
    '--id[Specify the minion id to use.]:Minion ID:'
    '--skip-grains[Do not load grains.]'
    '--refresh-grains-cache[Force a refresh of the grains cache]'
)

_runner_options=(
    '--hard-crash[raise any original exception rather than exiting gracefully]'
    '(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
)

_key_options=(
    '(-u --user)'{-u+,--user=}'[specify user to run salt-key]:user:_users'
    '--hard-crash[raise any original exception rather than exiting gracefully]'
    '(-q --quiet)'{-q,--quiet}'[quiet mode]'
    '(-y --yes)'{-y,--yes}'[assume yes]'
    '--rotate-aes-key[prevents the master from refreshing the key session when keys are deleted or rejected]:boolean:(true false)'
    '--gen-keys=[set a name to generate a keypair for use with salt]:key name'
    '--gen-keys-dir=[set the directory to save the generated keypair]: : _directories'
    '--keysize=[set the size for keypair]:key size'
    '--gen-signature[create a signature file of the masters public-key]'
    '--priv=[the private-key file to create a signature with]:private key:_files'
    '--signature-path=[the path where the signature file should be written]: : _directories'
    '--pub=[the public-key file to create a signature for]:public key:_files'
    '--auto-create[auto-create a signing key-pair if it does not yet exist]'
    '--include-all[include non-pending keys when accepting/rejecting]'
    - '(set)'
    {-l+,--list=}'[list public keys]:key type:((
        preaccepted\:"unaccepted/unsigned keys" unaccepted\:"unaccepted/unsigned keys" un\:"unaccepted/unsigned keys"
        accepted\:"accepted/signed keys" acc\:"accepted/signed keys"
        rejected\:"rejected keys" rej\:"rejected keys"
        den\:"denied keys" denied\:"denied keys" all
      ))'
    {-a+,--accept=}'[accept key]:key:_minions -t unaccepted -T rejected'
    {-A,--accept-all}'[accept all keys]'
    {-r+,--reject=}'[reject key]:key:_minions -t rejected -T accepted'
    {-p+,--print=}'[print the specified public key]:key:_minions -t all'
    {-P,--print-all}'[print all public keys]'
    {-d+,--delete=}'[delete the specified public key]:key:_minions -t all'
    {-D,--delete-all}'[delete all public keys]'
    {-f+,--finger=}'[print the specified key'\''s fingerprint]:key:_minions -t all'
    {-F,--finger-all}'[print the fingerprint of all keys]'
)

_logging_options=(
    '(-l --log-level)'{-l,--log-level}'[Console logging log level.(default: warning)]:Log Level:(all garbage trace debug info warning error critical quiet)'
    '--log-file[Log file path. Default: /var/log/salt/master.]:Log File:_files'
    '--log-file-level=[Logfile logging log level.Default: warning]:Log Level:(all garbage trace debug info warning error critical quiet)'
)

_out_opts=(
    '(--out --output)'{--out,--output}'[Print the output using the specified outputter.]:Outputters:_path_files -W "$salt_dir/output" -g "[^_]*.py(\:r)"'
    '(--out-indent --output-indent)'{--out-indent,--output-indent}'[Print the output indented by the provided value in spaces.]:Number:'
    '(--out-file --output-file)'{--out-file,--output-file}'[Write the output to the specified file]:Output File:_files'
    '(--no-color --no-colour)'{--no-color,--no-colour}'[Disable all colored output]'
    '(--force-color --force-colour)'{--force-color,--force-colour}'[Force colored output]'
)

_salt_comp(){
    case "$service" in
        salt)
            _arguments -C \
                "${words[(r)$_target_opt_pat[1]]+!}:minions:_minions" \
                ':modules:_modules' \
                "$_target_options[@]" \
                "$_common_opts[@]" \
                "$_master_options[@]" \
                "$_logging_options[@]" \
                "$_out_opts[@]"
            ;;
        salt-call)
            _arguments -C \
                ':modules:_modules' \
                "$_minion_options[@]" \
                "$_common_opts[@]" \
                "$_logging_options[@]" \
                "$_out_opts[@]"
            ;;
        salt-cp)
            _arguments -C \
                "${words[(r)$_target_opt_pat[1]]+!}:minions:_minions" \
                "$_target_options[@]" \
                "$_common_opts[@]" \
                "$_logging_options[@]" \
                ':Source File:_files' \
                ':Destination File:_files'
            ;;
        salt-run)
            _arguments -C \
                ":runners:_runners" \
                "$_runner_options[@]" \
                "$_common_opts[@]" \
                "$_logging_options[@]"
            ;;
        salt-key)
            _arguments -C \
                "$_key_options[@]" \
                "${_common_opts[@]:#'-t --timeout\)'*}" \
                "${_logging_options[@]:#'(-l --log-level)'*}"
            ;;
    esac
}

() {
    local curcontext=${curcontext%:*}:salt_dir
    if ! zstyle -T ":completion:$curcontext:" cache-policy; then
        zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
    fi

    if _cache_invalid salt/salt_dir || ! _retrieve_cache salt/salt_dir; then
        salt_dir="${$(python2 -c 'import salt; print(salt.__file__);')%__init__*}"
        _store_cache salt/salt_dir salt_dir
    fi
}

_salt_comp "$@"


Travis: test on 4.06.0 release

Travis: test on 4.06.0 release

[skip appveyor]

set -x

# Install system packages.
packages_apt () {
    case $COMPILER in
        4.01) PPA=avsm/ocaml41+opam12;;
        4.02) PPA=avsm/ocaml42+opam12;;
        4.03) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;;
        4.04) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;;
        4.05) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;;
        4.06) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;;
           *) echo Unsupported compiler $COMPILER; exit 1;;
    esac

    sudo add-apt-repository -y ppa:$PPA
    sudo apt-get update -qq

    if [ -z "$DO_SWITCH" ]
    then
        sudo apt-get install -qq ocaml-nox
    fi

    sudo apt-get install -qq opam

    if [ "$LIBEV" != no ]
    then
        sudo apt-get install -qq libev-dev
    fi
}

packages_homebrew () {
    brew update > /dev/null

    if [ "$COMPILER" = system ]
    then
        brew install ocaml
    else
        DO_SWITCH=yes
    fi

    brew install gtk+ opam

    if [ "$LIBEV" != no ]
    then
        brew install libev
    fi
}

packages_macports () {
    eval `wget -q -O - https://aantron.github.io/binaries/macports/x86_64/macports/current/install.sh | bash`
    sudo port install pkgconfig gtk2 | cat

    if [ "$LIBEV" != no ]
    then
        sudo port install libev | cat
    fi

    wget -q -O - https://aantron.github.io/binaries/macports/x86_64/opam/1.2/install.sh | bash
    wget -q -O - https://aantron.github.io/binaries/macports/x86_64/ocaml/$COMPILER/install.sh | bash
    wget -q -O - https://aantron.github.io/binaries/macports/x86_64/camlp4/$COMPILER/install.sh | bash
}

packages_osx () {
    case $PACKAGE_MANAGER in
        macports) packages_macports;;
               *) packages_homebrew;;
    esac
}

packages () {
    case $TRAVIS_OS_NAME in
        linux) packages_apt;;
          osx) packages_osx;;
            *) echo Unsupported system $TRAVIS_OS_NAME; exit 1;;
    esac
}

packages

# Initialize OPAM and switch to the right compiler, if necessary.
case $COMPILER in
    4.01) OCAML_VERSION=4.01.0;;
    4.02) OCAML_VERSION=4.02.3;;
    4.03) OCAML_VERSION=4.03.0;;
    4.04) OCAML_VERSION=4.04.2;;
    4.05) OCAML_VERSION=4.05.0;;
    4.06) OCAML_VERSION=4.06.0;;
    system) OCAML_VERSION=`ocamlc -version`;;
       *) echo Unsupported compiler $COMPILER; exit 1;;
esac

if [ "$FLAMBDA" = yes ]
then
    SWITCH="$OCAML_VERSION+flambda"
else
    SWITCH="$OCAML_VERSION"
fi

if [ -n "$DO_SWITCH" ]
then
    opam init --compiler=$SWITCH -ya
else
    opam init -ya
fi

eval `opam config env`

ACTUAL_COMPILER=`ocamlc -version`
if [ "$ACTUAL_COMPILER" != "$OCAML_VERSION" ]
then
    echo Expected OCaml $OCAML_VERSION, but $ACTUAL_COMPILER is installed
fi

# Pin Lwt, install dependencies, and then install Lwt. Lwt is installed
# separately because we want to keep the build directory for running the tests.
opam pin add -y --no-action lwt .

opam install -y --deps-only lwt

if [ "$HAVE_CAMLP4" != no ]
then
    opam install -y camlp4
fi

if [ "$LIBEV" != no ]
then
    opam install -y conf-libev
fi

opam install --keep-build-dir --verbose lwt

# Pin additional packages and install them. There
# aren't any specific tests for these packages. Installation itself is the only
# test.
install_extra_package () {
    PACKAGE=$1
    opam pin add -y --no-action lwt_$PACKAGE .
    opam install -y --verbose lwt_$PACKAGE
}

install_extra_package ppx
install_extra_package react
install_extra_package ssl
install_extra_package glib

# Build and run the tests.
opam install -y ounit
cd `opam config var lib`/../build/lwt.*
make clean

if [ "$LIBEV" != no ]
then
    LIBEV_FLAG=true
else
    LIBEV_FLAG=false
fi

if [ "$HAVE_CAMLP4" = no ]
then
    CAMLP4_FLAG=false
else
    CAMLP4_FLAG=true
fi

ocaml src/util/configure.ml -use-libev $LIBEV_FLAG -use-camlp4 $CAMLP4_FLAG
make build-all test-all

# Run the packaging tests.
make packaging-test

# Build examples.
jbuilder build doc/examples/unix/logging.exe
_build/default/doc/examples/unix/logging.exe
jbuilder build doc/examples/unix/parallelize.exe
jbuilder build doc/examples/unix/relay.exe
# Skipping the GTK example, as installing GTK is dubious in a headless buildbot.
# opam install -y lablgtk
# jbuilder build doc/examples/gtk/connect.exe

# Some sanity checks.
if [ "$LIBEV" != yes ]
then
    ! opam list -i conf-libev
fi

opam list -i ppx_tools_versioned
! opam list -i batteries

set -x

# Install system packages.
packages_apt () {
    case $COMPILER in
        4.01) PPA=avsm/ocaml41+opam12;;
        4.02) PPA=avsm/ocaml42+opam12;;
        4.03) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;;
        4.04) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;;
        4.05) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;;
        4.06) PPA=avsm/ocaml42+opam12; DO_SWITCH=yes;;
           *) echo Unsupported compiler $COMPILER; exit 1;;
    esac

    sudo add-apt-repository -y ppa:$PPA
    sudo apt-get update -qq

    if [ -z "$DO_SWITCH" ]
    then
        sudo apt-get install -qq ocaml-nox
    fi

    sudo apt-get install -qq opam

    if [ "$LIBEV" != no ]
    then
        sudo apt-get install -qq libev-dev
    fi
}

packages_homebrew () {
    brew update > /dev/null

    if [ "$COMPILER" = system ]
    then
        brew install ocaml
    else
        DO_SWITCH=yes
    fi

    brew install gtk+ opam

    if [ "$LIBEV" != no ]
    then
        brew install libev
    fi
}

packages_macports () {
    eval `wget -q -O - https://aantron.github.io/binaries/macports/x86_64/macports/current/install.sh | bash`
    sudo port install pkgconfig gtk2 | cat

    if [ "$LIBEV" != no ]
    then
        sudo port install libev | cat
    fi

    wget -q -O - https://aantron.github.io/binaries/macports/x86_64/opam/1.2/install.sh | bash
    wget -q -O - https://aantron.github.io/binaries/macports/x86_64/ocaml/$COMPILER/install.sh | bash
    wget -q -O - https://aantron.github.io/binaries/macports/x86_64/camlp4/$COMPILER/install.sh | bash
}

packages_osx () {
    case $PACKAGE_MANAGER in
        macports) packages_macports;;
               *) packages_homebrew;;
    esac
}

packages () {
    case $TRAVIS_OS_NAME in
        linux) packages_apt;;
          osx) packages_osx;;
            *) echo Unsupported system $TRAVIS_OS_NAME; exit 1;;
    esac
}

packages

# Initialize OPAM and switch to the right compiler, if necessary.
case $COMPILER in
    4.01) OCAML_VERSION=4.01.0;;
    4.02) OCAML_VERSION=4.02.3;;
    4.03) OCAML_VERSION=4.03.0;;
    4.04) OCAML_VERSION=4.04.2;;
    4.05) OCAML_VERSION=4.05.0;;
    4.06) OCAML_VERSION=4.06.0+beta2;;
    system) OCAML_VERSION=`ocamlc -version`;;
       *) echo Unsupported compiler $COMPILER; exit 1;;
esac

if [ "$FLAMBDA" = yes ]
then
    SWITCH="$OCAML_VERSION+flambda"
else
    SWITCH="$OCAML_VERSION"
fi

if [ -n "$DO_SWITCH" ]
then
    opam init --compiler=$SWITCH -ya
else
    opam init -ya
fi

eval `opam config env`

ACTUAL_COMPILER=`ocamlc -version`
if [ "$ACTUAL_COMPILER" != "$OCAML_VERSION" ]
then
    echo Expected OCaml $OCAML_VERSION, but $ACTUAL_COMPILER is installed
fi

# Pin Lwt, install dependencies, and then install Lwt. Lwt is installed
# separately because we want to keep the build directory for running the tests.
opam pin add -y --no-action lwt .

opam install -y --deps-only lwt

if [ "$HAVE_CAMLP4" != no ]
then
    opam install -y camlp4
fi

if [ "$LIBEV" != no ]
then
    opam install -y conf-libev
fi

opam install --keep-build-dir --verbose lwt

# Pin additional packages and install them. There
# aren't any specific tests for these packages. Installation itself is the only
# test.
install_extra_package () {
    PACKAGE=$1
    opam pin add -y --no-action lwt_$PACKAGE .
    opam install -y --verbose lwt_$PACKAGE
}

install_extra_package ppx
install_extra_package react
install_extra_package ssl
install_extra_package glib

# Build and run the tests.
opam install -y ounit
cd `opam config var lib`/../build/lwt.*
make clean

if [ "$LIBEV" != no ]
then
    LIBEV_FLAG=true
else
    LIBEV_FLAG=false
fi

if [ "$HAVE_CAMLP4" = no ]
then
    CAMLP4_FLAG=false
else
    CAMLP4_FLAG=true
fi

ocaml src/util/configure.ml -use-libev $LIBEV_FLAG -use-camlp4 $CAMLP4_FLAG
make build-all test-all

# Run the packaging tests.
make packaging-test

# Build examples.
jbuilder build doc/examples/unix/logging.exe
_build/default/doc/examples/unix/logging.exe
jbuilder build doc/examples/unix/parallelize.exe
jbuilder build doc/examples/unix/relay.exe
# Skipping the GTK example, as installing GTK is dubious in a headless buildbot.
# opam install -y lablgtk
# jbuilder build doc/examples/gtk/connect.exe

# Some sanity checks.
if [ "$LIBEV" != yes ]
then
    ! opam list -i conf-libev
fi

opam list -i ppx_tools_versioned
! opam list -i batteries


Close old indexes instead of deleting them.

#!/bin/bash

exec ${ROOT}/with_indexes.sh close $@

error: pathspec 'curator/cmd_close.sh' did not match any file(s) known to git


added cluster initialization script

added cluster initialization script

#!/bin/bash
if [ $# -eq 0 ]
then
	echo "First argument must be number of slave nodes"
fi

TOKEN=$(docker run --rm swarm create)
docker-machine create -d virtualbox --swarm --swarm-master --swarm-discovery token://$TOKEN swarm-m && \
	  for i in {0..$1}; do docker-machine create -d virtualbox --swarm --swarm-discovery token://$TOKEN swarm-$i; done

docker run -d --restart=always  \
	--link=swarm-agent-master:swarm \
	-v /var/lib/boot2docker/ca.pem:/certs/ca.pem \
	-v /var/lib/boot2docker/server.pem:/certs/cert.pem \
	-v /var/lib/boot2docker/server-key.pem:/certs/key.pem \
	-p 53:53/udp \
	--name=dns \
	-e constraint:node==swarm-m
	ahmet/wagl \
	wagl --swarm tcp://swarm:3376 \
	--swarm-cert-path /certs

eval $(docker-machine env --swarm swarm-m)

docker info

error: pathspec 'init_cluster.sh' did not match any file(s) known to git


Adds patched dmenu to installation process

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/toshipiazza/dotfiles.git/'


Add create_archive script.

Add create_archive script.

#!/bin/sh

xcodebuild

rm pdfshrink.zip

cd build/Release
zip -r ../../pdfshrink.zip PDFShrink.app
cd ../..
zip -u pdfshrink.zip ReadMe.rtf LiCENSE

cp pdfshrink.zip ~/Dropbox/Public/

error: pathspec 'create_archive.sh' did not match any file(s) known to git


Added module aliases on envinf1

Added module aliases on envinf1

[[ $HOSTNAME == 'envinf1.eve.ufz.de' ]] &&
	alias ml='module load' &&
	alias mli='module list' &&
	alias mrm='module remove' &&
	alias mul='module unload'

error: pathspec 'custom/module.zsh' did not match any file(s) known to git


Add Javadoc deployment script.

Add Javadoc deployment script.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/kilink/okio.git/'


Add website deploy script.

Add website deploy script.

#!/bin/bash

set -ex

DIR=temp-clone

# Delete any existing temporary website clone
rm -rf $DIR

# Clone the current repo into temp folder
git clone git@github.com:square/otto.git $DIR

# Move working directory into temp folder
cd $DIR

# Checkout and track the gh-pages branch
git checkout -t origin/gh-pages

# Delete everything
rm -rf *

# Copy website files from real repo
cp -R ../website/* .

# Stage all files in git and create a commit
git add .
git add -u
git commit -m "Website at $(date)"

# Push the new files up to GitHub
git push origin gh-pages

# Delete our temp folder
cd ..
rm -rf $DIR

error: pathspec 'deploy_website.sh' did not match any file(s) known to git


Added develop_server

Added develop_server

#!/usr/bin/env bash
##
# This section should match your Makefile
##
PY=${PY:-python3}
PELICAN=${PELICAN:-pelican}
PELICANOPTS=

BASEDIR=$(pwd)
INPUTDIR=$BASEDIR/content
OUTPUTDIR=$BASEDIR/dist
CONFFILE=$BASEDIR/pelicanconf.py

###
# Don't change stuff below here unless you are sure
###

SRV_PID=$BASEDIR/srv.pid
PELICAN_PID=$BASEDIR/pelican.pid

function usage(){
  echo "usage: $0 (stop) (start) (restart) [port]"
  echo "This starts Pelican in debug and reload mode and then launches"
  echo "an HTTP server to help site development. It doesn't read"
  echo "your Pelican settings, so if you edit any paths in your Makefile"
  echo "you will need to edit your settings as well."
  exit 3
}

function alive() {
  kill -0 $1 >/dev/null 2>&1
}

function shut_down(){
  PID=$(cat $SRV_PID)
  if [[ $? -eq 0 ]]; then
    if alive $PID; then
      echo "Stopping HTTP server"
      kill $PID
    else
      echo "Stale PID, deleting"
    fi
    rm $SRV_PID
  else
    echo "HTTP server PIDFile not found"
  fi

  PID=$(cat $PELICAN_PID)
  if [[ $? -eq 0 ]]; then
    if alive $PID; then
      echo "Killing Pelican"
      kill $PID
    else
      echo "Stale PID, deleting"
    fi
    rm $PELICAN_PID
  else
    echo "Pelican PIDFile not found"
  fi
}

function start_up(){
  local port=$1
  echo "Starting up Pelican and HTTP server"
  shift
  $PELICAN --debug --autoreload -r $INPUTDIR -o $OUTPUTDIR -s $CONFFILE $PELICANOPTS &
  pelican_pid=$!
  echo $pelican_pid > $PELICAN_PID
  mkdir -p $OUTPUTDIR && cd $OUTPUTDIR
  $PY -m pelican.server $port &
  srv_pid=$!
  echo $srv_pid > $SRV_PID
  cd $BASEDIR
  sleep 1
  if ! alive $pelican_pid ; then
    echo "Pelican didn't start. Is the Pelican package installed?"
    return 1
  elif ! alive $srv_pid ; then
    echo "The HTTP server didn't start. Is there another service using port" $port "?"
    return 1
  fi
  echo 'Pelican and HTTP server processes now running in background.'
}

###
#  MAIN
###
[[ ($# -eq 0) || ($# -gt 2) ]] && usage
port=''
[[ $# -eq 2 ]] && port=$2

if [[ $1 == "stop" ]]; then
  shut_down
elif [[ $1 == "restart" ]]; then
  shut_down
  start_up $port
elif [[ $1 == "start" ]]; then
  if ! start_up $port; then
    shut_down
  fi
else
  usage
fi

error: pathspec 'develop_server.sh' did not match any file(s) known to git


Add GitLab + Jenkins 2 for testing before Raw Integration

#!/usr/bin/env bash

docker run --name jenkins2 -p 8080:8080 -p 50000:50000 -v ~/docker/jenkins:/etc/jenkins_home jenkinsci/jenkins:2.0-alpha-3

error: pathspec 'cu-platform/jenkins2.sh' did not match any file(s) known to git


add nvm

add nvm

export NVM_DIR="/Users/aberigle/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

error: pathspec 'nvm/path.zsh' did not match any file(s) known to git


Working copy, will try to merge with "manageContainers"

#!/bin/bash
# set -x

PS3='Choose container to start : '

hadoopmgrnode="docker run -dti \
--name hadoopmgrnode \
-p 32768:22 \
-p 7180:7180 \
--privileged=true \
-v /media/sf_dockerRepos:/media/sf_dockerRepos \
local/clouderamgrnode:v1 /usr/sbin/sshd -D"

namenode1="docker run -dti \
--name namenode1 \
-p 32769:22 \
--privileged=true \
-v /media/sf_dockerRepos:/media/sf_dockerRepos \
local/hadoopbase:v3 /usr/sbin/sshd -D"

datanode1="docker run -dti \
--name datanode1 \
-p 32770:22 \
--privileged=true \
-v /media/sf_dockerRepos:/media/sf_dockerRepos \
local/hadoopbase:v3 /usr/sbin/sshd -D"

datanode2="docker run -dti \
--name datanode2 \
-p 32771:22 \
--privileged=true \
-v /media/sf_dockerRepos:/media/sf_dockerRepos \
local/hadoopbase:v3 /usr/sbin/sshd -D"

reponode="docker run -dti \
--name reponode \
-p 2891:80 \
-v /media/sf_dockerRepos:/media/sf_dockerRepos \
centos:6.6 /bin/bash"

# Function to start the containers.
function startContainer () {
	echo -e "\n\n Starting container		:  $1"
	${!1} && echo -e "\nSuccessfully started container	: $opt" || echo -e "\n FAILED to start container	: $opt"
	return 0
	}

declare -a imageList=("hadoopmgrnode" "namenode1" "datanode1" "datanode2" "reponode")

select opt in "${imageList[@]}" "Quit" ;
do
    if [[ $opt != "Quit" ]] ; then
		startContainer $opt
    else
		echo -e "\n You chose to exit! \n"
        break
    fi
done

error: pathspec 'startContainers.sh' did not match any file(s) known to git


Adding King Barcelona Trunc Script

Adding King Barcelona Trunc Script

#!/bin/bash
#
# Copyright © 2012-2013 Sergio Arroutbi Braojos <sarroutbi@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software
# for any purpose with or without fee is hereby granted, provided that
# the above copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
# OR PERFORMANCE OF THIS SOFTWARE.
#
# Remember: This can be done becahse a .pgpass must exist on
# HOME dir, with permission 0600, containing the password
psql --user postgres -h 192.168.0.40 bikesearch -c "DELETE FROM bikes WHERE store LIKE 'Kinb Barcelona';"

error: pathspec 'truncscripts/kingbarcelona_trunc.sh' did not match any file(s) known to git


add ruby installation script

add ruby installation script

#!/bin/bash

# install rbenv and ruby-build
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
touch ~/.irb_history

rbenv install 2.1.5
rbenv global  2.1.5

# install helpful gems
gem install --no-ri --no-rdoc bundler tmuxinator hookup
rbenv rehash

error: pathspec 'ruby_install.sh' did not match any file(s) known to git


First upload

First upload

Change-Id: I36169647c179c3fc81f9779353f449e98590e767

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B-LUC/AdminTools.git/'