How to reference python variable in jupyter notebook markdown cell

  1. Install Jupyter notebook extension plugin: https://github.com/ipython-contrib/jupyter_contrib_nbextensions
    1. conda install -c conda-forge jupyter_contrib_nbextensions
    2. jupyter contrib nbextension install --user
  2. Go to Jupyter notebook
    1. click Nbextensions
    2. enable Python Markdown
  3. use {{python variable}} in markdown cell. ūüôā

Highlights of the new RStudio releases

The new release of R Studio got many improvement. As I read them, I was very so excited about the new functions. Here are highlights for me.

  • Data can be filtered, searched, and sorted
  • Execute R code from the Source Viewer using Ctrl+Enter
  • Keyboard shortcut quick reference(Windows/Linux: Alt+Shift+K)
  • Alt + Enter to run code whilte retaining cursor position
  • Ctrl+Shift+E to select within matching parents/braces
  • Ctrl+Shift+M for magrittr pipe operator (%>%)
  • Ctrl+Alt+Shift+E to expand selection to matching paren/brace
  • dev.new() now creates a new desktop graphics device if the RStudio device is already active
  • Default to current working directory for new project from existing directory

My Git learning notes

Git Basic

  • Git Help
    • $ git help
    • $ git help config
  • Setting up git
    • $ git config –global user.name “xxx”
    • $ git config –global user.email “xxx@xxx.com”
    • $ git config –global color.ui true
  • Starting a Repo
    • $ git init
    • Work flow:
      • create file aaa.txt
      • add aaa.txt to staging area
      • commit changes
      • modify aaa.txt
      • add aaa.txt to staging area
      • commit changes
    • $ git status : watch the status
    • $ git add aaa.txt : add the modified file into staging area
    • $ git commit -m “hahaha!”
    • $ git add aaa.txt bbb.txt : add two files to staging area
      $ git add –all
      $ git add *.txt : add all txt files in current directory
      $ git add docs/*.txt
      $ git add docs/
      $ git add “*.txt” : add all txt files in the whole project
    • $git commit -m “hahahaha!”
  • Timeline History
    • $ git log

sublime text 2 build configuration

Sublime is a great editor, it can deal with nearly all programming languages and expecially fit for web developer.

I tried the sublime for Python. For beginner, you should do the following settings:

  • Install the package control
    • usage: ctrl+shift+p ¬†-> install packages
  • configure the¬†your build system:
    • For example python 3:
      Tools -> Build System -> New Build System -> (create file: python3)

          "cmd": ["python3", "-u", "$file"],
          "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
          "selector": "source.python",
          "encoding": "utf8",
          "path": "/Library/Frameworks/Python.framework/Versions/3.3/bin/"
      • The file is in :¬†%AppData%\Roaming\Sublime Text 2\Packages\User
    • or just install the package: ctrl+shift+p -> install packages -> python 3 & cython+
    • The customed build system file is located in %AppData%\Roaming\Sublime Text 2\Packages\Python3.sublime-build
  • If you want to delete the file, you can directly delete it or install a package with:¬†PackageResourceViewer






Useful Git Commands

  • $ git init
    #initialize an empty Git repoistory
  • $ git status
    #see the current state of the project
    untracked file: it is a new file and not be tracked by Git
    staged:Files are ready to be committed.
    unstaged: Files with changes that have not been prepared to be commited.
    untracked:¬†Files aren’t tracked by Git yet. This usually indicates a newly created file.
    deleted: File has been deleted and is waiting to be removed from Git.
  • $ git add <filename>
    $ git add -A .
    # add all, “.” stand for the current directory
    $ git reset <filename>
    #remove a file or files from the staging area
  • $ git commit -m “a message about the changing”
    # Staging Area:¬†A place where we can group files together before we “commit” them to Git.
  • $¬†git add ‘*.txt’
    # Wildcards: need quotes
  • $ git log
    # see all the changes
    $ git log –summary
    # see more information for each commit
  • $¬†git remote add origin https://github.com/…
    # push local repository to the GitHub server, “origin” is the name for remote repository
  • $ git push -u origin master
    # push local changes to the “origin” repository
    # -u : remember the parameters, so that next time simply run git push
  • $ git pull origin master
    # check for changes on repository and pull down any new changes by running
  • $ get diff HEAD
    # diff of most recent commit using HEAD pointer
    # HEAD: a pointer that holds your position within all different commits. By default HEAD points to most recent commit, so it can be used as a quick way to reference that commit without having to look up SHA.
  • $ git diff –staged
    # –staged : see the changes you just staged.
  • $ git reset <filename>
    # unstage files, but not delete the files
  • $ git checkout — <target>
    # change the file back to the last commit
    # — : promising the command line that there are no more options after the ‘–‘.
  • $ git branch <new branch name>
    # create a new branch
  • $ git checkout <branch>
    # switch to the branch
    $ git checkout -b <branch>
    # create and checkout a new branch at the same time
  • $ git rm <filename>
    # remove a file
    $ git rm ‘*.txt’
    # remove all file
    $ git rm -r <folder>
    # remove a folder and all its content
  • $ git commit -am “message”
    # if you happen to delete a file without using ‘git rm’, then you still have remove it from the working tree with the command “git rm”. ‘-a’ option means auto removes deleted files.
  • $ git checkout master
    # switch to master branch
  • $ git merge clean_up
    # merge the branch
  • $ git branch -d <branch name>
    # delete branch: -d¬†means if something isn’t merged, it will not allow be deleted
    # –force (-f) : force to be done
    $ git branch -D <branch name>
    # -D combines -f -d into one command
  • $ git push
    # push everything to remote repository
  • $ git add file && git commit -m “removed merge conflicts”
    $git add file && git commit -m “resolved merge conflicts”
    # If pull failed (When conflict with your local file happens), you need this command
  • $ git push origin master –force
    $ git¬†pull¬†–rebase
    $ git push
    # If push failed
  • $ git log origin/master..HEAD
    # Viewing Unpushed Git Commits
    $ git diff origin/master..HEAD
    #  view the diff using the same syntax
    See: Viewing unpushed git commits?
  • $¬†git reset –soft HEAD~1
    #¬†Delete the most recent commit, keeping the work you’ve done
    $ git reset –hard HEAD~1
    #¬†Delete the most recent commit, destroying the work you’ve done
    See: How do I delete unpushed git commits?

How to change the document root in XAMPP for Windows

Do the following steps:

  • XAMPP Control Panel -> Apache -> Config -> httpd.conf
  • find the codes:
    DocumentRoot “C:/xampp/htdocs”
    <Directory “C:/xampp/htdocs”>
  • change them to your new folder:
    DocumentRoot “D:/www”
    <Directory “D:/www”>
  • copy all the contents from “C:/xampp/htdocs” to “”D:/www” “
  • restart the Apache

Setting for RapidSVN

RapidSVN is a easy to use tool in Ubuntu, but some settings are still need to be cared.

Documentation: http://www.rapidsvn.org/index.php/OnlineHelp:Contents

If you want to set meld as merge tool, please don’t forget to give the following arguments in preference:

“%2” “%4” “%3”

set meld as merge tool