Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CSL and docker information. #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
280 changes: 280 additions & 0 deletions thesis/bibliography/american-chemical-society.csl
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" page-range-format="expanded" default-locale="en-US">
<info>
<title>American Chemical Society</title>
<title-short>ACS</title-short>
<id>http://www.zotero.org/styles/american-chemical-society</id>
<link href="http://www.zotero.org/styles/american-chemical-society" rel="self"/>
<link href="https://pubs.acs.org/doi/full/10.1021/acsguide.40303" rel="documentation"/>
<link href="https://pubs.acs.org/doi/book/10.1021/acsguide" rel="documentation"/>
<author>
<name>Julian Onions</name>
<email>julian.onions@gmail.com</email>
</author>
<contributor>
<name>Ivan Bushmarinov</name>
<email>ib@ineos.ac.ru</email>
</contributor>
<contributor>
<name>Sebastian Karcher</name>
</contributor>
<category citation-format="numeric"/>
<category field="chemistry"/>
<summary>The American Chemical Society style</summary>
<updated>2021-05-22T12:00:00+00:00</updated>
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
<locale xml:lang="en">
<terms>
<term name="editortranslator" form="short">
<single>ed. and translator</single>
<multiple>eds. and translators</multiple>
</term>
<term name="translator" form="short">
<single>translator</single>
<multiple>translators</multiple>
</term>
<term name="collection-editor" form="short">
<single>series ed.</single>
<multiple>series eds.</multiple>
</term>
</terms>
</locale>
<macro name="editor">
<group delimiter="; ">
<names variable="editor translator" delimiter="; ">
<name sort-separator=", " initialize-with=". " name-as-sort-order="all" delimiter=", " delimiter-precedes-last="always"/>
<label form="short" prefix=", " text-case="title"/>
</names>
<names variable="collection-editor">
<name sort-separator=", " initialize-with=". " name-as-sort-order="all" delimiter=", " delimiter-precedes-last="always"/>
<label form="short" prefix=", " text-case="title"/>
</names>
</group>
</macro>
<macro name="author">
<names variable="author" suffix=".">
<name sort-separator=", " initialize-with=". " name-as-sort-order="all" delimiter="; " delimiter-precedes-last="always"/>
<label form="short" prefix=", " text-case="capitalize-first"/>
</names>
</macro>
<macro name="publisher">
<choose>
<if type="thesis" match="any">
<group delimiter=", ">
<text variable="publisher"/>
<text variable="publisher-place"/>
</group>
</if>
<else>
<group delimiter=": ">
<text variable="publisher"/>
<text variable="publisher-place"/>
</group>
</else>
</choose>
</macro>
<macro name="title">
<choose>
<if type="bill book graphic legal_case legislation motion_picture report song" match="any">
<text variable="title" text-case="title" font-style="italic"/>
</if>
<else>
<text variable="title" text-case="title"/>
</else>
</choose>
</macro>
<macro name="volume">
<group delimiter=" ">
<text term="volume" form="short" text-case="capitalize-first"/>
<text variable="volume"/>
</group>
</macro>
<macro name="series">
<text variable="collection-title"/>
</macro>
<macro name="pages">
<label variable="page" form="short" suffix=" " strip-periods="true"/>
<text variable="page"/>
</macro>
<macro name="book-container">
<group delimiter=". ">
<text macro="title"/>
<choose>
<if type="entry-dictionary entry-encyclopedia" match="none">
<group delimiter=" ">
<text term="in" text-case="capitalize-first"/>
<text variable="container-title" font-style="italic"/>
</group>
</if>
<else>
<text variable="container-title" font-style="italic"/>
</else>
</choose>
</group>
</macro>
<macro name="issued">
<date variable="issued" delimiter=" ">
<date-part name="year"/>
</date>
</macro>
<macro name="full-issued">
<date variable="issued" delimiter=" ">
<date-part name="month" form="long" suffix=" "/>
<date-part name="day" suffix=", "/>
<date-part name="year"/>
</date>
</macro>
<macro name="edition">
<choose>
<if is-numeric="edition">
<group delimiter=" ">
<number variable="edition" form="ordinal"/>
<text term="edition" form="short"/>
</group>
</if>
<else>
<text variable="edition" suffix="."/>
</else>
</choose>
</macro>
<citation collapse="citation-number">
<sort>
<key variable="citation-number"/>
</sort>
<layout delimiter="," vertical-align="sup">
<text variable="citation-number"/>
</layout>
</citation>
<bibliography second-field-align="flush" entry-spacing="0">
<layout suffix=".">
<text variable="citation-number" prefix="(" suffix=") "/>
<text macro="author" suffix=" "/>
<choose>
<if type="article-journal review" match="any">
<group delimiter=" ">
<text macro="title" suffix="."/>
<text variable="container-title" font-style="italic" form="short"/>
<group delimiter=", ">
<text macro="issued" font-weight="bold"/>
<choose>
<if variable="volume">
<group delimiter=" ">
<text variable="volume" font-style="italic"/>
<text variable="issue" prefix="(" suffix=")"/>
</group>
</if>
<else>
<group delimiter=" ">
<text term="issue" form="short" text-case="capitalize-first"/>
<text variable="issue"/>
</group>
</else>
</choose>
<text variable="page"/>
</group>
</group>
</if>
<else-if type="article-magazine article-newspaper article" match="any">
<group delimiter=" ">
<text macro="title" suffix="."/>
<text variable="container-title" font-style="italic" suffix="."/>
<text macro="edition"/>
<text macro="publisher"/>
<group delimiter=", ">
<text macro="full-issued"/>
<text macro="pages"/>
</group>
</group>
</else-if>
<else-if type="thesis">
<group delimiter=", ">
<group delimiter=". ">
<text macro="title"/>
<text variable="genre"/>
</group>
<text macro="publisher"/>
<text macro="issued"/>
<text macro="volume"/>
<text macro="pages"/>
</group>
</else-if>
<else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
<group delimiter="; ">
<group delimiter=", ">
<text macro="title"/>
<text macro="edition"/>
</group>
<text macro="editor" prefix=" "/>
<text macro="series"/>
<choose>
<if type="report">
<group delimiter=" ">
<text variable="genre"/>
<text variable="number"/>
</group>
</if>
</choose>
<group delimiter=", ">
<text macro="publisher"/>
<text macro="issued"/>
</group>
<group delimiter=", ">
<text macro="volume"/>
<text macro="pages"/>
</group>
</group>
</else-if>
<else-if type="patent">
<group delimiter=", ">
<group delimiter=". ">
<text macro="title"/>
<text variable="number"/>
</group>
<date variable="issued" form="text"/>
</group>
</else-if>
<else-if type="chapter paper-conference entry-dictionary entry-encyclopedia" match="any">
<group delimiter="; ">
<text macro="book-container"/>
<text macro="editor"/>
<text macro="series"/>
<group delimiter=", ">
<text macro="publisher"/>
<text macro="issued"/>
</group>
<group delimiter=", ">
<text macro="volume"/>
<text macro="pages"/>
</group>
</group>
</else-if>
<else-if type="webpage">
<group delimiter=" ">
<text variable="title"/>
<text variable="URL"/>
<date variable="accessed" prefix="(accessed " suffix=")" delimiter=" ">
<date-part name="year"/>
<date-part name="month" prefix="-" form="numeric-leading-zeros"/>
<date-part name="day" prefix="-" form="numeric-leading-zeros"/>
</date>
</group>
</else-if>
<else>
<group delimiter=", ">
<group delimiter=". ">
<text macro="title"/>
<text variable="container-title" font-style="italic"/>
</group>
<group delimiter=", ">
<text macro="issued"/>
<text variable="volume" font-style="italic"/>
<text variable="page"/>
</group>
</group>
</else>
</choose>
<text variable="DOI" prefix=". https://doi.org/"/>
</layout>
</bibliography>
</style>
57 changes: 56 additions & 1 deletion tips/05_tipsandtricks.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,62 @@ The `main.yaml` file in the ThesisIsCode repository, and the actions that we per

