Skip to main content

· 2 min read
Lejen

Ghost Error 500 - The currently active theme is missing.

Bump into this error when I am trying to setup custom theme for Ghost Blog. I am using Heroku to host this site. Just got to know that Heroku site do not have storage to store the custom theme uploaded via Ghost admin panel.

Did couple of search online, a lot suggested that you can clone heroku by git clone command

heroku git:clone -a myappname

But I get the error message about cloning an empty repository which I think it doesn't make any sense when the site is live at the moment

Continued my search and finally came into something useful which is using heroku slug to download source code

Solution

  1. Before that, proceed to install Heroku CLI following guide at their official site Heroku Dev Center

  2. Follow this site to get it heroku-slugs installed

  3. Login to Heroku account

    heroku login
  4. Heroku slug command to download your source code

    heroku slugs:download -a APP_NAME
  5. You will be getting the following folders:

  • app
  • slug.tar.gz

Command Line

  1. Make a new repository in GitHub and upload app folder to your repository

  2. Proceed to your heroku app dashboard, under Deploy Tab, Deployment method select GitHub and search for your newly created repository. You will end up something like below.

Heroku

  1. Done!
  2. You may also setup automatic deploys for every push to master branch

· 3 min read
Lejen

The git commit --amend command allows you to change the most recent commit message.

Not pushed commit

To change the message of the most recent commit that has not been pushed to the remote repository, commit it again using the --amend flag.

  1. Navigate to the repository directory in your terminal.

  2. Run the following command to amend (change) the message of the latest commit:

git commit --amend -m "New commit message."

What the command does is overwriting the most recent commit with the new one.

The -m option allows you to write the new message on the command line without opening an editor session.

Before changing the commit message, you can also add other changes you previously forgot:

git add .

Pushed commit

The amended (changed) commit is a new entity with a different SHA-1. The previous commit will no longer exist in the current branch.

Generally, you should avoid amending a commit that is already pushed as it may cause issues to people who based their work on this commit. It is a good idea to consult your fellow developers before changing a pushed commit.

If you changed the message of the most recently pushed commit, you would have to force push it.

  1. Navigate to the repository.

  2. Amend the message of the latest pushed commit:

git commit --amend -m "New commit message."
  1. Force push to update the history of the remote repository:
git push --force branch-name

Changing an Older or Multiple Commits

If you need to change the message of an older or multiple commits, you can use an interactive git rebase to change one or more older commits.

The rebase command rewrites the commit history, and it is strongly discouraged to rebase commits that are already pushed to the remote Git repository.

  1. Navigate to the repository containing the commit message you want to change.

  2. Type git rebase -i HEAD~N, where N is the number of commits to perform a rebase on. For example, if you want to change the 4th and the 5th latest commits, you would type:

git rebase -i HEAD~5

The command will display the latest X commits in your default text editor:

pick 43f8707f9 fix: update dependency json5 to ^2.1.1
pick cea1fb88a fix: update dependency verdaccio to ^4.3.3
pick aa540c364 fix: update dependency webpack-dev-server to ^3.8.2
pick c5e078656 chore: update dependency flow-bin to ^0.109.0
pick 11ce0ab34 fix: Fix spelling.

# Rebase 7e59e8ead..11ce0ab34 onto 7e59e8ead (5 commands)
  1. Move to the lines of the commit message you want to change and replace pick with reword:
reword 43f8707f9 fix: update dependency json5 to ^2.1.1
reword cea1fb88a fix: update dependency verdaccio to ^4.3.3
pick aa540c364 fix: update dependency webpack-dev-server to ^3.8.2
pick c5e078656 chore: update dependency flow-bin to ^0.109.0
pick 11ce0ab34 fix: Fix spelling.

# Rebase 7e59e8ead..11ce0ab34 onto 7e59e8ead (5 commands)
  1. Save the changes and close the editor.

  2. For each chosen commit, a new text editor window will open. Change the commit message, save the file, and close the editor.

fix: update dependency json5 to ^2.1.1
  1. Force push the changes to the remote repository:
