Polynomial fitting by linear least squares

I made a repository of C++ code that runs polynomial fitting by linear least squares.


use Meld for git diff

  1. make a script, git-meld.sh
    meld “$2” “$5” > /dev/null 2>&1
  2. put the script in the bin directory
    sudo mv git-meld.sh /usr/local/bin/
    sudo chmod +x /usr/local/bin/git-meld.sh
  3. add diff settings in the $HOME/.gitconfig
        external = /usr/local/bin/git-meld.sh

git commit related to an issue

A commit can be linked to an issue by adding issue ID at the beginning of commit message. The following command links the commit to an issue, whose ID is 1.
    git commit -m “#1 brabrabra”


MatLab code decompose an image to patches

I uploaded my code, which decomposes an image to patches, on my git. The repository contains 2 basic functions and 1 demo code:

  • im2patch.m: decomposes an image into a set of image patches
  • patch2im.m: forms an image by merging a set of image patches
  • demo_patching.m: shows how the above functions work

github: upload an empty directory

It’s technically impossible to commit an empty directory to github because github only manages files. However, there exists a practical solution that stores a .gitignore file inside a directory and commit the .gitignore file so that the directory is commited. The contents of the .gitignore is as

# ignore everything except .gitignore and folders that I care about:

github: delete a previous commit

suppose we would like to cancel N commits

git reset --hard HEAD~N
git push origin -f

,where N is the number of revert.
Note that this commands may be wrong. I’ll check how git reset works and then put detailed information on another post.


github: create a new repository

so far I cannot create a new repository from terminal… So, I first create a new repository via github web GUI. and then

git clone URL
git add FILES
git commit -m "MESSAGE"
git push origin master