Skip to content

Instantly share code, notes, and snippets.

View CHANG-CHING-CHUNG's full-sized avatar

John CHANG-CHING-CHUNG

  • Hsinchu Taiwan
View GitHub Profile
@CHANG-CHING-CHUNG
CHANG-CHING-CHUNG / load_dotenv.sh
Created September 2, 2021 03:09 — forked from mihow/load_dotenv.sh
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
@CHANG-CHING-CHUNG
CHANG-CHING-CHUNG / Jenkinsfile
Created September 1, 2021 07:07 — forked from merikan/Jenkinsfile
Some Jenkinsfile examples
Some Jenkinsfile examples
@CHANG-CHING-CHUNG
CHANG-CHING-CHUNG / psql-error-fix.md
Created August 30, 2021 13:24 — forked from AtulKsol/psql-error-fix.md
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from

@CHANG-CHING-CHUNG
CHANG-CHING-CHUNG / PYTHON_DEFAULT.md
Created August 30, 2021 01:22 — forked from patrickmmartin/PYTHON_DEFAULT.md
update-alternatives for python3 on Ubuntu

Ubuntu 16 default python is almost python 3

Loads of solutions exist, but for changing the system default, alias is not the way to go.

$ update-alternatives --list python update-alternatives: error: no alternatives for python

@CHANG-CHING-CHUNG
CHANG-CHING-CHUNG / Update-branch.md
Created August 5, 2021 08:31 — forked from whoisryosuke/Update-branch.md
Bring your feature branch up to date with master. Deploying from Git branches adds flexibility. Bring your branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master

@CHANG-CHING-CHUNG
CHANG-CHING-CHUNG / Django_Default_Config.md
Created July 10, 2021 07:23 — forked from singerng/Django_Default_Config.md
Config for Django/Pipenv/Gunicorn/Nginx/Systemd.

Reasonable default configuration for a web app that uses Django and the following dependencies:

  • Pipenv: Python package manager
  • Gunicorn: WSGI server
  • Nginx: Static webserver passing to gunicorn, handling SSL, etc.
  • Systemd: Used to load Gunicorn on startup

This is my goto for setting up projects.

@CHANG-CHING-CHUNG
CHANG-CHING-CHUNG / Install PyQt5 on Ubuntu with python3 .md
Created May 20, 2021 09:12 — forked from r00tdaemon/Install PyQt5 on Ubuntu with python3 .md
Install PyQt5 on Ubuntu with python3. Steps to set up PyQt5 (ubuntu). With python code generation

Installation

pip3 install --user pyqt5  
sudo apt-get install python3-pyqt5  
sudo apt-get install pyqt5-dev-tools
sudo apt-get install qttools5-dev-tools

Configuring to run from terminal