Categories
Web Server

Nginx port to subfolder reverse proxy

/etc/nginx/conf.d/example.com.conf
server {
    listen 80;

    index index.html index.htm index.nginx-debian.html index.php;

    server_name example.com;

    location ~/app2(.*)$ {
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass https://example.com:8001$1;
    }
}
Categories
Python

Python Virtual Environment Wrapper

$ pip install virtualenvwrapper
$ which virtualenvwrapper.sh
/usr/local/bin/virtualenvwrapper.sh

Adding path

$ export WORKON_HOME=$HOME/.virtualenvs   # Optional
$ export PROJECT_HOME=$HOME/projects      # Optional
$ source /usr/local/bin/virtualenvwrapper.sh

Reloading Shell

$ source ~/.bashrc
$ echo $WORKON_HOME
/Users/mervinpraison/.virtualenvs

Functions

$ mkvirtualenv my-new-project
(my-new-project) $

To stop using the environment

(my-new-project) $ deactivate
$
$ workon
my-new-project

To activate the environment

$ workon my-new-project

-p parameter to choose the Python Version

$ virtualenv -p $(which python3) blog_virtualenv
Categories
Git

Kaggle Github Sync using Shell Script

  1. Create a Github repository
  2. Run “git init” on the local folder
  3. Run “git remote add origin https://github.com/user/repo.git” on the local folder
  4. Create a file shell.sh with the below code on the local folder
  5. Run “bash shell.sh” on the local folder

Shell.sh

for item in $(kaggle kernels list --user USERNAME); do
        if [[ $item == *"USERNAME"* ]]; then
                toreplace=""
                kaggle kernels pull $item -p "${item/USERNAME\/$toreplace}"
        fi
done;
git add .;
git commit -m 'update';
git push -u origin master;

Run Manually

Run “bash shell.sh” on the local folder whenever you make changes to your Kaggle kernels

Crontab

Use crontab to automatically run the script hourly, daily, weekly or monthly

Categories
Coding

My CodePen

See the Pen Append Element Value in jQuery by Mervin Praison (@MervinPraison) on CodePen.

See the Pen Clear Button in jQuery by Mervin Praison (@MervinPraison) on CodePen.

See the Pen Count Characters in JavaScript by Mervin Praison (@MervinPraison) on CodePen.

Categories
Coding WordPress

Change Category Header to Fullwidth Twentyninteen Theme