Skip to content

Instantly share code, notes, and snippets.

@baseboxorg
Last active April 19, 2020 11:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save baseboxorg/11ce3b670f4de53b2160 to your computer and use it in GitHub Desktop.
Save baseboxorg/11ce3b670f4de53b2160 to your computer and use it in GitHub Desktop.
vim: ft= hls et ai sr sts=4 sw=4 fdm=marker nowrap
0-1 [Installation] Create USB Installer {{{
Download Mavericks 10.9.1 from App Store, you'll get "/Applications/Install OS X Mavericks.app/"
The file size of the tarball "Install OS X Mavericks.app.tar" is 5,312,274,432 bytes
Create USB Installer METHOD #1
$ cd /Applications/Install\ OS\ X\ Mavericks.app/
$ sudo ./Contents/Resources/createinstallmedia \
--volume /Volumes/USB_DRIVE_NAME \
--applicationpath /Applications/Install\ OS\ X\ Mavericks.app
Create USB Installer METHOD #2 (No Recovery Partition will be made)
$ cd '/Applications/Install OS X Mavericks.app/'
$ open ./Contents/SharedSupport/InstallESD.dmg
Use Disk Utility to perform "Restore" operation
Destination: [Drag the newly created partition in]
Source: [Type in "/Volumes/OS X Install ESD/BaseSystem.dmg"]
$ cd '/Volumes/OS X Base System/System/Installation/'
$ rm Packages
$ cp -R '/Volumes/OS X Install ESD/Packages' Packages
}}}
0-2 [Installation] Disk Partition Layout {{{
Some possibilities:
(120G (R OSX))
(120G (70G Work) (R Personal))
(120G (16G LINUX) (48G WINDOWS) (R OSX))
(120G (16G SHARED) (16G LINUX) (48G WINDOWS) (R OSX))
}}}
1-1 Terminal {{{
Open Terminal
Option as meta key
Capslock as ctrl key
Speed up the repeat rate
Install cmdline developer tool
$ xcode-select --install
Get some dotfiles
$ git clone https://github.com/concise/dotfiles.git ~/.dotfiles
$ ~/.dotfiles/install
Get some vim settings
$ git clone https://github.com/concise/.vim.git ~/.vim
$ ~/.vim/bootstrap
}}}
1-2 Download stuff about the GUI {{{
Dropbox, Chrome, Firefox, Skype, SourceCodePro
$ curl -Lo Dropbox.dmg 'https://www.dropbox.com/download?plat=mac&full=1'
$ curl -Lo googlechrome.dmg 'https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg'
$ curl -Lo Firefox.dmg 'https://download.mozilla.org/?product=firefox-27.0.1-SSL&os=osx&lang=en-US'
$ curl -Lo Skype.dmg 'http://www.skype.com/go/getskype-macosx'
$ curl -Lo SourceCodePro.zip 'http://nchc.dl.sourceforge.net/project/sourcecodepro.adobe/SourceCodePro_FontsOnly-1.017.zip'
}}}
1-3 Symlink dotfiles in my Dropbox folder {{{
$ ln -s ~/Dropbox/dotfiles/.vimrc- ~/
$ ln -s ~/Dropbox/dotfiles/.local.bash ~/
$ mkdir -p ~/.ssh && \
ln -s ~/Dropbox/dotfiles/.ssh-macbook-air/{config,known_hosts} ~/.ssh/
}}}
1-4 How I use multiple user profiles in Google Chrome {{{
Each time I create a new profile, deal with the annoyances:
1) Skip login
2) No autofill
3) No save password
4) No translation
If I really want a conservative user profile for "First user", I create a master preferences file
$ sudo mkdir -p /Library/Google
$ sudo cp ~/.dotfiles/misc/google-chrome-master-preferences '/Library/Google/Google Chrome Master Preferences'
}}}
1-5 Install cmdline utils {{{
Install Homebrew
$ sudo mkdir /usr/local && sudo chown `id -nu`:admin /usr/local
$ curl -Lo /tmp/homebrew https://raw.github.com/Homebrew/homebrew/go/install
$ chmod +x /tmp/homebrew
$ /tmp/homebrew
Commonly used utilities
$ brew install python ruby
$ brew install --override-system-vi vim
$ brew install tmux reattach-to-user-namespace
$ brew install htop-osx ctags mercurial p7zip unrar w3m lynx
Optional
$ brew install zeromq redis mongodb
$ pip install ipython virtualenv virtualenvwrapper
$ brew install bash coreutils git
$ brew tap homebrew/versions && brew install bash-completion2
$ brew install youtube-dl id3v2 ffmpeg gpg
}}}
1-6 GUI development tool {{{
Name Size Filename
---------- ------ ----------------------------------
Xcode 2.1G xcode_5.0.2.dmg
XQuartz 65M XQuartz-2.7.5.dmg
JDK 180M jdk-7u51-macosx-x64.dmg
VirtualBox 114M VirtualBox-4.3.6-91406-OSX.dmg
Vagrant 33M Vagrant-1.4.3.dmg
Genymotion 38M genymotion-2.1.1.dmg
ADT Bundle 449M adt-bundle-mac-x86_64-20131030.zip
}}}
2-1 NOTE 可安裝的工具列表 {{{
日常工具箱
*x Dropbox 雲端檔案系統 https://www.dropbox.com/ 下載網址加上 &full=1 可以下載到完整的 dmg
x Chrome 瀏覽器 https://www.google.com/intl/en/chrome/browser/ | https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg
o Firefox 瀏覽器 https://www.mozilla.org/en-US/firefox/
o Quicksilver 鍵盤快捷鍵開啟程式、檔案 http://qsapp.com/download.php
x Skype 即時通訊 http://www.skype.com/en/download-skype/skype-for-computer/
o Source Code Pro https://sourceforge.net/projects/sourcecodepro.adobe/files/
開發工具箱
*x Xcode 5.0.2 程式編譯器 https://developer.apple.com/downloads/
*o XQuartz 2.7.5 open -a X11 | https://xquartz.macosforge.org/
*x JDK (and JRE) 7u51 java -version | http://www.oracle.com/technetwork/java/javase/downloads/index.html
*o VirtualBox 4.3.6 建立 VM https://www.virtualbox.org/wiki/Downloads
*o Vagrant 管理 General VM https://www.vagrantup.com/downloads.html
x Genymotion 2.0.3 管理 Android VM http://www.genymotion.com/
x ADT Bundle 20131030 開發 Android (需 Java SE 6 Runtime) http://developer.android.com/sdk/index.html # http://developer.android.com/sdk/installing/bundle.html
其他小工具每當需要時再安裝即可
o VLC 播放各種格式的影音 http://www.videolan.org/vlc/index.html
x Transmission 下載大檔案用 http://www.transmissionbt.com/
*o KR4MB (and PCKBH) 客製化鍵盤 layout (+為了使用 HHKB ProJP 可以安裝 PCKBH)
*o Spectacle (or Slate) 快速改變視窗大小與位置
*x BetterTouchTool 客製化觸控板手勢 http://www.boastr.net/
*x Google Hangouts 即時通訊 http://www.google.com/tools/dlpage/hangoutplugin?hl=en
*x Flash Player 為了在非 Google Chrome 的瀏覽器執行 Flash
*x Network Connect 為了使用臺大的 VPU
符號 * 表示要 administrator 權限
符號 o 表示是 open 的
符號 x 表示是 non-open 的 AppKed http://appdl.net/
}}}
2-1 NOTE 設定 Android 開發環境 {{{
安裝 ADT Bundle
打開 ADT Bundle 內的 Eclipse.app 安裝 Java SE 6
打開 SDK Manager 安裝一些工具
預設應該已經有
最新版 (22.3) 的 Android SDK Tools
最新版 (19) 的 Android SDK Platform-tools (TODO: 可更新到 rev. 19.0.1)
最新版 (19) 的 Android SDK Build-tools (TODO: 可安裝 19.0.1)
最新版 (19) 的 SDK Platform (TODO: 可更新到 rev. 2)
最新版 (19) 的 ARM EABI v7a System Image (TODO: 可更新到 rev. 2)
可額外安裝舊版本的...
Android SDK Build-tools (API 17, 18)
SDK Platform (API 17, 18)
ARM EABI v7a System Image (API 17, 18)
Ubuntu 12.04.4 需要有 JRE 才能執行 "eclipse"
Ubuntu 12.04.4 需要有 32-bit library 才能執行 "adb" 等工具
$ sudo apt-get install openjdk-7-jdk libncurses5:i386 libstdc++6:i386
安裝 Genymotion (需要先開著 VirtualBox)
設定 screen size (Nexus S 的是 480x800)
不要勾 Show Android navigation bar
關於 Google Play http://stackoverflow.com/questions/17831990/how-do-you-install-google-frameworks-play-accounts-etc-on-a-genymotion-virtu/20013322#20013322
}}}
2-1 NOTE {{{
清 DNS 快取
$ sudo killall -HUP mDNSResponder
讓螢幕有 HiDPI 模式
$ sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES
啟用 FileVault 時不要自動登入
$ sudo defaults write /Library/Preferences/com.apple.loginwindow DisableFDEAutoLogin -bool YES
看機器型號
$ sysctl hw.model
hw.model: MacBookAir4,1
MacBook Air 2011-mid 硬碟
121,332,826,112 Bytes
共 236,978,176 個 block (每一個 512 Bytes)
清除額外的 file attributes
$ xattr -c ~/Downloads/*
讓某個檔案隱藏或顯示於 Finder 中
$ chflags hidden ~/Downloads/*
$ chflags nohidden ~/Downloads/*
使用 Xcode.app 中的 Instruments.app 限制 CPU 數
$ open /Applications/Xcode.app/Contents/Applications/Instruments.app
設定 nvram 在開關機的時候使用 verbose mode, 可用 cmd-opt-p-r 重置
$ sudo nvram boot-args="-v"
換電腦名
$ sudo scutil --set HostName jsHackBookAir
使用 "setresx" 切換解析度
$ cd ~/Dropbox/repos/setresx
$ g++ setresx.mm -o setresx -framework Foundation -framework ApplicationServices
$ ./setresx -w 800 -h 600
$ ./setresx -w 1024 -h 768
$ ./setresx -w 1280 -h 720
$ ./setresx -w 1920 -h 1080
看有哪些在 /usr/local/bin 內的 executables 在 $PATH 內出現多次
$ (cd /usr/local/bin && for exec in *; do test `which -a "$exec" | wc -l` != 1 && echo $exec; done)
如果在非英文的 OS X 內安裝 Quicksilver 的話可以用下列指令讓他用英文
$ defaults write com.blacktree.Quicksilver AppleLanguages -array English
如何移除 Google Chrome 資料?
$ rm -fR ~/Library/Application\ Support/Google; \
rm -fR ~/Library/Caches/Google; \
rm -fR ~/Library/Caches/com.google.*; \
rm -fR ~/Library/Google; \
rm -fR ~/Library/LaunchAgents/com.google.*; \
rm -fR ~/Library/Logs/GoogleSoftwareUpdateAgent.log; \
rm -fR ~/Library/Preferences/com.google.*; \
rm -fR ~/Library/Saved\ Application\ State/com.google.*; \
rm -fR /Applications/Google\ Chrome.app; \
註: /private/var/folders 內的 com.google.* 資料會於重新開機後消失
註: root 的 /private/var/db/BootCaches/7F48CB63-C935-49CA-AB57-410E31819DCF/app.com.google.Chrome.playlist 檔案不知道為何物...
使用 Redis
啓動伺服器的方法:
$ redis-server $HOMEBREW_PREFIX/etc/redis.conf
如果希望 daemonize 的話:
$ vim $HOMEBREW_PREFIX/etc/redis.conf
加一行 daemonize yes 以後再執行 redis-server
使用 MongoDB
用官網現成的 binaries 安裝步驟:
到 http://www.mongodb.org/downloads 可以下載 binaries
建立資料庫存放檔案的目錄
$ sudo mkdir -p /data/db
$ sudo chown -R `id -nu` /data
啟動伺服器的方法:
$ mongod
如果希望 daemonize 的話:
$ mongod --fork --logpath /var/tmp/mongodb.log
Official Ubuntu 12.04 amd64 Vagrant Box (provider: VirtualBox 4.1.12)
http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box
Should I use Vagrant or Docker.io for creating an isolated envinronment?
http://stackoverflow.com/questions/16647069/should-i-use-vagrant-or-docker-io-for-creating-an-isolated-envinronment
}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment