Git Product home page Git Product logo

chrisyeh96.github.io's Introduction

Install Jekyll

I find it best to use the conda package manager to install ruby, then use ruby to install the github-pages gem, which contains the set of gems (including Jekyll) used by GitHub Pages itself to compile each site. If conda is not already installed, install conda first. Then, pick one of two options:

1. Use conda to install ruby, then use ruby to install the github-pages gem.

To install/update to the latest version of the github-pages gem, run the following commands:

conda env update -f env_ruby.yml --prune
conda activate ruby

# Install/update to the latest version of github-pages gem
# (but don't install unnecessary documentation).
# Then cleanup old versions of installed gems.
gem install github-pages --no-document
gem cleanup

If the gem install github-pages command causes an error, try the following commands and then try installing the github-pages gem again:

sudo apt update  # update package index
sudo apt upgrade build-essential  # compilation tools

2. Directly use conda install the compiled github-pages gem.

Use the following commands to install/update Jekyll and the github-pages gem:

conda env update -f env.yml --prune
conda activate gh-pages

Note that conda-forge may not have the most up-to-date version of the github-pages gem (link), but it should work fine.

Build

Build locally: jekyll build [options]

Serve locally: jekyll serve [options]

Options

  • --baseurl /~chrisyeh: add this if hosting this site at some non-root domain (e.g., *.com/~chrisyeh)
  • --drafts: to show drafts among the latest posts
  • --force_polling: use this when running Jekyll on WSL to enable auto-regeneration.

Page Frontmatter Options

Variable Description
excerpt text to show on blog list and at top of post
last_updated date in YYYY-MM-DD format
layout name of layout from _layout/ folder
tags list of tags, e.g., [ML, math]
title title of post
use_code boolean, set to true to include code-highlighting CSS
use_fontawesome boolean, set to true to include FontAwesome CSS
use_math boolean, set to true to include MathJax JS
use_toc boolean, set to true to include a table of contents

chrisyeh96.github.io's People

Contributors

alphactzo7g avatar chrisyeh96 avatar imgbotapp avatar zer-0-ne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chrisyeh96.github.io's Issues

Navbar spacing

First of all, this is a great take on the Cayman theme, thanks so much! I was wondering about spacing in the navbar -- I checked developer tools and there seems to be an empty element propagated between About and Projects. Alone, this is fine, but I'd like to add more sections (a coursework tab, etc.), but this puts emphasis on the empty element causing additional spacing. I think this stems from _includes/navbar.html. However, I've read through it a few times and can't figure out where its coming from. Any suggestions on removing this? Thanks!

Definitive Python import guide

Great guide! I enjoyed it and learned a lot. I have a question regarding relative imports. You mentioned that modules in parent directories couldn't be imported without messing with sys.path. I was wondering about unittest and if it's different? For example say I have a directory mod/ with module.py and a unit-test for that module, test_module.py, in mod/tests/, I should be able to import module in mod/tests/test_module.py and run python -m unittest tests/test_module.py even though it's importing from the parent directory, correct?

module import precedence mistake in the Python imports article

Hello,

First of all excuse me if this isn't the right place to post this, i didn't really know how to get in touch so I figured a Github issue would be the best way to do it.

I was reading your post regarding imports (https://chrisyeh96.github.io/2017/08/08/definitive-guide-python-imports.html), which I found instructive & well written, but there's a small point I think is wrong.

Here's the excerpt:

The Python documentation goes on to mention the following:

The directory containing the script being run is placed at the beginning of the search path, ahead of the standard library path. This means that scripts in that directory will be loaded instead of modules of the same name in the library directory.

This seems to be a mistake. For example, calling import math in start.py will import the standard math module, NOT my own math.py file in the same directory.

The documentation is correct: the described behavior applies to modules in the standard library directory. The math module is a builtin module (like the sys module), guaranteed to be always available, and thus not implemented as a separate Python file in the standard library.

If you name your own module argparse for example, it will indeed have precedence over the argparse module in the standard library.

Hope I was clear, and thanks again for your excellent post. Cheers !

Solution 1 to Case 2 seems to work for Case 3, too

https://chrisyeh96.github.io/2017/08/08/definitive-guide-python-imports.html#case-3-syspath-could-change-take-2

Folder structure:

.
├── packA
│   ├── a1.py
│   ├── a2.py
│   └── subA
│       └── sa2.py
└── start.py

start.py:

import packA.a2
print('start.py')

a1.py:

import packA.a2
print('a1.py')

a2.py:

import packA.subA.sa2
print('a2.py')

sa2.py:

print('sa2.py')

Result in the parent directory of packA and start.py:

> python start.py
sa2.py
a2.py
start.py

> python -m packA.a1
sa2.py
a2.py
a1.py

Python 3.7.7

Recap order in which Python searches for modules to import

Hi,

I was reading carefully your great post https://chrisyeh96.github.io/2017/08/08/definitive-guide-python-imports.html because I discovered in it insights that I was for long wanted to clarify.

I think that once the built-in modules are mention above in the post, the recap paragraph:

Let’s recap the order in which Python searches for modules to import:

1. modules in the Python Standard Library (e.g. math, os)
2. modules or packages in a directory specified by sys.path:
     1. If the Python interpreter is run interactively:
           - sys.path[0] is the empty string ''. This tells Python to search the current working directory from which you launched the interpreter, i.e. the output of pwd on Unix systems.

        If we run a script with python <script>.py:
          - sys.path[0] is the path to <script>.py
     2. directories in the PYTHONPATH environment variable
     3. default sys.path locations

could be expressed something like:

Let’s recap the order in which Python searches for modules to import:

1. modules built-in in the Python Standard Library (e.g. math, os)

2. modules or packages in a directory specified by sys.path:
     1. If the Python interpreter is run interactively:
           - sys.path[0] is the empty string ''. This tells Python to search the current working directory from which you launched the interpreter, i.e. the output of pwd on Unix systems.

        If we run a script with python <script>.py:
          - sys.path[0] is the path to <script>.py
     2. directories in the PYTHONPATH environment variable
     3. default sys.path locations.
        That is, rest of the modules in the Python Standard Library that are not built-in (e.g. random).
          - sys.path[1:], or sys.path[2:] on case PYTHONPATH environment variable exists.

Hope you find it helpful and thanks a lot for your clear and tidy post.

Cannot replicate your page about LQR

Hi Chris,
Sorry to message you in this way; I could not find another way.
I was trying to set up my own math blog via GitHub pages, however, the Math does not seem to render as easily as in your page. Thus, I copied your page about LQR to my blog, and tried to make it render the same way as your blog. It can be found here. I was wondering if you knew what was going wrong.
I do realize you probably have better things to do than to help me debug, but it was worth a shot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.