Professional Documents
Culture Documents
Table of Contents
1. Introduction
2.
i. Mac
3.
i.
ii.
iii.
4.
i.
ii.
iii.
iv.
v.
vi. AirPlay
5.
i. U
ii.
iii. XCode
iv. Homebrew
i. Usage
ii. Cask
iii. Create
v. MacPorts
vi. Shell
i. iTerm2
ii. ZSH
iii. tmux
vii. Git
i. Git ignore
ii.
iii. Dotfiles
viii. -Sublime Text
i.
ii. Packages
iii.
iv. SublimeLinter
v.
ix. -Atom
x. Ruby
i. RubyGems
xi. Node.js
i. N and NVM
xii. Python
i. Pip
ii. Virtualenv
iii. Virtualenvwrapper
xiii. Java
xiv. MySql
xv. Latex
2
Mac
6.
i. xhyve
ii. Vagrant
i.
ii.
Mac
Mac
Welcome to s Book!
Mac
MAC OSX MAC Windows
Mac
-China
Introduction
Mac
Mac
Introduction
Mac
AirPlay
XCode
Homebrew
Usage
Cask
Create
MacPorts
Shell
iTerm2
ZSH
tmux
Git
Git ignore
Dotfiles
-Sublime Text
Packages
SublimeLinter
-Atom
Ruby
RubyGems
Node.js
N and NVM
Python
Pip
Virtualenv
Java
MySql
Latex
xhyve
Vagrant
Introduction
Mac
2015 ztd811@gmail.com
Mac
Mac
Mac /web/IT Mac Mac
Mac
Mac OS X Unix
Unix
windows windows cygwin flex/yaccgrepscreensshmake
open source cygwin/gcc/make Mac BSD Unix built in
Vi/Emac
/IT / Mac 1/2
browser/email1/2 Vi
/
5 Mac Mac
Mac Mac 5
Mac
Mac Mac
1 windows USB
Mac 1windows
///
Mac
Mac
Mac Designed by
Apple in California Desgined in USA
Apple/Google/Microsoft/Amazon/eBay/Yahoo
Mac
2007 Mac
Mac
VPSee Top Language [TL] Re: [] Mac
TechCrunch Hacker
Mac
Mac
Mac
-MacMaciCloud
Apple IDiCloud@iCloud.comApple ID
iCloudApple IDiWork
Mac
10
Mac
IP
GmailDropboxFeedlyVPNSSLedge
WIFI- -
IPDNS
11
Mac
1. Wi-FiDNS
Gmail
HomeWork
2. +VPN
3. VPNVPNPPTPL2TP
VPNVPNVPN
VPN
1. WIFIWi-FiThunderbolt Ethernet
WiFi
ADSL
* WIFI
* Terminal
192.168.1.0/164255.0.0.08255.255.0.016
255.255.255.0192.168.1.1
RouteMac
1. WIFIWIFIWIFIWIFI
12
Mac
iCloud-iCloudiCloudiPhoneiPadWIFI
WIFI
iCloud
1. TCP/IPIPTCP/IPIP
2. DNSDNS114.114.114.114114.114.115.115 DNS
WANInternetLAN
1. LANLANLANMac
TCP/IPIPv4IPIP
LANLAN IP
192.168.1.1IP
1. WANMacIPTCP/IP
DHCPDHCPIP
LANWANIPIP
DHCP
OS XGoogleYahoo163126QQ
POPIMAPPOP
POP IMAP
POPIMAPPOP
POP.163.comIMAPIMAP.163.com
13
Mac
1. well@gmail.com
2. ;
3.
4. IMAP993
SSLPOP110SSL
SSL
SMTPSSL
Mac WindowsMacWindows
MacFinder
MacAirDropFinderAirDrop
14
Mac
Windows WindowsMac
1. NetBIOSWindows
--WINS
15
Mac
--WINS
1.
Guest
Guest
16
Mac
-
guest
OKWindowsMacMac
\\IP \\
MacWindows WindowsMac\
\\-
10.211.55.3WindowsIP
17
Mac
OS X
MacWindowsMac
- -
Advanced
24AMPM
18
Mac
Web
+
-
commandcommand
pkg-
capslock
iCloudMac
iPhone
19
Mac
airdropAirDroppingmim
shiftoption9shift
optionK
20
Mac
fnshiftoptionshiftoption
controlcommand
shiftoptionBshift6
21
Mac
shift
optiontab1234
controlshiftcommandC (C)controloption
shiftcommandC (C)
MacLaunchpad-
22
Mac
/System/Library/Fonts/Library/Fonts
Finder
WindowsMac
MacWindows
iWorkMac OfficeWindows
WindowsMac
MacWindows
Mac12Windows
9=
10.5=
12=
14=
15=
iWorkWindowsMacMailOutlook
Outlook
Mail-
PDF
Windows
23
Mac
UnicodeANSI
MacWindows
WindowsANSIMacUnicode
MacWindows
Unicode
Symbol MapHTML
MacWindows 00003.html
Universal MailerMailMail
TXTWindowsMacWindows
WindowsMac OS X ZIP
UTF-8 ZIP PKZIP Unicode Windows ANSI
MacWindows.7zMac
The Unarchiver
Mac7zKeka
Windows7z
24
Mac
25
Mac
MacMacTime Capsule
1Time Machine
2Time Capsule
3FileVault
Mac OS X
WindowsMacMac OS XWindows
MacSafari
Mac App Store
Mac
26
Mac
Mac
Mac
Parallels DesktopOnyXPopClipMoom
MacOS X Mac
FileVault
Mac
FileVaultWIFIFileVault
U
FileVault
OS XFileVault
27
Mac
DMG
FileVault FileVault
Time Machine
Time Machine
Time Machine-
FileVault
1.
2. option
3. Uoption
4. Time Capsule
28
Mac
Time Capsule
Time Capsule
29
Mac
Time
MachineTime Machine
U UU
U
1. U
30
Mac
2.
3. U
U
Finder--256AES
OS XFTPSSHTime capsule
Wi-FiWi-Fi
Web
HTTPS
Finder--
31
Mac
CNNIC
1. -Mission Control-
2. Apple ID Apple ID
Apple ID Apple ID
3. OS X iCloud
4.
5. WIFIVPN
6. Safari
7.
8. MacMacTime Machine
9. OS X
32
Mac
AI
Mac
WindowsOS XFinder
Mac
33
Mac
OS XSafari
OS X
PDFTXTDOCPAGEJPEGTIFFGIFPNGMOVMP4
PDFPDF
PDF
PDF-
Shift Command
OS X PDF
PDFFinderPDF
TXTPDFDOCPAGE
--
OnyXOnyXMac
34
Mac
Safari
OS XSafari Apple
iCloudSafari
MaciPadiPhoneiPhone
MaciPhoneiPad
Safari+shift command
DSafari
iCloudiPadiPhone
commandCcommandVMac
DockDock
Evernote
shift command Y
PopClip
EvernoteMarkdown
PopClip
EvernoteSafari
35
Mac
blockAdblockAdblock Plus
ClickToPluginFlashHTML5FlashCPU
ClickToPluginforChina
Google
CustomReaderSafariSafari
Safari
CSS
Safari CSS.CSSSafariSafari
--Helvetica Neue
Safari
Safari
36
Mac
Safari-
Safari Safari
SafariSafari
Safari
37
Mac
WindowsOffice WordExcelPowerPointOutlookProject
VisioAdobePhotoshopAcrobatMaciWorkPagesNumbers
KeynoteMailOmniPlanOmniGrafflePixelmator
Mac
Parallels DesktopWindows
Office
Parallels DesktopWindowsMacMacWindows
Parallels Desktop
Maccommandtab
Time Sink
FinderDropbox
Windows
Finder
Finder
Finder
Finder
MacSpotlightcontrol +SpotlightMac
Spotlight
38
Mac
SpotlightFinder
Time Machine
-SpotlightSpotlight-
SpotlightSpotlight
Finder
Finder-AutomatorHazel
39
Mac
HazelHazel
Stop Hazel
Hazel
1. ScrivenerPagesNumberKeynoteOmniGraffle
Hazel1
40
Mac
1. DEVONthink
docxlsMacMac
1.
1.
Hazel
Hazel
SpotlightTime Machine
41
Mac
TimeCapsule
MacQQDroplrEvernoteOS X
34shift+command+4
OS X
OS X--10
PNG.png
OnyXOnyX
Mac
42
Mac
PngScreenshot
Hazel
SkitchVoilaSnagit
43
Mac
Skitch
Voila
Snagit
Dock
shiftcommandY
EvernoteDay One
XMindMindNode PRO
ScappleScapple
CurioXMindMindNode PRO
44
Mac
PDFPNGRTFTXTOPML
Evernote
iPhoto
DropboxiPhoto
optioniPhoto
InboardEmber
TogetherDEVONthink Pro
PDFPapersPDF
DEVONthink20Words3
45
Mac
46
Mac
POP3SMTPIMAP
MacGmail163QQ
Mail
QQiMessage
MailOutlook
MailOutlookMailOutlook
OutlookWindowsOutlook for MacOutlook
Windows
WindowsOutlookpstpstGB
Mac
OutlookWindows
OutlookParallels DesktopWindowsOffice
Office
WindowsOutlookMacMail
OutlookpstMacOutlook
MailTime Machine
Mail
Mail-shift+command+M
VIP
-
Mail
47
Mac
VIPMail
VIP VIPVIP
MailVIPVIP
48
Mac
PopClip
RemindersOmniFocus
OmniFocus
49
Mac
50
Mac
option+command+LL
Mail
Mail-
Mac
---
1.
iCloudiPhone
+
delete
iCloudMacGoogle
MacGoogle163
iCloud
200+
iCloudApple IDMaciPhone
51
Mac
MacGoogle163
1. -
2.
CSVMacvCardCSVGoogle163
WebCSVNumberExcelCSV
CSV
1.
14
1.
52
Mac
Mail-
-
1. Safarishift+command+II
command+II
2.
zip
7z
YosemiteMail
Mail DropMail iCloudMail
Mail
MacWindows 00003.html
53
Mac
Universal MailerMailMail
1.
MacApple IDiMessage
PKiPhoneOS X Yosemite
OS X
IDApple ID
QQ
QQ for MacWindowsSwiftly
iPhoneiPhoneQQQQ
MaciPhone
MaciOSInstashare
Command-CMaciOS
Command-CInstashare
Instashare
OS X YosemiteiOSMacAirDrop
iPhone 4s4.0iOSMacbook
QQ
DropboxMaciPhone
DropboxWeb
54
Mac
Mac
Mac
Time Machine
Mac
55
Mac
MaciPhone
GTDMac
MacGTD
App Store
OmniFocusWunderlistClearThingsTodoFantastical
MaciPhone
GTD
56
Mac
MaciPhoneiCloud -
MaciPhoneiCloud
Need to do something
Sometime to do something
57
Mac
Mac+
Dock
iCloudhttps://www.icloud.comWeb
Apple
iCloudPagesNumbersKeynote
OutlookiCloud
WindowsiCloudOutlookiCloud
MaciPhone
58
Mac
OutlookiCloud
iCloudOutlookiCloudiCloud
iCloudMac
MaciPhoneiMessage
PopClip
PopClipNoteReminders
RemindersNote
iCloud
MaciPhoneiCloudMaciPhone
Apple IDiCloud
59
Mac
Yosemite iOS 8
FamilyFamily
Mac
OmniFocus OmniFocus
OmniFocus 2 for Mac
60
Mac
MacTime Machine
iTunesiCloud1Password
Time Machine
Time MachineTime MachineMac OS X
FSEvents()Time Machine
(incremental backup)
Time MachineTime Capsule
Time Machine
61
Mac
Time Machine
Backups.backupdb
Time Machine
1.
5GHzWi-Fi10-13MB/s
GBPapersDEVONthink Pro
DEVONthink ProTime Machine
Time Machine
2. -
Power NapMac
Time Machine
62
Mac
MacMacWindows
Mac
Windows PC
Time MachineTime
Machine
Time Machine Mac
Mac Time Machine
Mac Mac/
Time Machine
Mac Time Machine
iTunes
iCloudiTunesAppiPhoneiPadApp Store
iTunesPodcast-iTunes
iTunes Library.itl
iTunesNAS5GHz
Wi-Fi
iTunes
iPhoneiTunesiPhoneiTunes
iTunesiTunesiPhone
MaciTunesMac
63
Mac
iPhoneiPhone5
iTunesiPhone
iTunesPodcast
iCloud
iCloudiCloudiCloud
MacPagesNumbersKeynoteDay OneUlyssesPixelmator
64
Mac
iCloudiCloudiCloudiCloud
iCloud
OS X 10.10iCloud DriveiCloud
iCloud DriveFinderDropboxFinder
DropboxDropbox
SafariiCloud
MaciOSSafari
65
Mac
SafariSafari-
Safari--
Time CapsuleWIFI
66
Mac
Wi-FiTime CapsuleWIFI
WIFISSIDWIFI
WIFI
iCloudiOSMacMacWIFIiPhone
WIFI
WIFISSID
1Password
SafariChromeSafariFirefoxOpera
1Password
Ftp
1PasswordWindowsMaciOSAndroidiCloudDropbox
67
Mac
1PasswordDropbox1Password
Dropbox
1PasswordDropboxDropboxDropbox1Password
Apple IDGmail
68
Mac
AirPlay
MacSafariMac
iTunesPhoto BoothiMovieGarageBandQuickTime PlayerAirPlay
Photo BoothiPhotoiMovie
GarageBandiLife
AppleiPhotoAperture10.10
PhotosiMovieFinal Cut Pro XGarageBandLogic Pro
iPhoneiMovie
iPhoneGarageBand
Mac
iPhone
iMovie
iMovieGarageBandiTunesQuickTime Player
AppleAirPlayApple TV
iTunes
iTunesAppleiPhoneiTunes
Windowsshift+
iCloudiTunesiPhoneiPhoneApp
iCloudiTunes
MaciPhotoiTunes
AirPlay
69
Mac
1. AirPlayAirPlayApple TV
2. iOSApple TV iTunes Mac
iPhoneiPadApple TVMac iTunes
3. 40ACC
Finderm4am4riPhone
4.
5.
iPhoneiTunesiPhoneiTunes
iTunesiTunesiPhone
QuickTime Player
MacQuickTime PlayerSafariFinder
QuickTime Player .mov.mp4.avi.mp3.aiff.m4a.wav
QuickTime Player .wmv.divx.mpeg.mxfFlip4Mac
MPlayerXVLC
QuickTime Player-
AirPlay
70
Mac
QuickTime
.mov
Apple TVAirPlay
Apple TV
Apple TVWIFIHDMI
Apple TVYoutube
PodcastiCloudApple TVAirPlayAirPlay
MaciPhoneiPadApple TV
iPadiPhoneAirPlay
AirPlayAppleWIFIMaciPod touchiPhoneiPad
AirPlayApple TVAppleAirPlay
AirPlayWIFIAirPlayAirPlay
AirPlay
iTunes-AirPlay
HDMI+ Apple TV
HDMI+ Apple TVApple TVAirPlay
iPhoneiPadiOS AirPlay WIFIiOS
KeynoteKeynotePPT
AirPlay
71
Mac
MacApple TV
MacMacMac
AirPlay
72
Mac
MacMac
OS X Mavericks
Option
AirPlay
73
Mac
option
AirPlayVLCAudio-Audio Device
Mac
AirServer
Apple TVAirPlayAirServerMacAirServer
MacApple TV AirPlay
AirServerComputer NameiPhone AirPlay
AirServerMaciPhoneMacHDMI
AirServeriPadiPhoneAirPlayiPhone
AirPlay
WIFI
AirPlay
74
Mac
WIFIMaciPhoneWIFI
MaciPhone-WIFIMac
AirPlayAirServerMac
Mac
WIFI
AirPlay
75
Mac
76
Mac
Yosemite U
Yosemite App Store 5.17GB
Yosemite U
- Yosemite
8GB U - - Mac OS X
Untitled
- -
sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled -applicationpath /Applications/Install\ OS\ X\ Yosemite.app --nointeraction
return
77
Mac
Done
UDiskmakerx
Yosemite
78
Mac
Uoption
U
79
Mac
> >
>
Dock
Dock
Dock
Finder
Finder >
>
Finder >
Finder HOME
HOME
(shared) (tags)
Spotlight
80
Mac
81
Mac
XCode
App store Xcode
Xcode command line tools
xcode-select --install
ar
as
asa
bison
BuildStrings
c++
c89
c99
cc
clang
clang++
cmpdylib
codesign_allocate
CpMac
cpp
ctags
ctf_insert
DeRez
dsymutil
dwarfdump
dyldinfo
flex
flex++
g++
gatherheaderdoc
gcc
gcov
GetFileInfo
git
git-cvsserver
git-receive-pack
XCode
82
Mac
git-shell
git-upload-archive
git-upload-pack
gm4
gnumake
gperf
hdxml2manxml
headerdoc2html
indent
install_name_tool
ld
lex
libtool
lipo
lldb
lorder
m4
make
MergePef
mig
mkdep
MvMac
nasm
ndisasm
nm
nmedit
otool
pagestuff
projectInfo
ranlib
rebase
redo_prebinding
ResMerger
resolveLinks
Rez
RezDet
RezWack
rpcgen
segedit
SetFile
size
SplitForks
strings
strip
svn
svnadmin
svndumpfilter
svnlook
svnrdump
svnserve
svnsync
svnversion
unifdef
XCode
83
Mac
unifdefall
UnRezWack
unwinddump
what
xml2man
yacc
XCode
84
Mac
Homebrew
OS X Homebrew.
Homebrew ( /usr/local/bin
/usr/local/bin $PATH :
$ brew doctor
Homebrew
85
Mac
Homebrew
brew search * -
brew install * -
brew uninstall * -
brew list
brew update Homebrew
brew home *
brew info *
brew deps *
brew server * webhttp://localhost:4567/
brew -h brew
homebrew
cd /usr/local/
git remote set-url origin http://mirrors.ustc.edu.cn/homebrew.git
brew update
cd ~/tmp
git clone http://mirrors.ustc.edu.cn/homebrew.git
rm -rf /usr/local/.git
rm -rf /usr/local/Library
cp -R homebrew/.git /usr/local/
cp -R homebrew/Library /usr/local/
brew update
homebrew-sciencehomebrew-python
cd /usr/local/Library/Taps/homebrew/homebrew-science
git remote set-url origin git://mirrors.tuna.tsinghua.edu.cn/homebrew-science.git
cd /usr/local/Library/Taps/homebrew/homebrew-python
git remote set-url origin git://mirrors.tuna.tsinghua.edu.cn/homebrew-python.git
brew update
CategoryMirrorUsage
node-canvas ()
1.pkg-config
Usage
86
Mac
2.pixman
4.node-canvas
5.
node-canvas
brew install wget watch tmux cmake openssl imagemagick graphicsmagick gearman geoip readline autoconf multitail source-highlight autoju
vim
brew install ctags macvim --env-std --override-system-vim
#### Cakebrew
Usage
87
Mac
Homebrew Cask
Homebrew Homebrew Cask
OS X Google Chrome Dropbox
Homebrew-cask
Install
Using Homebrew Cask
Run brew cask install <package>
Install all
brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql qlimagesize webpquicklook sus
Manually
Click "download manually"
Move the downloaded .qlgenerator file to /Library/QuickLook
Run qlmanage -r
Plugins
QLColorCode
Cask
88
Mac
QLStephen
Preview plain text files without a file extension. Example: README, CHANGELOG, etc.
Run brew cask install qlstephen or download manually
QLMarkdown
Preview Markdown files
Run brew cask install qlmarkdown or download manually
Cask
89
Mac
QuickLookJSON
Preview JSON files
Run brew cask install quicklook-json or download manually
QLPrettyPatch
Cask
90
Mac
QuickLookCSV
Preview CSV files
Run brew cask install quicklook-csv or download manually
BetterZipQL
Preview archives
Run brew cask install betterzipql or download manually
Cask
91
Mac
qlImageSize
Display image size and resolution
Run brew cask install qlimagesize or download manually
Cask
92
Mac
WebP
Preview WebP images
Run brew cask install webpquicklook or download manually
Suspicious Package
Preview the contents of a standard Apple installer package
Run brew cask install suspicious-package or download manually
Cask
93
Mac
More
These are not included in Install all.
ProvisionQL
Preview iOS / OS X app and provision information
Run brew cask install provisionql or download manually
Other
CertQuickLook - preview various unprotected certificate tokens like X509 certificates, DER or PEM
Cask
94
Mac
Tip
Run this in your terminal to allow text selection in the Quick Look window:
OS X
$ brew cask install alfred
$ brew cask install appcleaner
$ brew cask install cheatsheet
$ brew cask install dropbox
$ brew cask install google-chrome
$ brew cask install onepassword
$ brew cask install sublime-text
$ brew cask install totalfinder
...
brew services
homebrew brew services homebrew
nginx, mysql
95
Mac
SYNOPSIS
# [<sudo>] `brew services` `list`<br>
# [<sudo>] `brew services` `restart` <formula><br>
# [<sudo>] `brew services` `start` <formula> [<plist>]<br>
# [<sudo>] `brew services` `stop` <formula><br>
# [<sudo>] `brew services` `cleanup`<br>
Cask
96
Mac
Brew
homebrew BettyhomebrewFormula
1. Formula
brew create betty
2. githubformula
betty.rb
brew edit betty
rbbrew edit
1. betty
brew install betty
Create
97
Mac
MacPorts
MacPortshttp://www.macports.org
ports treeMacPorts-v
port outdated
EclipsesubclipseJavaHLMacPorts
MacPorts
98
Mac
Shell
shellshell
shell
shellshell
sshLinux/Unixshell
shell script
shellBourne Shell C ShellKorn ShellBourne-again ShellTENEX C Shell cat
/etc/shells shell:
Linux/UnixBash(Bourne-again Shell)zsh
Oh My ZSHzshzsh
Shell
99
Mac
Shell
shellshell ~/.bash_history
!! ctrl-r
Shell
100
Mac
( tab )
tab
gi gi tab
cd tab
Shell
101
Mac
cocoapodsshell
pod_update cocoapod
alias
Shell
102
Mac
(job control)
shellshell
shellshell
(foreground)(background)
ctrl-c bg/fg
1. command + &
Shell
103
Mac
2. ctrl-z
shell find / -print ctrl-z
Shell
104
Mac
fg %1
5. bg %jobnumber
jobs -l
105
Mac
kill -9 %1;jobs -l
shell script
shell scriptshellshellshell
shell
* 0
?
[] [abc]abc
[-] [1-7]17
a,b,c
Oh My Zsh
curl
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
wget
Shell
106
Mac
wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh
oh my zsh robbyrussell
# Support autojump
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh
# setup moco alias name
alias moco_service="moco start -p 12306 -g settings.json"
#setup macvim alias name
alias vim="/Applications/MacVim.app/Contents/MacOS/Vim"
#setup pod update alias name
alias pod_update='pod update --verbose --no-repo-update'
Themes ~/.zshrc
ZSH_THEME="robbyrussell" ZSH_THEME
ZSH_THEME="agnoster"
oh my zsh ~/.oh-my-zsh/themes
robbyrussell
c()d() >
oh my zsh ~/.oh-my-zsh/plugins
Shell
107
Mac
zshgit
git.plugin.zsh
~/.zshrc
git
Shell
108
Mac
mac brew
brew install autojump
linuxautojump
./install.py
~/.zshrc
osx
tab -
cdf - cdFinder
quick-look -
man-preview - Previewman page
trash -
1. zshbashbashzsh
2. cls
Shell
109
Mac
1. tab
2. autojump
3. d
1. ..
shellshell
shell script
Don't repeat your self
shell
Unix/Linux
Shell
110
Mac
1.
2.
shell
Shell
111
Mac
set shell
Shell
112
Mac
echo $variable
PATH
echo $PATH
$
variable=value unset
=
Shell
113
Mac
echo $devname
1.
1. =
' '
1. $! \
2. $()
Shell
114
Mac
$()
1. $variable
1. export
export VARIABLE
2. PATH HOME SHELL
3. unset variable $
Shell
115
Mac
(standard input)(standard
output)(standard error)
Shell
116
Mac
<
<<
stdout 1 > >>
>
>>
stderr 2 2> 2>>
2>
2>>
stdout
ls > dir.txt
Shell
117
Mac
stderr
ls test error.txt
2>>
Shell
118
Mac
stdoutstderr &>
&>
stdin
test <
Shell
119
Mac
Shell
120
Mac
Linux-
Unix Pipes
Linux Shell
(job control)
oh my shell
Shell
Shell
121
Mac
iTerm2
Mac
iTerm2
Finder iTerm Application Launchpad iTerm
iTerm2
122
Mac
Zsh
zsh oh-my-zsh Env.sh aliasesexports
path changes ~/.zshrc
Zsh
Homebrew zsh zsh completions
oh-my-zsh zsh
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
vi .zshrc :
ZSH_THEME=pygmalion
alias zshconfig="vi ~/.zshrc"
alias envconfig="vi ~/Projects/config/env.sh"
plugins=(git colored-man colorize github jira vagrant virtualenv pip python brew osx zsh-syntax-highlighting)
vi ~/Projects/config/env.sh :
#!/bin/zsh
# PATH
export PATH="/usr/local/share/python:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export EDITOR='vi -w'
# export PYTHONPATH=$PYTHONPATH
# export MANPATH="/usr/local/man:$MANPATH"
# Virtual Environment
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Projects
source /usr/local/bin/virtualenvwrapper.sh
# Owner
export USER_NAME="YOUR NAME"
eval "$(rbenv init -)"
# FileSearch
function f() { find . -iname "*$1*" ${@:2} }
function r() { grep "$1" ${@:2} -R . }
#mkdir and cd
function mkcd() { mkdir -p "$@" && cd "$_"; }
# Aliases
alias cppcompile='c++ -std=c++11 -stdlib=libc++'
source
ZSH
123
Mac
ZSH
124
Mac
tmux
tmux
tmux
tmux is a terminal multiplexer
What is a terminal multiplexer? It lets you switch easily between several programs in one terminal, detach them (they keep
running in the background) and reattach them to a different terminal. And do a lot more.
tmux
detachattach
HTTPrailsdjango
ssh
tmux
125
Mac
ssh
tmuxdetachattach
tmux http://t.cn/Rv6DnPb
tmux
tmux linuxMacFreeBSDWindows
linux
linux
Debian
$ sudo apt-get install tmux
Arch Linux
$ pacman -S tmux
Mac
Mac Homebrew Macports
Homebrew
$ brew install tmux
Macports
$ sudo port install tmux
FreeBSD
FreeBSDport
tmux
126
Mac
$ cd /usr/ports/sysutil/tmux
$ make install clean
Windows
Windows cygwin cygwincygwin Select Packages tmux
tmux tmux
$ tmux -V
tmux 1.8
tmux
$ tmux
tmux
exit [Ctrl+d]
tmux Session tmux
tmux
dev
dev
tmux
127
Mac
new-session new
monitor top
detach
tmux exit [Ctrl+d] tmux
rails telnet
$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
HTTP
[Ctrl+b] [d]
tmux
128
Mac
attach
$ tmux a -t <>
dev
$ tmux a -t dev
-t
$ tmux a
tmux dev
HTTP
ssh
tmux
1. [] d
2. edit $ tmux new -s edit
3. edit [] d
4. telnet $ tmux new -s telnet
5. telnet [] d
$ tmux list-sessions
$ tmux ls
tmux
129
Mac
-t
failed to connect to server
tmux
/
tmux Window
tmux tmux
tmux (Window)0
~/Documents
0
-n
tmux
130
Mac
-n -s demo worldcup
[] oh-my-zsh
[] c
c create
previous [] p next [] n
[] 0-9
0-9
[] w
tmux
131
Mac
[] ,
tmux
132
Mac
[] &
Shift
y n
tmux
133
Mac
tmux
tmux panetmux
tmux
a
a
a
b
b
c
b
c
d
d
e
tmux
134
Mac
[] %
[] "
tmux
135
Mac
[] o
[]
tmux
1. even-horizontal
2. even-vertical
3. main-horizontal
4. main-vertical
5. tiled
[]
tmux
136
Mac
tmux
137
Mac
gti
$ git --version
~/.gitconfig .
HTTPS SSH Github
SSH .
Git
138
Mac
Git Ignore
~/.gitignore git
Git ignore
139
Mac
$ chmod +x $HOME/bin/proxy-wrapper
.ssh/config , github.com
ssh
Git
Using GIT through a SOCKS proxy
ssh
140
Mac
Mac dotfiles
dotfilesdotfiles :
dotfiles. (dot) prefix Mac OS X Linux *nixbased
dotfiles
Quick Start
OS X
Xcode
dotfiles
How To Use
dotfiles
OS X
Mackup
Quick Start
Erase and reinstall OS X
Mac OS X
Install Xcode
1. App Store
2. Xcode
3. TerminalXcode Command Line Tools:
xcode- select --install
Install dotfiles
git clone $HOME .dotfiles :
Dotfiles
141
Mac
.dotfiles :
cd ~ /.dotfiles
dotfiles:
script/bootstrap
bootstrap.sh :
1. Homebrew
2. Oh My Zsh
3. dotfiles( .zshrc , .vimrc , .gitconfig , .gitignore , ...)
4. brew packages(binaries, fonts, apps)
5. Mac OS X defaults settings
App Store (Dash, Moom, ...)
Restore backup
Mackup :
mackup restore
Mackup?
How To Use
dotfiles
~/.dotfiles/script/bootstrap *.symlink ln $HOME
:
topic*.symlink.dotfiles
git gitconfig.symlink ~/.gitconfig
gitignore.symlink ~/.gitignore
mackup mackup.cfg.symlink ~/.mackup.cfg
vim vimrc.symlink ~/.vimrc
zsh zshrc.symlink ~/.zshrc
Topical
Dotfiles
142
Mac
"Java"dotfiles
java .zsh shell
.symlink script/bootstrap $HOME .
Components
:
bin/ : bin/ shell
topic/*.zsh : .zsh shell
topic/path.zsh : path.zsh shell $PATH
topic/*.symlink : *.symlink $HOME
symlink script/bootstrap
Holman's dotfiles:
Shell Oh My Zshzsh
topic/aliases.zshtopic/completion.zsh Oh My Zsh[plugins]
(https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins )
zsh/prompt.zshzsh/window.zsh.zsh Oh My Zsh[themes]
(https://github.com/robbyrussell/oh-my-zsh/wiki/Themes )
dotfiles topic/*.symlinktopic/path.zsh
OS X
bin/dot script/bootstrap dotfilesOS X
dot :
1. $HOME/.dotfiles/homebrew/install.sh - Homebrew packages
2. $HOME/.dotfiles/osx/set-defaults.sh - OS X defaults setting
Homebrew packages
homebrew/install.sh Homebrew Homebrew Cask binaryfont app
packages:
binaries=(
git
tree
...
)
fonts=(
font-roboto
...
)
apps=(
Dotfiles
143
Mac
dropbox
google-chrome
...
)
packages:
Binary
grc log
mackup
tree
Font
font-roboto Roboto
App
alfred
dropbox
google-chrome Google
iterm2
mou Markdown
qlcolorcode Quick Look syntax highlighting
qlmarkdown Quick Look Markdown
qlstephen Quick Look
sourcetree Git GUI
sublime-text3
OS X defaults setting
osx/set-defaults.sh Mac OS X
Mathias's dotfiles
:
setting
resize (Cocoa applications) defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
? defaults write com.apple.LaunchServices LSQuarantine -bool false
Dotfiles
144
Mac
145
Mac
dot
Mackup
.zsrc .vimrc dotfile
SublimepluginiTerm2settingOh My ZshpluginSSH
keydotfilesGitHub Mackup
brew install mackup :
mackup backup
mackup restore
ln
~/.mackup.cfg .dofiles/mackup/mackup.cfg.symlink :
Dotfiles
146
Mac
[storage]
engine = dropbox #dropboxgoogle_drive
directory = Mackup #~/Dropbox/Mackup
#
[applications_to_sync]
iterm2
oh-my-zsh
sublime-text-3
ssh
[applications_to_ignore]
#
:
app
iterm2
moom
oh-my-zsh ZSH
sourcetree Git GUI
sublime-text-3
ssh SSH Key
mackup
Dotfiles
147
Mac
Sublime Text
Sublime Text Not IDE
-Sublime Text
148
Mac
{
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"enable_tab_scrolling": false,
"ignored_packages":
[
"RestructuredText",
"Markdown",
"Vintage"
],
"spacegray_sidebar_font_large": true,
"spacegray_sidebar_font_normal": true,
"spacegray_sidebar_font_small": true,
"spacegray_sidebar_font_xlarge": true,
"spacegray_sidebar_tree_large": true,
"spacegray_sidebar_tree_normal": true,
"spacegray_sidebar_tree_small": true,
"spacegray_sidebar_tree_xlarge": true,
"spacegray_sidebar_tree_xsmall": true,
"spacegray_tabs_auto_width": true,
"spacegray_tabs_font_large": true,
"spacegray_tabs_font_normal": true,
"spacegray_tabs_font_small": true,
"spacegray_tabs_font_xlarge": true,
"spacegray_tabs_large": true,
"spacegray_tabs_normal": true,
"spacegray_tabs_small": true,
"spacegray_tabs_xlarge": true,
"theme": "Spacegray.sublime-theme"
}
149
Mac
Packages
Install Package Control
Sublime Package Control
Sublime Text `ctrl + ``
Packages
150
Mac
Alignment:
TrailingSpaces:
GitGutter: Git
SideBarEnhancements : Sublime Text 3
DocBlockr:
Emmet: HTML/CSS
HTML5: HTML5
GoSublime (optional): Golang
Git
Jekyll
BracketHighlighterhtml
SublimeLinter
SideBarFolders
TableEditorMarkdown
ctrl + shift + p Table Editor: Enable for current syntax or Table Editor: Enable for current
view or "Table Editor: Set table syntax ... for current view" tab ~
ConvertToUTF8
MarkDown EditingMarkdownGithub Favored Markdown3
MarkdownPreview CTRL + B HTML [TOC]
OmniMarkupPreviwer MarkdownPreview F5
151
Mac
SublimeLinter Settings
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "none",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"pep8": {
"@disable": false,
"args": [],
"disable": "",
"enable": "",
"excludes": [],
"ignore": "",
"max-line-length": null,
"rcfile": "",
"select": ""
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"paths": {
"linux": [],
"osx": [
"/usr/local/bin/"
],
"windows": []
},
"python_paths": {
"linux": [],
"osx": [
"/usr/local/bin/"
],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"php": "html",
"python django": "python"
},
"warning_color": "DDB700",
"wrap_find": true
}
}
SublimeLinter
152
Mac
Ctrl+Shift+P
Ctrl+P
Ctrl+G
Ctrl+W
Ctrl+Shift+W
Ctrl+Shift+V
Ctrl+D
Ctrl+L
Ctrl+Shift+L
Ctrl+Shift+Enter
Ctrl+X
Ctrl+M
Ctrl+U
Ctrl+J
Ctrl+F
Ctrl+Shift+F
Ctrl+H
Ctrl+R method
Ctrl+N
Ctrl+K+B
Ctrl+Shift+M
Ctrl+F2/
Ctrl+/
Ctrl+Shift+/
Ctrl+Alt+/Focus
Ctrl+Shift+A
F11
Shift+F11
Alt+F3
Alt+.
Alt+Shift+
Alt+N
Shift+
Tab
Ctrl
Ctrl+Shift+
Ctrl+D
Alt+F3
Ctrl+L Shift+
Ctrl+Shift+L
Ctrl+Shift+M
153
Mac
Ctrl+M
Ctrl+Enter
Ctrl+Shift+Enter
Ctrl+Shift+[
Ctrl+Shift+]
Ctrl+K+0
Ctrl+
Ctrl+
shift+
shift+
Shift+
Shift+
Ctrl+Shift+
Ctrl+Shift+
Ctrl+Shift+
Ctrl+Shift+
Ctrl+Alt+
Ctrl+Alt+
Ctrl+J CSS
Ctrl+Shift+D
Tab
Shift+Tab
Ctrl+K+K
Ctrl+Shift+K
Ctrl+/
Ctrl+Shift+/
154
Mac
Ctrl+K+U
Ctrl+K+L
Ctrl+Z
Ctrl+Y
Ctrl+U Gtrl+Z
Ctrl+F2
Ctrl+T
F6
Ctrl+F
Ctrl+shift+F sublime
Ctrl+P 12@
34#
Ctrl+G
Ctrl+R @
Ctrl+ #
Ctrl+Shift+P sublime textpackage
Esc
Ctrl+Tab
Ctrl+PageDown
Ctrl+PageUp
Alt+Shift+1 1
Alt+Shift+2 -2
Alt+Shift+3 -3
Alt+Shift+4 -4
Alt+Shift+5 4
155
Mac
Alt+Shift+8 -2
Alt+Shift+9 -3
Ctrl+K+B /
F11
Shift+F11
156
Mac
Atom
Atom
TextMateEmacsVim
AtomAtom
Atom
Web
Web
Node.jsAPIJavaScript
JavaScriptC ++
OnigurumaTextMate
NaClEsprima
APIAPI
Atom
polyfills
flexbox
UIWeb
-Atom
157
Mac
GitHubAtomGitHub
EmacsVim
https://github.com/atom
Atom
AtomMacWindowsLinux
Atom
Atomhttps://atom.io
1-1
atom.io
Mac
Macatom.ioAtom
https://github.com/atom/atom/releases/latest
atom-mac.zip
Atom
-Atom
158
Mac
Shell APM
Windows
Windowshttps://atom.io
https://github.com/atom/atom/releases/latest
Atom APM PATH
Atom
Windows
.ZIP AtomWindows
https://github.com/atom/atom/releases
Linux
AtomLinuxDebianRPMAtomatom.ioAtom
https://github.com/atom/atom/releases
DebianDebian dpkg -i
$ sudodpkg -iamd64.deb
-Atom
159
Mac
RedHatRPM -i
$-i atom.x86_64.rpm
Atom
MacWindowsLinuxFreeBSDhttps://github.com/atom/atom/tree/master/docs/buildinstructions
Atom
Atom
Atom
-Atom
160
Mac
Atom
Atom CMD-P
CMD-P Mac
CMDP
-Atom
161
Mac
Atom
CMD-
Atom4UI8
-Atom
162
Mac
UIUI
Atom.io??????
-Atom
163
Mac
80
80
mainlined
-Atom
164
Mac
>> CMD-O
AtomShell
Atom
$-h
v0.152.0
[] [...]
Atom
...
-Atom
165
Mac
[]
;
>>Atom>>
... CMD-O
./hopes ./dreams
CMD- \ CTRL-0
-Atom
166
Mac
Atom
https://github.com/atom/tree-view
Atom
Atom
CMD-T CMD-P
CMD-B
CMD-B Git
core.ignoredNames finder.ignoredNames
???
minimatch Node.jsglob
minimatchhttps://github.com/isaacs/minimatch
Git core.excludeVcsIgnoredPaths
-Atom
167
Mac
Atom
ATOM
Atom
Git
70
API???
CMD-
atom.ioatom.io
-Atom
168
Mac
Install
AtomAtom
AtomUI
-Atom
169
Mac
atom.io
-Atom
170
Mac
UIMonokai
APM
APM
APM
AtomAtom>Shell APM
APM
apm install <package_name>
APMemmet@0.1.5 0.1.5
APM APM
$ APM
5
773
5578
Atom.io.coffee.jsmyJavascript.coffee - > myJavascript.js3494
CoffeeScript333618
grep'grep`12249
-Atom
171
Mac
APM
$ APMgrep
grep
0.7.0
//github.com/mizchi/atom-git-grep
'grep`
1224
9
`APMgrep`
Atom
ALT-B ALT-
ALT-F ALT-
CMD- CTRL-E
CMD- CTRL-A
CMD-
-Atom
172
Mac
CMD
CTRL-G
informatively CMD-R
CMD- CMD-Shift-R
-Atom
173
Mac
CTRL-ALT-
ctags CTAGS -R
src /
Mac BREWctags
.ctags home / .ctags
/
CMD-F2
732-7
F2 F2
CTRL-F2
-Atom
174
Mac
Atom
Ctrl-Shift-P
Ctrl-Shift-N
Ctrl-Shift-B
Ctrl-Shift-F
ALT-B ALT-
ALT-F ALT
-Atom
175
Mac
Ctrl-Shift-E CMD
Ctrl-Shift-A CMD
CMD-
CMD-
CMD-A
CMD-L
Ctrl-Shift-W
CTRL-T
CMD-J
CTRL-CMD- CTRL-CMD
CMD--D-
CMD-KCMD-U
-Atom
176
Mac
CMD-KCMD-L
80
editor.preferredLineLength CMD-ALT-Q
Ctrl-Shift-K
CMD-
CMD-FN- Mac
CTRL-K
CMD-
ALT- ALT-H
Alt ALT-D
CMD
CMD--L-
CTRL CTRL-
/
CMD-D
CTRL-CMD-G
-Atom
177
Mac
-Atom
178
Mac
Atom
[]{}XMLHTML
[]{}<>
CTRL-M
CTRL-CMD-M
ALT-CMD-
XML / HTML
/
-Atom
179
Mac
UTF-8
Ctrl-Shift-U
UTF-8UTF-8
Atom
CMD-F
-Atom
180
Mac
CMD-Shift-F
CMD-F CMD-G
CMD-Shift-F
-Atom
181
Mac
glob/
/1 /1 1 // FOLDER2
1
//
habtm has_and_belongs_to_many
HTML HTML
HTMLHTML HTML
<HTML>
<HEAD>
<> </ title>
</ HEAD>
<BODY>
</ body>
</ HTML>
-Atom
182
Mac
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
-
HTML
ALT-S
/ .atom snippets.cson
>
/ .atom / JSON CSON
.source.js'
-Atom
183
Mac
'console.log'
'' ''
'' 'console.log$ {1}; $ 2'
'.source.js':
'console.log':
'prefix': 'log'
'body': 'console.log(${1:"crash"});$2'
Java Java
source.java CSS
JavaScript
console.log("crash");
-Atom
184
Mac
Tab ;
.source.js '
'' 'ieie
$ {1}{
2
}$ {3}{
4
}{
5
}
'.source.js':
'if, else if, else':
'prefix': 'ieie'
'body': """
if (${1:true}) {
$2
} else if (${3:false}) {
$4
} else {
$5
}
"""
.source.js'
''
'' ''
'.source.js':
'Snippet Name':
'prefix': 'hello'
'body': 'Hello World!'
autocompleter CTRL
-Atom
185
Mac
autocompleter
??????
/
ALT-CMD- [ ALT-CMD]
-Atom
186
Mac
CMD-K
CMD-K CMD
-Atom
187
Mac
CMD-W CMD-W
Java
.md
Atom
miscategorizes Ctrl-Shift-L
-Atom
188
Mac
AtomGitGitHub
HEAD
CMD-ALT-Z
HEAD git
HEAD - <> HEAD - <>
-Atom
189
Mac
GitHEAD
CMD-Z
Git
CMD-T CMD-B
CMD-B git
-Atom
190
Mac
Git
octicon
Gitgit
-Atom
191
Mac
Git
Git
git5065
AtomGit
Git
diff
git-DIFF
-Atom
192
Mac
Gitdiff
ALT-G ALT-G /
GitHub
GitHub
GitHub -
ALT-G
GitHub
ALT-G B
GitHub
ALT-G
GitHub
ALT-G
GitHubURL
ALT-G
GitHub
-Atom
193
Mac
GitHub
Atom
AsciiDoc
AsciiDoc
GitHubGit
CMD-
Atom
-Atom
194
Mac
text.plainsource.gfmtext.gitsource.asciidoc
CNTL-M
-Atom
195
Mac
HTMLHTML
IMG []
|||
|------------- |------------- |
|||
B
ALT-S
Atom
-Atom
196
Mac
styles.less
/ .atom
Atom>
/ .atom / styles.less
.cursor {
;
}
atom-text-editor.is-focused .cursor {
border-color: pink;
}
DOM
ALT-CMD-I Chrome
-Atom
197
Mac
CSSCSSlesscss.org
CSSstyles.cssCSS
Atom
[]
' '
'atom-text-editor':
'enter': 'editor:newline'
'atom-text-editor[mini] input':
'enter': 'core:confirm'
/ .atom / keymap.cson
-Atom
198
Mac
Atom>
CMD-
config.cson / .atomCoffeeScriptJSONCSON
excludeVcsIgnoredPaths
''
'fontSize 18
'core':
'excludeVcsIgnoredPaths': true
'editor':
'fontSize': 18
Atom>
disabledPackages
excludeVcsIgnoredPaths .gitignore
ignoredNames Atom
PROJECTHOME
nonWordCharacters
fontSize
fontFamily
Atom
CR
EOL \
preferredLineLength 80
-Atom
199
Mac
showInvisibles
showIndentGuide /
showLineNumbers /
softWrap /
softWrapAtPreferredLineLength / preferredLineLength
tabLength 2
fuzzyFinder
ignoredNames
ensureSingleTrailingNewline
removeTrailingWhitespace /
Python
editor.tabLength
editor.softWrap
editor.softWrapAtPreferredLineLength
editor.preferredLineLength
editor.scrollPastEnd
editor.showInvisibles
editor.showIndentGuide
editor.nonWordCharacters
editor.invisibles
editor.autoIndent
editor.normalizeIndentOnPaste
editor.tabLength
editor.softWrap
editor.softWrapAtPreferredLineLength
editor.preferredLineLength
editor.scrollPastEnd
editor.showInvisibles
editor.showIndentGuide
editor.nonWordCharacters
editor.invisibles
editor.autoIndent
editor.normalizeIndentOnPaste
-Atom
200
Mac
Python
''
'softWrap
tabLength 8
.source.gfm
softWrap
-Atom
201
Mac
.source.ruby
tabLength 2
.source.python
tabLength 4
Atom
Atom
Hacking Atom
AtomAPI
-Atom
202
Mac
AtomWeb
WebJavaScriptCSSCoffeeScriptJavascriptCSS
CoffeeScriptJavaScriptCoffeeScript
MyPackageView = './my-package-view
module.exports =
myPackageView
- >
@myPackageView = MyPackageView myPackageViewState
- >
@myPackageView
- >
myPackageViewState@myPackageView
CoffeeScriptJavaScriptCoffeeScript
CoffeeScriptcoffeescript.org
CSSCSS
lesscss.orgCSS
-Atom
203
Mac
Ruby
OS X comes with Ruby installed (Mavericks even gets version 2.0.0, previously it was only 1.8.7), as we don't want to be
messing with core files we're going to use the brilliant rbenv and ruby-build to manage and install our Ruby versions for our
development environment.
The package we just installed allow us to install different versions of Ruby and specify which version to use on a per project
basis and globally. This is very useful to keep a consistent development environment if you need to work in a particular
Ruby version.
Install bundler. Bundler manages an application's dependencies, kind of like a shopping list of other libraries the application
needs to work.
Skip r-doc generation. If you use Google for finding your Gem documentation like I do you might consider saving a bit of
time when installing gems by skipping the documentation.
Install Rails. With Ruby installed and the minimum dependencies ready to go Rails can be installed as a Ruby Gem.
Ruby
204
Mac
RubyGems
RubyGems, the Ruby package manager, was also installed:
$ which gem
$ gem list
$ gem outdated
RubyGems keeps old versions of gems, so feel free to do come cleaning after updating:
$ gem cleanup
We mainly use Ruby for the CSS pre-processor Compass, which is built on top of Sass:
RubyGems
205
Mac
Node.js
Install Node.js with Homebrew:
$ brew update
$ brew install node
Node modules are installed locally in the node_modules folder of each project by default, but there are at least two that are
worth installing globally. Those are CoffeeScript and Grunt:
Npm usage
To install a package:
To uninstall a package:
Node.js
206
Mac
Node0.60.11Node n nvm
Node
n
n NodeTJ HolowaychukExpress
n node o
$ n
0.10.1
0.10.15
o 0.10.21
0.11.8
0.11.12
$ n 0.11.12
install : 0.11.12
mkdir : /usr/local/n/versions/0.11.12
fetch : http://nodejs.org/dist/v0.11.12/node-v0.11.12-darwin-x64.tar.gz
#### 5.9%
$ n latest
$ n stable
$ n rm 0.10.1
N and NVM
207
Mac
nvm
nvmNode Version Manager n shell
$ curl https://raw.github.com/creationix/nvm/v0.4.0/install.sh | sh
$ nvm ls
.nvm
-> v0.10.24
$ nvm current
v0.10.24
nvm
$ rm -rf ~/.nvm
Node
N and NVM
208
Mac
https://github.com/creationix/nvm
https://github.com/visionmedia/n
N and NVM
209
Mac
Python
OS X, like Linux, ships with Python already installed. But you don't want to mess with the system Python (some system
tools rely on it, etc.), so we'll install our own version with Homebrew. It will also allow us to get the very latest version of
Python 2.7.
The following command will install Python 2.7 and any dependencies required (it can take a few minutes to build
everything):
When finished, you should get a summary in the terminal. Running $ which python should output /usr/local/bin/python .
It also installed Pip (and its dependency Setuptools), which is the package manager for Python. Let's upgrade them both:
Executable scripts from Python packages you install will be put in /usr/local/share/python , we already had this in the
Env.sh file created before. Save the file and open a new terminal to take the new $PATH into account (everytime you open
Python
210
Mac
Pip Usage
Here are a couple Pip commands to get you started. To install a Python package:
To upgrade a package:
$ pip freeze
To uninstall a package:
Pip
211
Mac
Virtualenv
python
python python
virtualenv python
virtualenv
mkdir myproject
cd myproject
virtualenv myproject_ENV
1. myproject
2.
3. myproject_ENV
myproject myproject_ENV
cd myproject_ENV
source ./bin/activate
1. myproject_ENV
2.
which python
which pip
pip list
deactivate
Virtualenv
212
Mac
Virtualenvwrapper
Virtualenvwrapper ///
Virtualenvwrapper ~/.bashrc
source ~/.bashrc
showvirtualenv [env] #
rmvirtualenv [env] # deactivate
cpvirtualenv [source] [dest] #
cdvirtualenv [subdir] #
cdsitepackages [subdir] # sitepackages
add2virtualenv [dir] [dir] # pathproject
toggleglobalsitepackages -q # sitepackages
Virtualenv
213
Mac
Virtualenvwrapper
virtualenvOS X uservirtualenv
virtualenv
or
shell(.bashrc.bash_profile.profile)
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
Reload
$ source ~/.bashrc
1.run
workon
2.run
mkvirtualenv temp
virtualenv temp
3.run
Virtualenvwrapper
214
Mac
workon
temp
4.virtualenvrun
deactivate
5.workonworkon+
$ workon
temp1 temp2
$ workon temp1
(temp1)$
6.run
rmvirtualenv temp
Reference
+Python Virtualenv Pythonbrew
+Installation of virtualenvwrapper
Virtualenvwrapper
215
Mac
Java
Java
MacJava
Mac OS X JavaJava1.6
javaeclipseJava
java -version
Java:
http://support.apple.com/kb/DL1572?viewlocale=zh_CN
Java 1.7
Mac OS X JDKjdk-7u51-macosx-x64.dmg
http://www.oracle.com/technetwork/java/javase/downloads/index.html
JAVA_HOME
JavaJAVA_HOMEMac
Java 1.6JAVA_HOME
/usr/libexec/java_home -v 1.6
Java 1.7JAVA_HOME
/usr/libexec/java_home -v 1.7
JAVA_HOMEJAVAJAVA_HOME
'/System'JDKJava
'~/.zshrc''~/.bash_profile'
Java 1.6
Java
216
Mac
Java 1.7
(Extension Libraries)
Java'$JAVA_HOME/lib/ext'jarMac OS XJava'lib/ext'
jar'/Library/Java/Extensions'jarJNI
'~/Library/Java/Extensions'jarJNI
classpathjava
Eclipse
http://www.eclipse.org/downloads/
eclipse'Applications''/Applications/eclipse/'eclipse
eclipse
'~/.zshrc''~/.bash_profile'
export ECLIPSE_HOME=/Applications/eclipse
homebrew-cask
% brew cask alfred link
% brew cask install eclipse-ide
==> Downloading http://download.eclipse.org/technology/epp/downloads/release/kepler/SR1/e
######################################################################## 100.0%
==> Symlinking App 'Eclipse.app' to '/Users/ppyy/Applications/Eclipse.app'
==> Success! eclipse-ide installed to /opt/homebrew-cask/Caskroom/eclipse-ide/4.3.1
eclipse
eclipseeclipse'$ECLIPSE_HOME/Eclipse.app/Contents/MacOS'
eclipse.iniECLIPSE_HOME'Finder'(Ctrl+)Eclipse
'Show Package Contents'ContentsMacOSeclipse.ini
--launcher.XXMaxPermSize
2048m
...
Java
217
Mac
-vmargs
...
-Xms512m
-Xmx850m
-XX:PermSize=512m
-XX:MaxPermSize=1024m
Java
218
Mac
MySQL
MySQL
MySQL
$ mkdir -p ~/Library/LaunchAgents
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
$ find /usr/local/Cellar/mysql/ -name "homebrew.mxcl.mysql.plist" -exec cp {} ~/Library/LaunchAgents/ \;
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
MySQL
$ unset TMPDIR
$ mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
$ mysql.server start
{start|stop|restart|reload|force-reload|status}
MySql
219
Mac
Latex
MacTex LaTex
1. MacTex
MacTexpkg.
2.
\documentclass[UTF8,nofonts]{ctexart}
\setCJKmainfont{SimSun} % or any font you have.
\setCJKsansfont{SimHei}
\setCJKmonofont{FangSong}
\begin{document}
Some Chinese fonts should be installed in your system (SimSun, SimHei, FangSong, KaiTi)\end{document}
XeLaTex
:
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{gbsn}
(wiq)
\end{CJK}
hello
\end{document}
LaTex
3. LaTex
, \, , ,
, Tex, % ,, TeX, , .
, /begin /end ,
, \documentclass{article} \begin{document} ,
3.1.
Latex
220
Mac
\documentclass[UTF8,nofonts]{ctexart}
\setCJKmainfont{SimSun} % or any font you have.
\setCJKsansfont{SimHei}
\setCJKmonofont{FangSong}
\title{world!} %
\author{Andrew Liu} %
\date{\today} %
\begin{document}
\maketitle %
hello world
,
\end{document}
3.2.
, \begin{document} end{document} .
article/ctexart ,
\section{}
\subsection{}
\subsubsection{}
\paragraph{}
\subparagraph{}
\begin{document}
\maketitle %
\tableofcontents % ,
,
\section{hello world 1}
how are you
\subsection{hello world1.1}
fine! thank you, and you?
\subsubsection{hello world 1.1.1}
\paragraph{hello world}
is the programming method print
\subparagraph{hello world}
is also something.
\subsection{Hello nanjing1.2}
\paragraph{}
\end{document}
3.3.
AMS-LaTeX amsmath: \usepackage{amsmath}
LaTex:
inline( $...$ )
display( \[ ... \] )
% display, equation
\begin{equaion}
\end{equation}
$E=mc^2$
display
Latex
221
Mac
\[ E=mc^2 \]
display
\begin{equation}
E=mc^2.
\end{equation}
\sqrt{} , \frac{}{} ,
\[ \Bigg(\bigg(\Big(\big((x)\big)\Big)\bigg)\Bigg) \]
\[ \Bigg[\bigg[\Big[\big[[x]\big]\Big]\bigg]\Bigg] \]
\[ \Bigg \{\bigg \{\Big \{\big \{\{x\}\big \}\Big \}\bigg \}\Bigg\} \]
\[ \Bigg\langle\bigg\langle\Big\langle\big\langle\langle x
\rangle\big\rangle\Big\rangle\bigg\rangle\Bigg\rangle \]
\[ \Bigg\lvert\bigg\lvert\Big\lvert\big\lvert\lvert x
\rvert\big\rvert\Big\rvert\bigg\rvert\Bigg\rvert \]
\[ \Bigg\lVert\bigg\lVert\Big\lVert\big\lVert\lVert x
\rVert\big\rVert\Big\rVert\bigg\rVert\Bigg\rVert \]
\[ y= \begin{cases}
-x,\quad x\leq 0 \\
x,\quad x>0
\end{cases} \]
3.4.
Latex
222
Mac
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width = .8\textwidth]{a.jpg} %
\end{document}
\begin{tabular}{|l|c|r|}
\hline
& & \\
\hline
Windows & MikTeX & TexMakerX \\
\hline
Unix/Linux & teTeX & Kile \\
\hline
Mac OS & MacTeX & TeXShop \\
\hline
& TeX Live & TeXworks \\
\hline
\end{tabular}
3.5.
1.5
\usepackage{setspace}
\onehalfspacing
\addtolength{\parskip}{.4em} % 0.4em
4.
LATEX 2
LaTeX
How do I typeset unicode characters with TexShop?
MacTex typeset chinese
MathJax basic tutorial and quick reference
Latex
223
Mac
nginxMySQLphpglibc
VMwareVirtualBoxOSWindows
UbuntuMac
224
Mac
FreeBSD/bhyve xhyve
FreeBSD bhyve (The BSD Hypervisor) 1 FreeBSD 10.0
xhyve bhyve Mac OS X Mac Linux VirtualBox, VMware
Fusion
xhyve 230 KB xhyve xhyve Lightweight
Virtualization on OS X Based on bhyve
Macbook (OS X 10.10.3)
OS X Yosemite 10.10.4 + Xcode 6.3.2.
$ mkdir ubuntu
$ cd ubuntu
$ wget http://releases.ubuntu.com/14.04/ubuntu-14.04.2-server-amd64.iso
$ dd if=/dev/zero bs=2k count=1 of=/tmp/ubuntu.iso
$ dd if=ubuntu-14.04.2-server-amd64.iso bs=2k skip=1 >> /tmp/ubuntu.iso
xhyve
225
Mac
10GB ubuntu
xhyve ubuntu_install.sh
$ cd ..
$ vi ubuntu_install.sh
#!/bin/sh
KERNEL="ubuntu/vmlinuz"
INITRD="ubuntu/initrd.gz"
CMDLINE="earlyprintk=serial console=ttyS0 acpi=off"
MEM="-m 1G"
#SMP="-c 2"
NET="-s 2:0,virtio-net"
IMG_CD="-s 3,ahci-cd,ubuntu/ubuntu-14.04.2-server-amd64.iso"
IMG_HDD="-s 4,virtio-blk,ubuntu/ubuntu.img"
PCI_DEV="-s 0:0,hostbridge -s 31,lpc"
LPC_DEV="-l com1,stdio"
build/xhyve $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD -f kexec,$KERNEL,$INITRD,"$CMDLINE"
$ chmod +x ubuntu_install.sh
sudo
$ ./ubuntu_install.sh
virtio_net: Could not create vmnet interface, permission denied or no entitlement?
$ sudo ./ubuntu_install.sh
xhyve
226
Mac
ubuntu
LVM root swap
xhyve
227
Mac
Mac
$ cd xhyve/ubuntu
$ nc 192.168.64.3 9000 | tar x
$ cd ..
$ vi ubuntu_boot.sh
#!/bin/sh
KERNEL="ubuntu/boot/vmlinuz-3.16.0-30-generic"
INITRD="ubuntu/boot/initrd.img-3.16.0-30-generic"
CMDLINE="earlyprintk=serial console=ttyS0 acpi=off root=/dev/vda1 ro"
MEM="-m 1G"
#SMP="-c 2"
NET="-s 2:0,virtio-net"
#IMG_CD="-s 3,ahci-cd,ubuntu/ubuntu-14.04.2-server-amd64.iso"
IMG_HDD="-s 4,virtio-blk,ubuntu/ubuntu.img"
PCI_DEV="-s 0:0,hostbridge -s 31,lpc"
LPC_DEV="-l com1,stdio"
build/xhyve $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD -f kexec,$KERNEL,$INITRD,"$CMDLINE"
$ chmod +x ubuntu_boot.sh
$ sudo ./ubuntu_boot.sh
xhyve
228
Mac
xhyve
229
Mac
Vagrant
VagrantRubyVirtualBox
Vagrant
Vagrant
bug
Vagrant
package
Vagrant
Vagrant
230
Mac
Vgrant
VagrantVirtualBoxVMwareAWS
VirtualBoxVagrantVirtualBox
VirtualBox
VirtualBoxOracle
https://www.virtualbox.org/wiki/Downloads/ VirtualBox
Vagrant
Vagrant gem gem
http://www.vagrantup.com/downloads.html VirtualBox
VirtualBoxVagrant
vagrant
$PATH vagrant
Vagrant
VirtualBoxVagrantVMVagrant
BoxBox
Boxvagrantcloud
Vagrant
Mac
D:\DevelopFolder
box
boxzipVagrantVirtualBox.
box:Ubuntu lucid 64 http://files.vagrantup.com/lucid64.box
CentOSDebian
box
box
box
231
Mac
D:\DevelopFolder
vagrant init
boxbase
Vagrantfile
232
Mac
vagrant up
ssh
vagrant ssh
Linux lucid64 2.6.32-38-server #83-Ubuntu SMP Wed Jan 4 11:26:59 UTC 2012 x86_64 GNU/Linux
Ubuntu 10.04.4 LTS
Welcome to the Ubuntu Server!
* Documentation: http://www.ubuntu.com/server/doc
New release 'precise' available.
Run 'do-release-upgrade' to upgrade to it.
Welcome to your Vagrant-built virtual machine.
Last login: Fri Sep 14 07:31:39 2012 from 10.0.2.2
windowputtyXshell4.
putty
: 127.0.0.1
: 2222
: vagrant
: vagrant
233
Mac
vagrant@lucid64:/vagrant$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/lucid64-root
78G 945M 73G 2% /
none 179M 176K 179M 1% /dev
none 184M 0 184M 0% /dev/shm
none 184M 64K 184M 1% /var/run
none 184M 0 184M 0% /var/lock
none 184M 0 184M 0% /lib/init/rw
none 78G 945M 73G 2% /var/lib/ureadahead/debugfs
/dev/sda1 228M 17M 199M 8% /boot
/vagrant 298G 76G 222G 26% /vagrant
/vagrant D:\DevelopFolder
Vagrantfile
Vagrantfile
SSHVagrantVagrantRubyRubyRuby
1. box
config.vm.box = "base"
Vagrantbox vagrant init Box box
box base VirtualBoxVBoxManageVM
modifyvm VMVirtualBox
VagrantfileVagrantfile
hostonlyIPIP 192.168..
IP 11.11.. IP
1. hostname
234
Mac
hostname Vagrantfile
config.vm.hostname = "go-app"
1.
config.vm.network :forwarded_port, guest: 80, host: 8080
host8080forward80
nginxGohost http://localhost:8080 Vagrant
VM80nginxhostVMVM
VM
Vagrantfile vagrant reload VMVM
235
Mac
Vgrant
VagrantVagrant
Vagrant
Vagrant
vagrant box add box
vagrant init box
vagrant up
vagrant ssh
Vagrant
vagrant box list
box
box
vagrant destroy
$ vagrant destroy
Are you sure you want to destroy the 'default' VM? [y/N] y
[default] Destroying VM and associated drives...
vagrant halt
$ vagrant halt
[default] Attempting graceful shutdown of VM...
vagrant package
236
Mac
$ vagrant package
[default] Attempting graceful shutdown of VM...
[default] Clearing any previously set forwarded ports...
[default] Creating temporary directory for export...
[default] Exporting VM...
[default] Compressing package to: /Users/astaxie/vagrant/package.box
vagrant plugin
vagrant provision
BoxVagrantChefPuppet
ChefPuppetprovisioningprovisioningVagrant
provisioning"The problem of installing software on a booted system"ChefPuppet
Shell
vagrant provision --provision-with chef
vagrant reload
$ vagrant reload
[default] Attempting graceful shutdown of VM...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Setting hostname...
[default] Mounting shared folders...
[default] -- /vagrant
vagrant resume
$vagrant resume
[default] Resuming suspended VM...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
vagrant ssh-config
ssh
$vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
237
Mac
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile "/Users/username/.vagrant.d/insecure_private_key"
IdentitiesOnly yes
LogLevel FATAL
vagrant status
$vagrant status
Current machine states:
default running (virtualbox)
The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.
vagrant suspend
$ vagrant suspend
[default] Saving VM state and suspending execution...
1. webdb
2.
3. API
4.
VagrantVagrntfile
VMDB
Vagrant config.vm.define
Vagrant.configure("2") do |config|
config.vm.define :web do |web|
web.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--name", "web", "--memory", "512"]
end
web.vm.box = "base"
web.vm.hostname = "web"
web.vm.network :private_network, ip: "11.11.1.1"
end
config.vm.define :db do |db|
db.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--name", "db", "--memory", "512"]
end
db.vm.box = "base"
db.vm.hostname = "db"
238
Mac
$ vagrant up
Bringing machine 'web' up with 'virtualbox' provider...
Bringing machine 'db' up with 'virtualbox' provider...
[web] Setting the name of the VM...
[web] Clearing any previously set forwarded ports...
[web] Creating shared folders metadata...
[web] Clearing any previously set network interfaces...
[web] Preparing network interfaces based on configuration...
[web] Forwarding ports...
[web] -- 22 => 2222 (adapter 1)
[web] Running any VM customizations...
[web] Booting VM...
[web] Waiting for VM to boot. This can take a few minutes.
[web] VM booted and ready for use!
[web] Setting hostname...
[web] Configuring and enabling network interfaces...
[web] Mounting shared folders...
[web] -- /vagrant
[db] Setting the name of the VM...
[db] Clearing any previously set forwarded ports...
[db] Fixed port collision for 22 => 2222. Now on port 2200.
[db] Creating shared folders metadata...
[db] Clearing any previously set network interfaces...
[db] Preparing network interfaces based on configuration...
[db] Forwarding ports...
[db] -- 22 => 2200 (adapter 1)
[db] Running any VM customizations...
[db] Booting VM...
[db] Waiting for VM to boot. This can take a few minutes.
[db] VM booted and ready for use!
[db] Setting hostname...
[db] Configuring and enabling network interfaces...
[db] Mounting shared folders...
[db] -- /vagrant
vagrant ssh
ssh
sshwebweb
sshweb( vagrant )
239
Mac
240