# 替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
# 替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
# 替换homebrew-bottles:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # encoding: UTF-8 | |
| require 'spec_helper' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Node.js CheatSheet. | |
| // Download the Node.js source code or a pre-built installer for your platform, and start developing today. | |
| // Download: http://nodejs.org/download/ | |
| // More: http://nodejs.org/api/all.html | |
| // 0. Synopsis. | |
| // http://nodejs.org/api/synopsis.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd ~/Library/Preferences/ | |
| open com.googlecode.iterm2.plist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| """ | |
| letters-to-100.py | |
| """ | |
| import string | |
| letter_values = dict((l, i) for i, l in enumerate(string.lowercase, start=1)) | |
| english_dict = open('/usr/share/dict/words', 'rU') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| search regex: | |
| ~*(?:^|[^~])(~~(\\w+(\\s\\w+)*)~~) | |
| # replace with (attention: there's a white space at the end) | |
| **$1** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # install anaconda | |
| jupyter-lab --generate-config | |
| edit ~/.jupyter/jupyter_notebook_config.py, add lines: | |
| c.NotebookApp.token = '' #you can set password here. | |
| #https://github.com/jiahaog/nativefier | |
| npm install nativefier -g | |
| nativefier "http://localhost:8888" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| =begin | |
| Find pi by the Monte-Carlo method. | |
| area of a circle = pi r^2 | |
| area of a square = (2r)^2 = 4 r^2 | |
| Perform random uniform sampling between -1 and 1. | |
| The proportion of points in the unit circle is: | |
| p = (pi r^2) / (4r^2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| This code computes pi. It's not the first python | |
| pi computation tool that I've written. This program | |
| is a good test of the mpi4py library, which is | |
| essentially a python wrapper to the C MPI library. | |
| To execute this code: | |
| mpiexec -np NUMBER_OF_PROCESSES -f NODES_FILE python mpipypi.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' listing 6: pi_mp.py | |
| Multiprocessing based code to estimate the value of PI | |
| using monte carlo sampling | |
| Ref: http://math.fullerton.edu/mathews/n2003/montecarlopimod.html | |
| Uses workers: | |
| http://docs.python.org/library/multiprocessing.html#module-multiprocessing.pool | |
| ''' | |
| import random |
OlderNewer