git push --force branch-name

Conclusion

To change the most recent commit message, use the git commit --amend command. To change older or multiple commit messages, use git rebase -i HEAD~N.

Don’t amend pushed commits as it may potentially cause a lot of problems to your colleagues.

· 2 min read
Lejen

py -m pip freeze | findstr py

Upgrade Pip

python -m pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
py -m pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
C:\Users\xxx\AppData\Local\Programs\Python\Python38\python.exe -m pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org

Install Pip

py get-pip.py --trusted-host pypi.org --trusted-host files.pythonhosted.org

Pip Install command

pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package> --user
py -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package> --user

some notes on new setup

python -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package> --user

install from whl

pip install some-package.whl

Add to path

C:\Users\xxx\AppData\Roaming\Python\Python37\Scripts

Use this to install from local drive

pip install ./downloads/PythonSetup3.8/flake8-3.8.3.tar.gz  --trusted-host pypi.org --trusted-host files.pythonhosted.org
py -m pip install ./downloads/PythonSetup3.8/dateformat-0.9.7.tar.gz --trusted-host pypi.org --trusted-host files.pythonhosted.org --user

Install requirement

pip install -r requirements.txt --trusted-host pypi.org --trusted-host files.pythonhosted.org
python -m pip install -r requirements.txt --trusted-host pypi.org --trusted-host files.pythonhosted.org

When upgrading, reinstall all packages even if they are already up-to-date.

pip install --upgrade --force-reinstall <package> --trusted-host pypi.org --trusted-host files.pythonhosted.org
pip install --upgrade --force-reinstall --trusted-host pypi.org --trusted-host files.pythonhosted.org <package>

pip install -I <package>
pip install --ignore-installed <package>

Once in a while, a Python package gets corrupted on your machine and you need to force pip to reinstall it. As of pip 10.0, you can run the following:

This will force pip to re-install corrupted package and all its dependencies.

pip install --force-reinstall <corrupted package>

If you want to re-download the packages instead of using the files from your pip cache, add the --no-cache-dir flag:

pip install --force-reinstall --no-cache-dir <corrupted package>

If you want to upgrade the package, you can run this instead:

pip install --upgrade <corrupted package>

The --upgrade flag will not mess with the dependencies of corrupted package unless you add the --force-reinstall flag.

If, for some reason, you want to re-install corrupted package and all its dependencies without first removing the current versions, you can run:

pip install --ignore-installed <corrupted package>

By the way, if you’re using a pip version that is less than 10.0, it’s time to update pip:

pip install --upgrade pip

· 2 min read
Lejen

Here's my thoughts

Always wanted to create personal site. Started with Github pages, uses automated workflow and get stuff compiled into a static site (Jekyll). Didn't like it much about having to write stuff in editor and then later you have to perform commits and pushes. So I moved on and wanted to find something with a user interface that I could interact with. Something which is free without need to spend extra $$$.

Hugo + Netlify + Github

The next try on Hugo.

Hugo is a static website engine written in Golang. Best thing about this is on the theming system, plenty of choices and everything is free. Did some search on Google, landed on some one click deployment. Messing with it for couple of days on the HTML, CSS and JS. Personal didn't like it due to lack of content management so went for another search on alternatives.

Medium, Wordpress

Recently seeing quite a bit of content creator from Medium and Wordpress, could be possibly everyone is so free during the world pandemic, including myself. These platform don't really work well without spending some $$$. Content creator usually have their articles behind some pay-wall, good for people who wanted to monetize their content. I wish I could write as like the others, but too bad I don't.

Ghost

Finally settled down with hosting Ghost with Heroku with a domain name setup with Cloudflare.

Starting to like it due to the ease of use and user-friendly interface. Best thing about it is open source, you can customise your theme, and you have full control on how your site should look like. The default theme of Ghost (Casper), looks good enough to keep your site look clean and steady.

I am back to Github pages

After the recent announcement on heroku no longer offer free dyno hours. I am moving back to github pages.