From 2a32adaa40bf6ebff4013784be020a419681bc9c Mon Sep 17 00:00:00 2001 From: Marcel Bischoff Date: Sat, 24 Oct 2015 20:12:16 +0200 Subject: [PATCH] Add setup file stubs --- .editorconfig | 11 ++++ aliases | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++ brew.sh | 50 +++++++++++++++++ functions | 30 ++++++++++ setup.sh | 22 ++++++++ 5 files changed, 264 insertions(+) create mode 100644 .editorconfig create mode 100644 aliases create mode 100755 brew.sh create mode 100644 functions create mode 100755 setup.sh diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..576e983 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true + +[*.md] +indent_size = 4 diff --git a/aliases b/aliases new file mode 100644 index 0000000..d82b2a4 --- /dev/null +++ b/aliases @@ -0,0 +1,151 @@ +############################################################################### +# Finder # +############################################################################### + +# Layout {{{ + +# Hide All Desktop Icons +alias hideicons="defaults write com.apple.finder CreateDesktop -bool false && killall Finder" + +# Show All Desktop Icons +alias showicons="defaults write com.apple.finder CreateDesktop -bool true && killall Finder" + +# }}} +# Metadata Files {{{ + +# Recursively Delete .DS_Store Files +alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" + +# }}} +# Opening Things {{{ + +# Change Working Directory to Finder Path +# If multiple windows are open, it chooses the top-most one. +alias cdf=`cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')"` + +# }}} + +############################################################################### +# Fonts # +############################################################################### + +# {{{ + +# Clear Font Cache for Current User +# To clear font caches for all users, put sudo in front of this command. +alias clearfontcache="atsutil databases -removeUser && atsutil server -shutdown && atsutil server -ping" + +# }}} + +############################################################################### +# Hardware # +############################################################################### + +# Hardware Information {{{ + +# Remaining Battery Percentage +alias battp=`pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f1 -d';'` + +# Remaining Battery Time +alias battt=`pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f3 -d';'` + +# Show Connected Device's UDID +alias udid="system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p'" + +# }}} +# Power Management {{{ + +# Prevent System Sleep +# Give time in seconds as parameter, like `nosleep 3600`. +alias nosleep="caffeinate -u -t" + +# }}} + +############################################################################### +# Media # +############################################################################### + +# Audio {{{ + +# Mute Audio Output +alias mute="osascript -e 'set volume output muted true'" + +# Set Audio Volume +alias unmute="osascript -e 'set volume 4'" + +# }}} + +############################################################################### +# Networking # +############################################################################### + +# TCP/IP {{{ + +# Show External IP Address +alias extip="dig +short myip.opendns.com @resolver1.opendns.com" + +# Show local IP Address +# Defaults to Wi-Fi connection, change accordingly if needed. +alias ip="ipconfig getifaddr en0" + +# }}} +# Wi-Fi {{{ + +# Airport Utility +alias airport="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport" + +# Show Current SSID +alias ssid="airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'" + +# Show Wi-Fi Connection History +alias wifilast="defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences | grep LastConnected -A 7" + +# Show Wi-Fi Password of Current Connection +alias wifipass=`security find-generic-password -D "AirPort network password" -a "$(airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}')" -gw` + +# Show Wi-Fi Connection History +alias wifihist="defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences | grep LastConnected -A 7" + +# }}} + +############################################################################### +# Security # +############################################################################### + +# Passwords {{{ + +# Generate Secure Password and Copy to Clipboard +# Needs `pwgen` via Homebrew, etc. +alias pw="pwgen -Cs 20 1 | tr -d ' ' | tr -d '\n' | pbcopy" + +# }}} +# Physical Access {{{ + +# Lock Screen +alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" + +# }}} + +############################################################################### +# System # +############################################################################### + +# Software Update {{{ + +# Install All Available Software Updates +alias update="sudo softwareupdate -ia" + +# }}} + +############################################################################### +# Terminal # +############################################################################### + +# {{{ + +# Ring Terminal Bell +alias bell="tput bel" + +# }}} + +# vim:foldmethod=marker:foldlevel=0:ft=sh diff --git a/brew.sh b/brew.sh new file mode 100755 index 0000000..ae95eba --- /dev/null +++ b/brew.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +############################################################################### +# Install command-line tools using Homebrew # +############################################################################### + +# Make sure we’re using the latest Homebrew +brew update + +# Upgrade any already-installed formulae +brew upgrade + +# Install GNU core utilities (those that come with OS X are outdated) +# Don’t forget to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`. +brew install coreutils +sudo ln -s $(brew --prefix)/bin/gsha256sum $(brew --prefix)/bin/sha256sum + +# Install GNU `sed`, overwriting the built-in `sed` +brew install gnu-sed --with-default-names + +# Install `wget` with IRI support +brew install wget --with-iri + +# Install more recent versions of some OS X tools +brew install vim --override-system-vi +brew install homebrew/dupes/grep +brew install homebrew/dupes/openssh +brew install homebrew/dupes/screen +brew install homebrew/php/php56 --with-gmp + +# Install archivers +brew install p7zip +brew install pigz +brew install pixz +brew install unrar +brew install xz + +# Install other useful binaries +brew install aria2 +brew install dark-mode +brew install git +brew install git-lfs +brew install htop +brew install pv +brew install speedtest_cli +brew install tmux +brew install tree + +# Remove outdated versions from the cellar +brew cleanup diff --git a/functions b/functions new file mode 100644 index 0000000..5eec4f8 --- /dev/null +++ b/functions @@ -0,0 +1,30 @@ +############################################################################### +# Developer # +############################################################################### + +# {{{ + +function mkicns() { + if [[ -z "$@" ]]; then + echo "Input file missing" + else + filename=${1%.*} + mkdir $filename.iconset + sips -z 16 16 $1 --out $filename.iconset/icon_16x16.png + sips -z 32 32 $1 --out $filename.iconset/icon_16x16@2x.png + sips -z 32 32 $1 --out $filename.iconset/icon_32x32.png + sips -z 64 64 $1 --out $filename.iconset/icon_32x32@2x.png + sips -z 128 128 $1 --out $filename.iconset/icon_128x128.png + sips -z 256 256 $1 --out $filename.iconset/icon_128x128@2x.png + sips -z 256 256 $1 --out $filename.iconset/icon_256x256.png + sips -z 512 512 $1 --out $filename.iconset/icon_256x256@2x.png + sips -z 512 512 $1 --out $filename.iconset/icon_512x512.png + cp $1 $filename.iconset/icon_512x512@2x.png + iconutil -c icns $filename.iconset + rm -r $filename.iconset + fi +} + +# }}} + +# vim:foldmethod=marker:foldlevel=0:ft=sh diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..9432a89 --- /dev/null +++ b/setup.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# OS X Setup + +# Ask for the administrator password upfront +sudo -v + +# Keep-alive: update existing `sudo` time stamp until `setup.sh` has finished +while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & + +############################################################################### +# Media # +############################################################################### + +# Audio {{{ + +# Disable Sound Effects on Boot +sudo nvram SystemAudioVolume=" " + +# }}} + +# vim:foldmethod=marker:foldlevel=0