Last active
July 31, 2022 15:37
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to execute the
makecommand 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: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:
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:
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:
You are to now to install r-rmarkdown and r-reticulate in the directory;
We then run the make command:
After doing that, on the keyboard, use keyboard combinations,
Ctrl O
to open the document on MOzilla Firefox in html form.r markdown
makes use of the pandoc to change the form of the file.Name: Awotunde Gideon Oyetunji
Neptun Code: YJNUMT