Skip to content

Instantly share code, notes, and snippets.

@jeszy75
Last active July 31, 2022 15:37
Show Gist options
  • Save jeszy75/a8ce4e2ef55f1d13c1224fbb3d7d4a82 to your computer and use it in GitHub Desktop.
Save jeszy75/a8ce4e2ef55f1d13c1224fbb3d7d4a82 to your computer and use it in GitHub Desktop.
Bash script for creating a new gist on the command line with HTTPie.
#!/bin/bash
if [ "$#" -ne 3 ]; then
echo "Usage: $(basename $0) <filename> <description> <username>"
exit
fi
filename=$1
description=$2
username=$3
if [ ! -f $filename ]; then
echo "File does not exist"
exit
fi
escape_json() {
sed 's/\\/\\\\\\\\/g;s/"/\\"/g;s/\t/\\t/g' | sed ':a;N;$!ba;s/\n/\\n/g'
}
content=$(cat $1 | escape_json)
http https://api.github.com/gists public:=true description="$description" files:="{\"$(basename $filename)\": {\"content\": \"$content\"}}" -a $3 -v
@gideonawotunde
Copy link

How to execute the make command successfully.

To do this, we shall have to install conda, and I believe it has already been installed, and if it has not, you can go to Miniconda's page, and install the required version.
If you are using a Linux or MacOS system, i believe that you have Bash installed on your system.

We first create an environment called, markdown2 as we are using R and after that we activate it after. We do this by:

        conda create -a rmarkdown2 r-base=4.1.1
        conda activate rmarkdown2

Installation using Conda in Terminal


While using the conda environment, you have to enable the conda forge channel, to install all required packages. To do that, you must input the following command:

    conda config --add channels conda-forge
    conda config --set channel_priority strict

You can now start to install any softwares in conda enironment you want with:
conda install <package-name>

For the necessary packages, for now, we will be installing in terminal, Git, Make, Pandoc, and we will use the following commands:

            conda install make
            conda install git
            conda install pandoc

Cloning the Repository

After installing the above packages, you are now expexted to clone a git hub repository. To do this, first you have to copy the url of the repository and then, you go to visual studio, go to view, then command pallete, then type "Git: " and you see an option, "Git: Clone" and then you paste in the url.

We clone by using:
git clone https://github.com/jeszy75/rmarkdown-examples

The pallete input will switch, asking for the root directory where you want the clone to be placed. Enter the new directory, and input the path, and after this, you have successfully cloned your repository.

After cloning the repository, you open terminal, and open the directory of the cloned repository using the command:

                cd rmarkdown-examples

You are to now to install r-rmarkdown and r-reticulate in the directory;

             conda install r-rmarkdown
             conda install r-reticulate

We then run the make command:

        cd rmarkdown-examples/html_document/python 
        make

After doing that, on the keyboard, use keyboard combinations, Ctrl O to open the document on MOzilla Firefox in html form.

  • The r markdown makes use of the pandoc to change the form of the file.

Name: Awotunde Gideon Oyetunji

Neptun Code: YJNUMT


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment