Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • R3/school/courses
  • vilem.ded/courses
  • todor.kondic/courses
  • noua.toukourou/courses
  • nene.barry/courses
  • laurent.heirendt/courses
  • marina.popleteeva/courses
  • jenny.tran/courses
8 results
Show changes
Commits on Source (1017)
Showing
with 478 additions and 129 deletions
<html>
<head>
<meta http-equiv="refresh" content="0; url=https://r3school.pages.uni.lu/git.slides/stable"/>
</head>
<body>
</bod>
</html>
{
"directory": "bower_components"
}
<div id="lap-cookies-banner" class="presentation-banner">
<div class="banner-intro">
<div class="close-button">
<a class="lap-refuse">
<i class="fa fa-times" aria-hidden="true"></i>
</a>
</div>
<div class="banner-img">
<img src="https://analytics.lcsb.uni.lu/lap/static/logos/r3-logo.svg" type="image/svg+xml"/>
</div>
<div class="banner-title">This website needs some cookies and similar means to function.</div>
<div class="banner-text">If you permit us, we will use those means to collect data on your visits for aggregated
statistics to improve our service.
</div>
</div>
<div class="banner-buttons">
<a class="btn lap-accept">Accept cookies for aggregated statistics</a>
<a class="btn lap-refuse">No thanks, only technically necessary cookies</a>
<a class="btn lap-cookies-more" href="https://courses.lcsb.uni.lu/privacy-policy">More information</a>
</div>
</div>
\ No newline at end of file
<script>
const settings = {
expires: "180",
matomoURL: "https://analytics.lcsb.uni.lu/hub/",
siteID: "8", //you get this siteID by sending an email to lcsb-r3@uni.lu
accept_all_text: "Aggregate statistics cookies accepted",
only_necessary_text: "Only necessary cookies accepted",
doNotTrack_text: "Do Not Track is enabled",
cookieName: "lap",
bots: /bot|crawler|spider|crawling/i,
timeout_hidebanner: "500",
cookieDomain: "courses.lcsb.uni.lu"
};
</script>
<script src="https://analytics.lcsb.uni.lu/lap/static/js/jquery.min.js"></script>
<script src="https://analytics.lcsb.uni.lu/lap/static/js/lap.js"></script>
<link rel="stylesheet" type="text/css" href="https://analytics.lcsb.uni.lu/lap/static/css/lap.css" />
<div class="bottomPrivacy">
<a href="https://courses.lcsb.uni.lu/privacy-policy">Privacy Policy</a>
(<span id="doNotTrack-text"><span id="gdpr-result-text"></span> - <a href="javascript: showBanner();">change</a></span>)
</div>
\ No newline at end of file
#!/bin/bash
PAGEURL="https://courses.lcsb.uni.lu"
rootDir=$(pwd)
echo $rootDir
# clean previous builds
rm -rf $rootDir/public
rm -rf $rootDir/theme
mkdir $rootDir/public
if [[ $CI_COMMIT_REF_NAME == "develop" ]]; then
version="latest";
elif [[ $CI_COMMIT_REF_NAME == "master" ]]; then
version="stable";
else
version="unstable";
fi
# build the unstable version - can be optimized
git submodule update --init --recursive
# add matomo
sed -i "/matomohead/r./.ci/analytics/head.html" theme/templates/_index.html
sed -i "/matomopolicy/r./.ci/analytics/policy.html" theme/templates/_index.html
sed -i "/matomobanner/r./.ci/analytics/gdpr-banner.html" theme/templates/_index.html
echo " > LAP included"
# loop through all the presentations
nBlades=0
for d in $(find . -maxdepth 1 -type d)
do
if [[ "${d}" == *20* ]]; then
pushd "${d}"
echo "changed to ${d}"
for d1 in $(find . -maxdepth 1 -type d)
do
if [[ ${#d1} -ge 2 ]]; then
let "nBlades+=1"
BLADE=${d1:2}
echo " > -----------------------------------------------------"
echo "Building ... ${d1}"
# create the required folders in public
mkdir -p $rootDir/public/$BLADE/$version
echo "going to $BLADE..."
pushd $BLADE
# run contribute
cp -v ../../template/Gruntfile.coffee .
ln -sv ../../theme/package.json package.json
ln -sv ../../theme theme
# install npm
echo "installing deps"
yarn add grunt-cli generator-reveal grunt
yarn install
echo "running dist"
yarn exec grunt dist
echo "copying to common public dir"
cp -rLv public/* $rootDir/public/$BLADE/$version/.
echo " > latest built for file set ${BLADE}"
# auto redirect file to the stable version
echo '<html>\n
<head>\n
<meta http-equiv="refresh" content="0; url='$PAGEURL'/'$BLADE'/stable"/>\n
</head>\n
<body>\n
</bod>\n
</html>\n' > $rootDir/public/$BLADE/index.html
echo "autoredirect file set"
# move back out
popd
echo " > -----------------------------------------------------"
fi
done
popd
fi
done
#!/bin/bash
if [[ $1 = "-i" ]]; then
echo "Install from scratch"
npm install -g npm@latest grunt-cli generator-reveal
npm install
git submodule update --init
else
echo "Install already performed. Only watching."
fi
grunt server
import os, re
from os import path
def build_link(title, href):
return f'- <a href="{href}">{title}</a>\n'
def build_section_start(title):
return f'\n' #<h3>{title}</h3>\n
def build_section_end():
return "" #\t\t</ul>\n\t</div>
def camel_to_snake(name):
name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).lower()
# loop through the entire internal tree
localroot = os.getcwd()
# generate the index properly speaking
cardDirs = ["2023", "2022", "2021", "2020", "2019"]
index=''
# determine first the directories
for direct in cardDirs:
if path.isdir(direct):
dirs = os.listdir(direct)
dirs.sort(reverse=True);
index += "\n# " + direct + "\n\n"
for d in dirs:
if d[0] != ".":
href = 'https://courses.lcsb.uni.lu/'+d
linkText = camel_to_snake(d)
linkText = linkText.replace("_", " ")
linkText = linkText.title()
# special rules
linkText = linkText.replace("Dm", "Data Management")
linkText = linkText.replace("It", "IT")
linkText = linkText.replace("Siu", "SIU")
index += build_link(linkText, href)
# output the index
print(index)
# Read in the file
repoName = "courses.lcsb.uni.lu"
os.chdir(repoName)
indexFile = "index.md"
filedata = ""
with open(indexFile, 'r') as file :
for line in file:
filedata += line
# stop reading once the index place holder has been reached
if re.search("<!-- index -->", line):
filedata += "[[ index ]]"
break
# Replace the target string
filedata = filedata.replace('[[ index ]]', index)
# Write the file out again
with open(indexFile, 'w') as file:
file.write(filedata)
print("\n > New index generated and saved in " + indexFile)
os.chdir("..")
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
*.psd filter=lfs diff=lfs merge=lfs -text
*.mov filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.ai
site/
courses.lcsb.uni.lu
index.html index.html
package-lock.json package-lock.json
dist/ dist/
...@@ -8,3 +11,16 @@ dist ...@@ -8,3 +11,16 @@ dist
.sass-cache .sass-cache
.grunt .grunt
.DS_Store .DS_Store
yarn.lock
stable/
latest/
Gruntfile.coffee
!template/Gruntfile.coffee
package.json
!template/package.json
20*/*/theme
!./theme
./theme/package.json
__pycache__/
contribute.egg-info/
.*.swp
image: digitallyseamless/nodejs-bower-grunt stages:
- retrieve
- generate
- build
- deploy
pages: retrieve:repo:
stage: deploy image:
only: name: alpine/git:latest
- develop entrypoint: [""]
- master stage: retrieve
script: script:
# install npm - git clone https://$CI_DEPLOY_TOKEN:$CI_DEPLOY_PASSWORD@git-r3lab.uni.lu/R3/school/courses.lcsb.uni.lu.git
- npm install -g npm@latest yo grunt-cli generator-reveal bower artifacts:
- npm install expire_in: 1 day
paths:
# build the master version into stable - courses.lcsb.uni.lu
- git fetch --tags rules:
- latestTag=$(git describe --tags `git rev-list --tags --max-count=1`) - if: $CI_COMMIT_BRANCH == "develop"
- git checkout $latestTag - if: $CI_COMMIT_BRANCH == "master"
- grunt dist
- mkdir stable
- mv public/* stable/.
# build the develop version into latest
- git checkout -f develop
- git fetch origin develop
- git reset --hard origin/develop
- grunt dist
- mkdir latest
- mv public/* latest/.
# deploy the stable and latest directories generate:index:
- mv stable public/. image: python
- mv latest public/. stage: generate
rules:
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_BRANCH == "master"
script:
- python .ci/generateIndex.py
artifacts:
expire_in: 1 day
paths:
- courses.lcsb.uni.lu
# auto redirect file build:website:
- cp .autoRedirect public/index.html image: git-r3lab.uni.lu:4567/r3/docker/jekyll-lcsb
stage: build
rules:
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_BRANCH == "master"
before_script:
- cd courses.lcsb.uni.lu
- gem install bundler -v2.0.2
- bundle install && bundle update jekyll-theme-lcsb-default && bundle update jekyll-theme-lcsb-frozen-components
- cd ..
script:
- cd courses.lcsb.uni.lu
- bundle exec jekyll build -d site --config "_config.yml"
- mv site ../.
- cd ..
artifacts:
expire_in: 1 day
paths:
- site
variables:
JEKYLL_ENV: production
build:courses:
image: node:19-bullseye
stage: build
rules:
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_BRANCH == "master"
script:
- bash .ci/deploy.sh
artifacts: artifacts:
expire_in: 1 day
paths: paths:
- public - public
upload:
stage: deploy
image: alpine
before_script:
- apk add rsync
- 'which ssh-agent || ( apk add --update openssh )'
- eval $(ssh-agent -s)
- echo "$B64SSHPRIVKEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- 'echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- echo "$KNOWNHOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
rules:
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_BRANCH == "master"
script:
- rsync -ravu --info=progress2 -e "ssh -p $SSHPORT" site/* $SSHCONNECT:~/web/latest
- rsync -ravu --info=progress2 -e "ssh -p $SSHPORT" public/* $SSHCONNECT:~/web/latest
[submodule "theme"]
path = theme
url = https://gitlab.lcsb.uni.lu/R3/outreach/theme.git
{
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 4,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"white": true
}
{
"generator-reveal": {
"presentationTitle": "Basic GIT Training",
"packageVersion": "0.0.1",
"useSass": false
}
}
# Best practices
* `pull` before `push`
* Work on your <font color="red">own</font> branch (in your own fork), and **not** on `master` and **not** on `develop`
* Do **not push** to `master`, but **submit a PR**
* Get your code **reviewed** by your peers (submit a PR!)
* Submit a PR **often**!
* `clone` a repository, do not download the `.zip` file.
* Do **not** combine `git` commands
```bash
$ git commit -am "myMessage" # do not do this
```
* Stage only 1 file at once using
```bash
$ git add myFile.md
```
* Commit **only a few files** at once (after multiple separate `git add` commands)
* `Push` often - avoid conflicts
Remember: **A `push` a day keeps conflicts away!**
## Development scheme # Development scheme
<br>
Generally, in a repository, there are guidelines for contributing. Generally, in a repository, there are guidelines for contributing.
<div class="fragment"> <div class="fragment">
<br>
A common development scheme is dual with a: A common development scheme is dual with a:
- **development** version of the code on `develop` - **development** version of the code on `develop`
- **stable** version of the code on `master` - **stable** version of the code on `master`
<br>
A **version** of the code is referred to as a **branch**. A **version** of the code is referred to as a **branch**.
<div class="fragment"> <div class="fragment">
<br><br>
<img src="img/icon-live-demo.png" height="100px"> <img src="slides/img/icon-live-demo.png" height="100px">
<br>
<font color="red">In the practice repository, the development branch is called `develop`!</font> <font color="red">In the practice repository, the development branch is called `develop`!</font>
<div class="fragment"> <div class="fragment">
<br>
![bulb](img/bulb.png) Use this dual development scheme for your own repositories! ![bulb](slides/img/bulb.png) Use this dual development scheme for your own repositories!
## Branches
# Branches
A **version** of the code (i.e., a **branch**) is made up of a sequence of code changes. A **version** of the code (i.e., a **branch**) is made up of a sequence of code changes.
<div class="fragment"> <div class="fragment">
<br>
These individual code changes are called **commits**. These individual code changes are called **commits**.
For instance, the `master` and `develop` branches can be represented as a timeline: For instance, the `master` and `develop` branches can be represented as a timeline:
<img src="slides/img/branch-master.png" class="branch-master" height="500em"/>
<img src="img/branch-master.png" class="branch-master" />
## Switch between branches # Switch between branches
List all branches of the repository with List all branches of the repository with
```bash ```bash
$ git branch -a $ git branch -a
``` ```
Exit by typing `q`. The branch with the ***** is the current branch. Exit by typing `q`. The branch with the * is the current branch.
<div class="fragment"> <div class="fragment">
<br>
Checkout another branch Checkout another branch
```bash ```bash
$ git checkout branchName $ git checkout <branchName>
``` ```
<div class="fragment"> <div class="fragment">
<br>
You can switch to the `develop` branch with You can switch to the `develop` branch with
```bash ```bash
$ git checkout develop $ git checkout develop
``` ```
If the local branch does not exist but the remote does, it is created automatically.
<div class="fragment"> <div class="fragment">
<br>
<img src="img/icon-live-demo.png" height="100px"> <img src="slides/img/icon-live-demo.png" height="100px">
## Create your own version # Create your own version
Assume that you want to work on a function for adding 2 numbers. Assume that you want to work on a file:
<div class="fragment"> <div class="fragment">
<br>
<font color="red">Create a new **branch**!</font> <font color="red">Create a new **branch**!</font>
```bash ```bash
$ git checkout -b add-2-numbers $ git checkout -b myBranch
``` ```
The `-b` flag creates the branch. The `-b` flag creates the branch. Locally, you have your own version now:
<img src="slides/img/branch-create.png" class="branch-create" height="500em"/>
Locally, you have your own version now:
<img src="img/branch-create.png" class="branch-create" />
Push your version to your fork: Push your version to your fork:
```bash ```bash
$ git push origin add-2-numbers $ git push origin myBranch
``` ```
<br>
<div class="fragment"> <div class="fragment">
<br>
<img src="img/icon-live-demo.png" height="100px"> <img src="slides/img/icon-live-demo.png" height="100px">
## How do I start working on a repository? # How do I start working on a repository?
You have to `clone` it first: You have to `clone` it first:
...@@ -6,13 +6,9 @@ You have to `clone` it first: ...@@ -6,13 +6,9 @@ You have to `clone` it first:
$ git clone git@github.com:userName/myRepo.git myRepo $ git clone git@github.com:userName/myRepo.git myRepo
``` ```
<div class="fragment">
<br>
If you did not configure your SSH key, clone using HTTPS: If you did not configure your SSH key, clone using HTTPS:
```bash ```bash
$ git clone https://github.com/userName/myRepo.git myRepo $ git clone https://github.com/userName/myRepo.git myRepo
``` ```
<br>
<div class="fragment">
You will be prompted to enter your credentials. You will be prompted to enter your credentials.
## How to configure `git`? # How to configure `git`?
```bash ```bash
$ git config --global user.name "Firstname Lastname" $ git config --global user.name "Firstname Lastname"
$ git config --global user.email "first.last@uni.lu" $ git config --global user.email "first.last@uni.lu"
``` ```
## Test the configuration
Test whether your username and email have been registered Test whether your username and email have been registered
```bash ```bash
$ git config --list $ git config --list
``` ```
<br>
This should list the configuration with `user.name` and `user.email`. This should list the configuration with `user.name` and `user.email`.
<br>
Exit by typing `q`. Exit by typing `q`.
## What is an SSH key?
# What is an SSH key?
An SSH key is a secure access credential. An SSH key is a secure access credential.
<div class="fragment">
<br>
**Principle**: <br><br> **Principle**: <br><br>
Communicate **securely** with Github/Gitlab **without** entering the username/password. Communicate **securely** with Github/Gitlab **without** entering the username/password.
## How do I get and set my SSH key?
<br> # How do I get and set my SSH key?
Check if you already have an SSH key: Check if you already have an SSH key:
```bash ```bash
$ ls -al ~/.ssh $ ls -al ~/.ssh
``` ```
<br>
If there are 2 files named `id_rsa`, you have an SSH key. If there are 2 files named `id_rsa`, you have an SSH key.
<div class="fragment">
<br><br>
If you don’t have yet an SSH key, you have to generate one: If you don’t have yet an SSH key, you have to generate one:
```bash ```bash
$ ssh-keygen -t rsa # -b 4096 $ ssh-keygen -t rsa # -b 4096
``` ```
<br>
Then, add the SSH key to Github/Gitlab. Then, add the SSH key to Github/Gitlab.
<div class="fragment"> <img src="slides/img/icon-live-demo.png" height="100px">
<img src="img/icon-live-demo.png" height="100px"> \ No newline at end of file
\ No newline at end of file
## The 5 essential commands # The 5 essential commands
<br>
**Yes**, you only need 5 commands! **Yes**, you only need 5 commands!
<br>
`pull, status, add, commit, push` `pull, status, add, commit, push`
<br>
or in other words (remember these!): or in other words (remember these!):
```bash ```bash
$ git pull <remote> <branch> $ git pull <remote> <branch>
$ git status $ git status
$ git add myFile.txt # example $ git add myFile.md # example
$ git commit -m "myMessage" # example $ git commit -m "myMessage" # example
$ git push <remote> <branch> $ git push <remote> <branch>
``` ```
## Pull the latest version of an existing branch
Pull the latest revision on branch `add-2-numbers`: # Pull the latest version of an existing branch
Pull the latest revision on branch `myBranch`:
```bash ```bash
$ git pull origin add-2-numbers $ git pull origin myBranch
# Already up to date # Already up to date
``` ```
<div class="fragment"> <div class="fragment">
<br>
Verify its `status` with: Verify its `status` with:
```bash ```bash
$ git status $ git status
``` ```
## Modify a file
Modify and rename `addTwoNumbers.m` in the folder `src/firstCommit` as `addTwoNumbers_myName`: # Modify a file
Copy the file `template.md` in the folder `_attendees` and rename it with your firstname:
```bash ```bash
$ cd src/firstCommit $ cd _attendees
$ git mv addTwoNumbers_myName.m addTwoNumbers_laurent.m # replace myName $ cp template.md myName.md
``` ```
<br> Then, make your changes with your favorite editor!
Open the file using the `Visual Studio Code` editor (or any other editor)
and correct the line
```Matlab
c = a - b;
```
## Add your file to the stage # Add your file to the stage
First, check the repository status First, check the repository status
```bash ```bash
...@@ -58,62 +54,45 @@ $ git status ...@@ -58,62 +54,45 @@ $ git status
# uncommitted changes (displayed in red) # uncommitted changes (displayed in red)
``` ```
<div class="fragment">
<br>
**ADVANCED**: see your changes in the terminal
```bash
$ git diff
```
exit with `q`
<div class="fragment"> <div class="fragment">
<br>
Now, add the file (bring it on stage) Now, add the file (bring it on stage)
```bash ```bash
$ git add addTwoNumbers_laurent.m # replace myName $ git add myName.md # replace myName
$ git status $ git status
# returns the same as before, generally in green (means staged) # returns the same as before, generally in green (means staged)
``` ```
<div class="fragment">
**ADVANCED**: If there have been more changes after the file has been added, you can see your changes in the terminal
```bash
$ git diff
```
exit with `q`
## Add a commit message # Add a commit message
```bash ```bash
$ git commit -m "Correcting formula for adding 2 numbers" $ git commit -m "Add the profile of <myName>"
$ git status $ git status
``` ```
## Push your file to your fork
# Push your file to your fork
```bash ```bash
$ git push origin add-2-numbers $ git push origin myBranch
``` ```
<div class="fragment"> <div class="fragment">
<br>
**ADVANCED**: see the log of all the commits (and your last one) in the terminal **ADVANCED**: see the log of all the commits (and your last one) in the terminal
```bash ```bash
$ git log $ git log
``` ```
exit by typing `q` exit by typing `q`.
\ No newline at end of file
## Do it yourself
**Exercice 1:**
* Edit the test in `test/suite`
<div class="fragment">
<br>
<img src="img/icon-live-demo.png" height="100px">
<div class="fragment">
**Exercice 2:**
* Checkout a new branch named `multiply-2-numbers`
* Rename and modify `src/secondCommit/multiplyTwoNumbers_myName.m`
* Push the file `src/secondCommit/multiplyTwoNumbers_myName.m`
* Don't forget to edit <font color="red">`_myName`</font>
\ No newline at end of file