Cloning Project

echo "Using conditional statement to create a project directory and project"

# Variable section
export project_dir=$HOME/vscode  # change vscode to different name to test git clone
export project=$project_dir/samuel  # change APCSP to name of project from git clone
export project_repo="https://github.com/Samuelwaang/samuel"  # change to project of choice

cd ~    # start in home directory

# Conditional block to make a project directory
if [ ! -d $project_dir ]
then 
    echo "Directory $project_dir does not exists... makinng directory $project_dir"
    mkdir -p $project_dir
fi
echo "Directory $project_dir exists." 

# Conditional block to git clone a project from project_repo
if [ ! -d $project ]
then
    echo "Directory $project does not exists... cloning $project_repo"
    cd $project_dir
    git clone $project_repo
    cd ~
fi
echo "Directory $project exists."
Using conditional statement to create a project directory and project
Directory /home/samuelwaang/vscode exists.
Directory /home/samuelwaang/vscode/samuel exists.

Python Versions

python2 --version
python3 --version
Python 2.7.18
Python 3.9.12

Java Versions

java --version
javac --version
openjdk 11.0.16 2022-07-19
OpenJDK Runtime Environment (build 11.0.16+8-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)
javac 11.0.16

Kernels

jupyter kernelspec list
Available kernels:
  bash          /home/samuelwaang/.local/share/jupyter/kernels/bash
  java          /home/samuelwaang/.local/share/jupyter/kernels/java
  javascript    /home/samuelwaang/.local/share/jupyter/kernels/javascript
  python3       /home/samuelwaang/.local/share/jupyter/kernels/python3

Notes

prints directory

cd $project
pwd
/home/samuelwaang/vscode/samuel

folders/files of directory

ls
2022-05-15-07-21-16.png  README.md        _notebooks  assets
2022-05-15-07-24-25.png  _action_files    _pages      docker-compose.yml
2022-05-15-07-25-15.png  _config.yml      _plugins    images
Gemfile                  _fastpages_docs  _posts      index.html
LICENSE                  _includes        _sass
Makefile                 _layouts         _word

folders/files of directory, including the hidden ones

list all files in long format

ls -al
total 488
drwxr-xr-x 16 samuelwaang samuelwaang   4096 Aug 26 10:34 .
drwxr-xr-x  6 samuelwaang samuelwaang   4096 Aug 23 10:20 ..
-rw-r--r--  1 samuelwaang samuelwaang    420 Aug 20 13:49 .devcontainer.json
drwxr-xr-x  8 samuelwaang samuelwaang   4096 Aug 27 17:44 .git
-rw-r--r--  1 samuelwaang samuelwaang     84 Aug 20 13:49 .gitattributes
drwxr-xr-x  4 samuelwaang samuelwaang   4096 Aug 20 13:49 .github
-rw-r--r--  1 samuelwaang samuelwaang    161 Aug 20 13:49 .gitignore
-rw-r--r--  1 samuelwaang samuelwaang 207007 Aug 20 13:49 2022-05-15-07-21-16.png
-rw-r--r--  1 samuelwaang samuelwaang  90979 Aug 20 13:49 2022-05-15-07-24-25.png
-rw-r--r--  1 samuelwaang samuelwaang  81691 Aug 20 13:49 2022-05-15-07-25-15.png
-rwxr-xr-x  1 samuelwaang samuelwaang   1304 Aug 20 13:49 Gemfile
-rw-r--r--  1 samuelwaang samuelwaang  11351 Aug 20 13:49 LICENSE
-rwxr-xr-x  1 samuelwaang samuelwaang   1422 Aug 20 13:49 Makefile
-rwxr-xr-x  1 samuelwaang samuelwaang   3605 Aug 20 13:49 README.md
drwxr-xr-x  2 samuelwaang samuelwaang   4096 Aug 20 13:49 _action_files
-rw-r--r--  1 samuelwaang samuelwaang   3606 Aug 26 10:33 _config.yml
drwxr-xr-x  2 samuelwaang samuelwaang   4096 Aug 20 13:49 _fastpages_docs
drwxr-xr-x  2 samuelwaang samuelwaang   4096 Aug 20 13:49 _includes
drwxr-xr-x  2 samuelwaang samuelwaang   4096 Aug 20 13:49 _layouts
drwxr-xr-x  4 samuelwaang samuelwaang   4096 Aug 26 10:37 _notebooks
drwxr-xr-x  2 samuelwaang samuelwaang   4096 Aug 26 10:33 _pages
drwxr-xr-x  2 samuelwaang samuelwaang   4096 Aug 20 13:49 _plugins
drwxr-xr-x  2 samuelwaang samuelwaang   4096 Aug 26 10:33 _posts
drwxr-xr-x  3 samuelwaang samuelwaang   4096 Aug 20 13:49 _sass
drwxr-xr-x  2 samuelwaang samuelwaang   4096 Aug 20 13:49 _word
drwxr-xr-x  4 samuelwaang samuelwaang   4096 Aug 20 13:49 assets
-rwxr-xr-x  1 samuelwaang samuelwaang   1136 Aug 20 13:49 docker-compose.yml
drwxr-xr-x  3 samuelwaang samuelwaang   4096 Aug 26 10:33 images
-rw-r--r--  1 samuelwaang samuelwaang     91 Aug 26 10:33 index.html

lists files in a folder

cd $posts
pwd 
ls -l
/home/samuelwaang/vscode/samuel/_posts
total 12
-rwxr-xr-x 1 samuelwaang samuelwaang 1966 Aug 20 13:49 2020-01-14-test-markdown-post.md
-rw-r--r-- 1 samuelwaang samuelwaang  181 Aug 26 10:33 2022-08-19-random-post.md
-rw-r--r-- 1 samuelwaang samuelwaang  720 Aug 20 13:49 README.md

prints what's in the file

cat README.md
⚠️ Do not delete this directory!  You can delete the blog post files in this directory, but you should still keep this directory around as Jekyll expects this folder to exist.

# Auto-convert markdown files To Posts

[`fastpages`](https://github.com/fastai/fastpages) will automatically convert markdown files saved into this directory as blog posts!

You must save your notebook with the naming convention `YYYY-MM-DD-*.md`.  Examples of valid filenames are:

```shell
2020-01-28-My-First-Post.md
2012-09-12-how-to-write-a-blog.md
```

# Resources

- [Jekyll posts](https://jekyllrb.com/docs/posts/)
- [Example markdown post](https://github.com/fastai/fastpages/blob/master/_posts/2020-01-14-test-markdown-post.md)

Hack

checks for python modules

test="python"
check=`conda list | grep $test`
n=${#check}

if [[ ${n} > 0 ]]; 
then
    echo "$check"
else 
    echo "$test not found"
fi
ipython                   8.2.0            py39h06a4308_0  
ipython_genutils          0.2.0              pyhd3eb1b0_1  
msgpack-python            1.0.2            py39hff7bd54_1  
python                    3.9.12               h12debd9_0  
python-dateutil           2.8.2              pyhd3eb1b0_0  
python-fastjsonschema     2.15.1             pyhd3eb1b0_0  
python-libarchive-c       2.9                pyhd3eb1b0_1  
python-lsp-black          1.0.0              pyhd3eb1b0_0  
python-lsp-jsonrpc        1.0.0              pyhd3eb1b0_0  
python-lsp-server         1.2.4              pyhd3eb1b0_0  
python-slugify            5.0.2              pyhd3eb1b0_0  
python-snappy             0.6.0            py39h2531618_3  

Install java kernel if missing

test="java"
check=`jupyter kernelspec list | grep $test`
n=${#check}

if [[ ${n} > 0 ]]; 
then
    echo "$test is already installed"
else 
    wget https://github.com/SpencerPark/IJava/releases/download/v1.3.0/ijava-1.3.0.zip
    unzip ijava-1.3.0.zip
    python install.py
    echo "$test has been installed"
fi
java is already installed

Update Repository

echo "pulling..."
git pull
pulling...
Already up to date.
echo "committing..."
git commit -a -m "New Commit"
committing...
[master 50861e6] New Commit
 1 file changed, 3 insertions(+), 3 deletions(-)