Prefixed various misc commands with ! so they can be executed within IPython Notebook.

This commit is contained in:
Donne Martin 2015-03-13 08:05:56 -04:00
parent 8c4541ae33
commit 8c251e43cd

View File

@ -1,7 +1,7 @@
{ {
"metadata": { "metadata": {
"name": "", "name": "",
"signature": "sha256:2dac2a968d9e20f06438bc20ea8d86a270cf591b873e5dafe7658304d7e8411f" "signature": "sha256:809d7013e8827d69ad6bd081281c1bca3afdf2ca3556091669cfa1f9077ece91"
}, },
"nbformat": 3, "nbformat": 3,
"nbformat_minor": 0, "nbformat_minor": 0,
@ -40,22 +40,22 @@
"collapsed": false, "collapsed": false,
"input": [ "input": [
"# See Anaconda installed packages\n", "# See Anaconda installed packages\n",
"conda list\n", "!conda list\n",
"\n", "\n",
"# Create Python 3 environment\n", "# Create Python 3 environment\n",
"conda create -n py3k python=3 anaconda\n", "!conda create -n py3k python=3 anaconda\n",
"\n", "\n",
"# Activate Python 3 environment\n", "# Activate Python 3 environment\n",
"source activate py3k\n", "!source activate py3k\n",
"\n", "\n",
"# Deactivate Python 3 environment\n", "# Deactivate Python 3 environment\n",
"source deactivate\n", "!source deactivate\n",
"\n", "\n",
"# Update Anaconda\n", "# Update Anaconda\n",
"conda update conda\n", "!conda update conda\n",
"\n", "\n",
"# Update a package with Anaconda\n", "# Update a package with Anaconda\n",
"conda update ipython" "!conda update ipython"
], ],
"language": "python", "language": "python",
"metadata": {}, "metadata": {},
@ -146,89 +146,89 @@
"collapsed": false, "collapsed": false,
"input": [ "input": [
"# Configure git\n", "# Configure git\n",
"git config --global user.name 'First Last'\n", "!git config --global user.name 'First Last'\n",
"git config --global user.email 'name@domain.com'\n", "!git config --global user.email 'name@domain.com'\n",
"git init\n", "!git init\n",
"\n", "\n",
"# View status and log\n", "# View status and log\n",
"git status\n", "!git status\n",
"git log\n", "!git log\n",
"\n", "\n",
"# Add or remove from staging area\n", "# Add or remove from staging area\n",
"git add [target]\n", "!git add [target]\n",
"git reset [target file or commit]\n", "!git reset [target file or commit]\n",
"git reset --hard origin/master\n", "!git reset --hard origin/master\n",
"\n", "\n",
"# Automatically stage tracked files, including deleting the previously tracked files\n", "# Automatically stage tracked files, including deleting the previously tracked files\n",
"git add -u\n", "!git add -u\n",
"\n", "\n",
"# Delete files and stage them\n", "# Delete files and stage them\n",
"git rm [target]\n", "!git rm [target]\n",
"\n", "\n",
"# Commit\n", "# Commit\n",
"git commit -m \u201cAdd commit message here\u201d\n", "!git commit -m \u201cAdd commit message here\u201d\n",
"\n", "\n",
"# Add new origin\n", "# Add new origin\n",
"git remote add origin https://github.com/donnemartin/ipython-data-notebooks.git\n", "!git remote add origin https://github.com/donnemartin/ipython-data-notebooks.git\n",
"\n", "\n",
"# Set to new origin\n", "# Set to new origin\n",
"git remote set-url origin https://github.com/donnemartin/pydatasnippets.git\n", "!git remote set-url origin https://github.com/donnemartin/pydatasnippets.git\n",
" \n", " \n",
"# Push to master, -u saves config so you can just do \"git push\" afterwards\n", "# Push to master, -u saves config so you can just do \"git push\" afterwards\n",
"git push -u origin master\n", "!git push -u origin master\n",
"git push\n", "!git push\n",
"\n", "\n",
"# Pull down from master\n", "# Pull down from master\n",
"git pull origin master\n", "!git pull origin master\n",
"\n", "\n",
"# Diff files\n", "# Diff files\n",
"git diff HEAD\n", "!git diff HEAD\n",
"git diff --staged\n", "!git diff --staged\n",
"git diff --cached\n", "!git diff --cached\n",
"\n", "\n",
"# Undo a file that has not been added\n", "# Undo a file that has not been added\n",
"git checkout \u2014 [target]\n", "!git checkout \u2014 [target]\n",
"\n", "\n",
"# Create a branch\n", "# Create a branch\n",
"git branch [branch]\n", "!git branch [branch]\n",
"\n", "\n",
"# Check branches\n", "# Check branches\n",
"git branch\n", "!git branch\n",
"\n", "\n",
"# Switch branches\n", "# Switch branches\n",
"git checkout [branch]\n", "!git checkout [branch]\n",
"\n", "\n",
"# Merge branch to master\n", "# Merge branch to master\n",
"git merge [branch]\n", "!git merge [branch]\n",
"\n", "\n",
"# Delete branch\n", "# Delete branch\n",
"git branch -d [branch]\n", "!git branch -d [branch]\n",
"\n", "\n",
"# Clone\n", "# Clone\n",
"git clone git@github.com:repo folder-name\n", "!git clone git@github.com:repo folder-name\n",
"git clone https://donnemartin@bitbucket.org/donnemartin/tutorial.git\n", "!git clone https://donnemartin@bitbucket.org/donnemartin/tutorial.git\n",
" \n", " \n",
"# Update a local repository with changes from a remote repository\n", "# Update a local repository with changes from a remote repository\n",
"git pull origin master\n", "!git pull origin master\n",
"\n", "\n",
"# Create a file containing a patch\n", "# Create a file containing a patch\n",
"# git format-patch are like normal patch files, but they also carry information \n", "# git format-patch are like normal patch files, but they also carry information \n",
"# about the git commit that created the patch: the author, the date, and the \n", "# about the git commit that created the patch: the author, the date, and the \n",
"# commit log message are all there at the top of the patch.\n", "# commit log message are all there at the top of the patch.\n",
"git format-patch origin/master\n", "!git format-patch origin/master\n",
"\n", "\n",
"# GitHub tutorial:\n", "# GitHub tutorial:\n",
"http://try.github.io/levels/1/challenges/9\n", "!http://try.github.io/levels/1/challenges/9\n",
"\n", "\n",
"# BitBucket Setup\n", "# BitBucket Setup\n",
"cd /path/to/my/repo\n", "!cd /path/to/my/repo\n",
"git init\n", "!git init\n",
"git remote add origin https://donnemartin@bitbucket.org/donnemartin/repo.git\n", "!git remote add origin https://donnemartin@bitbucket.org/donnemartin/repo.git\n",
"git push -u origin --all # pushes up the repo and its refs for the first time\n", "!git push -u origin --all # pushes up the repo and its refs for the first time\n",
"git push -u origin --tags # pushes up any tags\n", "!git push -u origin --tags # pushes up any tags\n",
"\n", "\n",
"# Open Hatch missions\n", "# Open Hatch missions\n",
"git clone https://openhatch.org/git-mission-data/git/dmartin git_missions" "!git clone https://openhatch.org/git-mission-data/git/dmartin git_missions"
], ],
"language": "python", "language": "python",
"metadata": {}, "metadata": {},
@ -253,28 +253,25 @@
"collapsed": false, "collapsed": false,
"input": [ "input": [
"# Update Ruby\n", "# Update Ruby\n",
"rvm get stable\n", "!rvm get stable\n",
"\n", "\n",
"# Reload Ruby (or open a new terminal)\n", "# Reload Ruby (or open a new terminal)\n",
"rvm reload\n", "!rvm reload\n",
"\n", "\n",
"# List all known RVM installable rubies\n", "# List all known RVM installable rubies\n",
"rvm list known\n", "!rvm list known\n",
"\n", "\n",
"# List all installed Ruby versions\n", "# List all installed Ruby versions\n",
"rvm rubies\n", "!rvm rubies\n",
"\n", "\n",
"# Install a specific Ruby version\n", "# Install a specific Ruby version\n",
"rvm install 2.1.5\n", "!rvm install 2.1.5\n",
"\n", "\n",
"# Set Ruby version\n", "# Set Ruby version\n",
"rvm --default ruby-2.1.5\n", "!rvm --default ruby-2.1.5\n",
"\n", "\n",
"# Check Ruby version\n", "# Check Ruby version\n",
"ruby -v\n", "!ruby -v"
"\n",
"# MRI Rubies\n",
"[ruby-]1.9.2[-p320]"
], ],
"language": "python", "language": "python",
"metadata": {}, "metadata": {},
@ -314,7 +311,7 @@
"cell_type": "code", "cell_type": "code",
"collapsed": false, "collapsed": false,
"input": [ "input": [
"rvm --default ruby-2.1.5" "!rvm --default ruby-2.1.5"
], ],
"language": "python", "language": "python",
"metadata": {}, "metadata": {},
@ -332,11 +329,11 @@
"collapsed": false, "collapsed": false,
"input": [ "input": [
"# => The current folder will be generated into ./_site\n", "# => The current folder will be generated into ./_site\n",
"bundle exec jekyll build\n", "!bundle exec jekyll build\n",
"\n", "\n",
"# => A development server will run at http://localhost:4000/\n", "# => A development server will run at http://localhost:4000/\n",
"# Auto-regeneration: enabled. Use `--no-watch` to disable.\n", "# Auto-regeneration: enabled. Use `--no-watch` to disable.\n",
"bundle exec jekyll serve" "!bundle exec jekyll serve"
], ],
"language": "python", "language": "python",
"metadata": {}, "metadata": {},