Github notes

From raju

dummy

favorite configuration

    git config user.name "Kamaraju S. Kusumanchi"
    git config user.email kamaraju@gmail.com
    

For ssh keys

    ssh-keygen -t rsa -C "kamaraju@gmail.com"
    

Add the key to ssh-agent

    ssh-agent -s
    ssh-add ~/.ssh/id_rsa
    

To copy the key

    clip < ~/.ssh/id_rsa.pub
    

ssh key fingerprint

    ssh-keygen -l -f ~/.ssh/id_rsa -E md5
    

regenerate private key from public key

    ssh-keygen -y -f ~/.ssh/id_rsa
    

repository url

Sample repository url

    https://github.com/<user>/<project>.git
    git@github.com:<user>/<project>.git
    

create first page

    https://github.com/<user>/<project>/new/master
    

zip archive of a repo

Add /archive/master.zip to the end of a repo's URL. For example https://github.com/USER/REPO/archive/master.zip

Add table of contents to mediawiki files

To add the table of contents to a mediawiki file of a project wiki, use

     __TOC__
    

See https://github.com/KamarajuKusumanchi/market_data/wiki/earnings for an example.

useful links

Useful github repos

  • https://github.com/ChrisCummins/labm8 - uses "pip install -r requirements.txt" in .travis.yml and the requirements.txt has lines that specify the minimum required versions of a package (ex:- pandas >= 0.19.0)

Check later

Sort later

  • github hosts 78 million Git repositories.

Ref:- https://blog.github.com/2018-03-05-measuring-the-many-sizes-of-a-git-repository/

my github stars

missing features

change remote's url from https to ssh

    git remote set-url origin git@github.com:USERNAME/REPOSITORY.git
    

For example

    git remote set-url origin git@github.com:KamarajuKusumanchi/notebooks.git
    

Ref:- https://help.github.com/articles/changing-a-remote-s-url/

specify tab space width

Add ?ts=N to the URL. For example https://github.com/nayuki/Project-Euler-solutions/blob/master/python/p053.py?ts=4 will display tabs as 4 spaces wide and https://github.com/nayuki/Project-Euler-solutions/blob/master/python/p053.py?ts=8 will display them as 8 spaces wide.

github markdown notes

  • comments
    <!--
    blah blah
    -->
    
  • headings
    ### is bigger than #####
    
  • quoting
    ```
    blah blah
    ```
    

or

    `blah blah`
    
  • click and expand
    <details>
      <summary>Click to expand</summary>
      whatever
    </details>
    

tags | collapsible

See https://github.com/ContinuumIO/anaconda-issues/issues/10992 for an example.

download a single file

    curl https://raw.githubusercontent.com/user/repository/branch/filename -O
    

Ref:- https://stackoverflow.com/questions/4604663/download-single-files-from-github

Example: The pdf version of OpenIntro Statistics 4th edition book is located at https://github.com/OpenIntroStat/openintro-statistics/blob/master/main.pdf . I downloaded it using

    curl https://raw.githubusercontent.com/OpenIntroStat/openintro-statistics/master/main.pdf -O
    

nbviewer links

    Change
        github.com
    with
        nbviewer.jupyter.org/github
    

For example

    https://github.com/KamarajuKusumanchi/notebooks/blob/master/pandas/Select%20rows%20and%20columns.ipynb
     ->
    https://nbviewer.jupyter.org/github/KamarajuKusumanchi/notebooks/blob/master/pandas/Select%20rows%20and%20columns.ipynb
    


Use case:

Some times github shows the following error when trying to display an ipython notebook

    Sorry, something went wrong. Reload?
    

A workaround is to use nbviewer.jupyter.org.

searching code

search in a particular file

search python files

Use

    language:python
    

search my repositories

    user:KamarajuKusumanchi
    

tags | author

search by file extension

    extension:sh
    -extension:java
    

tags | search files with an extension

remove results from a user

    -user:foo
    

useful links