Skip to content

Instantly share code, notes, and snippets.

@kitofr
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitofr/691d5ed15fbafdc13df8 to your computer and use it in GitHub Desktop.
Save kitofr/691d5ed15fbafdc13df8 to your computer and use it in GitHub Desktop.
OSX extras
source "https://rubygems.org"
gem 'rake'
GEM
remote: https://rubygems.org/
specs:
rake (10.3.2)
PLATFORMS
ruby
DEPENDENCIES
rake
#!/usr/bin/ruby
# Install 3 Connection Manager
# Install install office
# Install junos
task :default => [:xcode, :osx, :brews, :casks, :npms, :ssh_keys, :zshell, :dotfiles, :powerline, :ir_black, :pip, :git_config, :computer_name]
def curl what
sh "curl -O #{what}"
end
def brew what
sh "brew install #{what}"
end
def cask what
sh "brew cask install #{what}"
end
def in_dir dir
pwd = Dir.pwd
begin
Dir.chdir dir
yield if block_given?
ensure
Dir.chdir pwd
end
end
def soft_link(source, dst)
sh "rm -fr #{dst}"
sh "ln -s #{source} #{dst}"
end
task :xcode do
begin
sh "xcode-select --install"
rescue
puts "Looks like xcode failed... was it already installed?"
ensure
puts "wait until xcode is installed..."
STDIN.gets.strip
end
end
task :osx do
`git clone https://github.com/kitofr/osx.git`
in_dir "osx" do
sh "./.osx"
sh 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
sh "cp .bash_profile ~/"
end
end
task :brews do
sh "brew update"
sh "brew upgrade"
%w[awscli git vcsh mr jq ack openssl tree ucspi-tcp readline rbenv ruby-build
nginx python python3 erlang tsung nmap sqlmap ngrep node mc
rbenv-gem-rehash leiningen wget tmux elixir elixir-build].each do |r|
brew r
end
brew "imagemagick --with-webp"
brew "caskroom/cask/brew-cask"
end
task :casks do
%w[mou teamviewer dropbox spectacle garmin-ant-agent garmin-communicator
royal-tsx parallels onepassword bittorrent-sync firefox caffeine colloquy
gpgtools virtualbox vagrant iterm2 adium vlc
disk-inventory-x hipchat spotify flux ].each do |c|
cask c
end
sh "brew tap caskroom/fonts"
end
def npm what
sh "npm install -g #{what}"
end
task :npms do
%w[neochrome/marky bower].each do |p|
npm p
end
end
task :ssh_keys do
puts "Please sign in to your dropbox folder before you continue"
STDIN.gets.strip
home = Dir.home
Dir.mkdir "#{home}/.ssh" unless Dir.exists? "#{home}/.ssh"
soft_link "#{home}/Dropbox/Private/ssh/github_rsa", "#{home}/.ssh/github_rsa"
sh "chmod 400 ~/.ssh/github_rsa"
soft_link "#{home}/Dropbox/Private/ssh/id_rsa", "#{home}/.ssh/id_rsa"
sh "chmod 400 ~/.ssh/id_rsa"
end
task :dotfiles do
`git clone https://github.com/kitofr/dotfiles.git` unless Dir.exists? "#{Dir.home}/dotfiles"
in_dir "dotfiles" do
sh "sudo gem install bundler"
sh "bundle"
sh "bundle exec rake"
end
end
task :powerline do
`git clone https://github.com/Lokaltog/powerline-fonts.git`
in_dir "powerline-fonts" do
sh "find . -name '*.[o,t]tf' -type f -print0 | xargs -0 -I % cp % $HOME/Library/Fonts/"
end
end
task :pip do
sh "pip install pygments"
end
task :zshell do
sh "curl -L http://install.ohmyz.sh | sh"
end
task :ir_black do
sh "wget http://blog.toddwerth.com/entry_files/13/IR_Black.terminal.zip"
end
def git_config setting, what
sh "git config --global #{setting} #{what}"
end
task :git_config do
git_config "core.editor", "/usr/bin/vim"
git_config "push.default", "simple"
git_config "user.name", "'Kristoffer Roupé'"
git_config "user.email", "'kitofr@gmail.com'"
git_config "alias.l", "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
end
task :computer_name do
# Set computer name (as done via System Preferences → Sharing)
sh 'sudo scutil --set ComputerName "marvin"'
sh 'sudo scutil --set HostName "marvin"'
sh 'sudo scutil --set LocalHostName "marvin"'
sh 'sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "MARVIN"'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment