Version Control with Git: Check Differences
Changing Git history¶
Check Changes from Last Commit¶
git diff
git add -p
git rm
git mv
git checkout [-p] <file>
git restore <file>
git reset [-p]
git restore --staged <file>
git stash
git stash apply
git checkout -b new_branch HEAD~2
git reset --hard HEAD~3 # Go back in time, throwing away changes
git reset --soft HEAD~3 # Set HEAD to point to an earlier commit
more ...
Formulae Auto-Derivation for Nested Logit Models
This file uses the Symbolic Python (SymPy) package to derive the elasticity formulae for Nested Logit Models. SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily …
more ...Bash Cheat Sheet
Basic Commands¶
echo
cat
ls [-la] # list files in the present directory
chmod [+x] file
mkdir # make new directories
cd # change the directory
pwd # present working directory
cp path_from path_to # copy
mv path_from path_to
rm path # delect files
rmdir # delete empty directories
touch file_name # create empty file
more ...
Version Control with Git (1): Basic Workflow
Git can be seen as taking a series of snapshots of important stages of a project. If we want Git to take a snapshot of the current status of the project, we make a commit. by recording the changes made in each commit. Changes can be untracked, staged (cached) or commited. If we make a change to a file in the project, it will first appear as untracked. Untracked changes do not make any difference to Git. If we think the change is meanful and plan to save it, we need to staged it to tell Git to include it in the next commit. After we stage all the changes we want to include in this commit, we commit the staged changes and Git will save the changes.
more ...Using Jupyter Notebook with Pelican in Windows
Update: This solution does not work with nbconvert >= 6. Tested on nbconvert == 5.6.1.
Jupyter-Pelican is a plugin that helps Pelican to generate static contents from Jupyter notebook. I like it because it allows the user to put the metadata in the first cell of the notebook. No need to create a separate file for the metadata or edit the metadata of the notebook. However, this option will encounter a permission denied error on Windows OS because Windows does not allow (at least easily) openning a temporary file for a second time, according to the documentation of tempfile.NamedTemporaryFile more ...
Creating Pretty Tables in Python with PTable
Creating an output table in Python using PTable is fast and easy. This article introduces the most useful functionalities of PTable, such as adding rows and columns, changing text alignment and floating number format, and clearing data, to get a quick start to make the ideal table in no time …
more ...Learning Resources for Econometrics, Statistics and Machine Learning
Over the years, I have used a number of books for Econometrics, statistics and machine learning either as a student, teaching assistant or lecturer. Even though I enjoy reading hard copies more, I am more and more inclined to have electronic copies when overall costs of carry are considered. Given …
more ...