## Docker

SJG - Make sure you do something here before you play Mario Kart 8.
### Improving your workflow with Docker

[Docker](https://www.docker.com/) is a containerization tool. We can think of Docker as another computer inside your computer. What does this mean? We will make a self-contained computing *environment*, separate from your OS (Mac, Windows, Linux) that will be portable and lightweight. It also makes sure that any program dependencies won't conflict with programs you have running on your computer now, and because you can share the Docker *images*, your collaborators can easily set up a container on their computer with the same settings as yours.

Docker allows us to create *containers*. A *container* is an *instance* of an *image*. A `Dockerfile` defines the contents of the image. A `Dockerfile` is a plain text file that contains a set of instructions to build an image. With a valid `Dockerfile` we can run the command `docker build` to create the container on our computer. The image can then be deployed or transported to any platform since it is self-contained and run as a container (`docker run`).

Although you can create your own image, there are pre-built images available from several locations such as [DockerHub](https://hub.docker.com/). Let’s check out the [`Rocker` project RStudio image](https://hub.docker.com/r/rocker/rstudio) to run RStudio (without installing it) from a browser.

The DockerHub page of the Rocker project lists all available Rocker repositories. Let’s pull the `rocker`/`RStudio` image from DockerHub by executing the following command in the terminal:

```bash
docker pull rocker/rstudio
```

This will pull the RStudio image from the Rocker DockerHub repository. We can run a container based on this image by typing the following into the terminal:

```bash
docker run -d -p 8787:8787 -v $(pwd):/home/rstudio -e PASSWORD=yourpasswordhere rocker/rstudio
```

You are now running RStudio inside a Docker container! We need to access the browser to start using RStudio.

You will be required to have username & password credentials.

For username use: rstudio <- cannot be changed
For password use: yourpasswordhere <- change this as you wish

What do the `-p` and `-v` flags mean?

* `-v` : A “volume” has been mounted. This means that usually, all work that you did in a container would be lost once the container stopped. This -v will help you save your work in your local machine. $(pwd) means it will be saved in the current working directory.
* `-p` : This is the port that you need to specify where you will be working. Since we specified that we wanted to use port 8787 in our command line, we need to go to:
http://localhost:8787/

(The `-e` flag is a personalized flag defined by the operator, in this case it is to pass a password which is a requirement to run the RStudio image)

Congratulations! You can work in a containerized version of R!

### Why is this useful?

Imagine that you have to run your thesis on a different computer. You would need to download not only R but all the other packages/dependencies that you used for your thesis. With containerization, you could build an image and download that image as needed.

Once you have finished the project, do not forget to close the container. To do this, you first need to find the name of the container:

```bash
docker ps
```

A list will pop up and you can just then close the container by typing:

```bash
docker stop <name of container>
```

To learn more! You can create your own images by writing Dockerfiles.
Learn how to write one here:
https://www.statworx.com/at/blog/running-your-r-script-in-docker/#:~:text=need%20a%20Dockerfile.-,The%20Dockerfile,-With%20a%20Dockerfile

## Secrets (shhh!)

Expand Down