or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
RSLondon Software Carpentry 2020-11-25/27
General information
This collaborative document (hackmd) is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Guides to tools we will use
Pre-workshop Questionnaire
Sessions
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →(👨🏫 - instructor; 🧚 - helpers; )
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Breakout groups for Thursday (Python 1):
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Breakout groups for Friday (Python 2):
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →New attendees - please add your name below:
The Unix Command line - Chris Cave-Ayland
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →ls
shows the filesls -F
shows also a trailing slash for the directories (useful if you've haven't got them already in a different colour).-F
is an "option".ls -F /
shows what's under the/
directory.ls --help
shows us how to use it! (a bit cryptic though)[OPTION]...
You can provide options,[]
means they are optional, the `[FILE]...
we can ask for a location or many as we want and they are optional.-a
=--all
man ls
is similar to the help output. You need to press q to exit. The output is clear out from the screen.-s
and-S
are different things.pwd
print working directory; first/
in the output is called the root directory, the base of all the directories.cd Desktop
moves your location to the Desktop directory~
is a short for/home/username
, your Home- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Paths:
/home/user/Desktop/data-shell
data-shell
..
: refers to the parent directory.
: refers to the current directorynano
open a text editor within the shell. ctrl+x to exit.cp
copies (and renames if needed) something into somewherecp quotes.txt thesis/quotations.txt
cp -r
to copy a directoryrm
to delete (remove) files.- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →rm -r
will allow you to delete directoriesrm -i
will ask you for confirmation before deleting stuff.wc
count characters, words and lines>
is use to redirect the output of a command into a filecat
to display files on the screensort
to sort a file,-n
to sort numerically.head
shows the first few lines of the file,-n 1
will only show the first line.tail
likehead
but for the end of the file|
(pipe) is use to redirect the output of one command as input for the next (wc -l *pdb | sort -n | head -n 1
will give the file with the smaller number of lines named...pdb
)for loops, to repeat an action over multiple files.
scripts, files that we put the commands we want to run in sequence. Normally called as
some_meaningful_name.sh
.$@
within the script, it will read all the arguments you pass from the command line.example:
history
shows you all the commands you've run.tab will try to autocomplete the files and directory names.
ctrl+c is used to cancel what you are running.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Here you can post any question you have while we are going through this document. Please, use a new bullet point for each question and sub-bullet points for their answers.
For example writing like this:
produces the following result:
Example question
What's the difference between git bash and git cmd?
Is the sorting (when using
ls
) displayed in vertical or horizontal order?What if I wanted only the name itself without the first bit of the line (CLASSIFICATION:)?
creatures
directory:for filename in *.dat; do head -n 2 $filename | tail -n 1; done
As highlighted in the Zoom chat, this is beyond the scope of today's session so we haven't covered the additional commands that can help with this. As with many command line tasks, there are a few different ways to achieve this. Some options might be the use of the
cut
command orawk
command.awk
can be particularly confusing to work with but it's worth checking out the man page nonetheless.cut
,-d
for delimeter and-f
for the field you want to show:- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Tell us at least one good thing and something we could improve by leaving feedback as post-its on this interactive board.
Version Control with Git - Iain Barrass
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Software Carpentry lesson material for GitHub Remotes: http://swcarpentry.github.io/git-novice/07-github/index.html
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Tell us at least one good thing and something we could improve by leaving feedback as post-its on this interactive board.
Python - day 1 - Iain Stenson
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Download python-novice-inflammation-data.zip.
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Exercises
Exercise Session 1
You can find tips or answers to most exercises in the lesson notes.
1.
What values do the variables mass and age have after each of the following statements? Test your answer by executing the lines.
2.
What does the following program print out?
Exercise Session 2
A section of an array is called a slice. We can take slices of character strings as well:
Exercise Session 3
Why do all of our plots stop just short of the upper end of our graph? Can we adjust the y limit of our graph so that it looks better?
Can you create your own graph of the standard deviation using
Exercise Session 4
1.
Python has a built-in function called
range
that generates a sequence of numbers.range
can accept 1, 2, or 3 parameters. If one parameter is given, range generates a sequence of that length, starting at zero and incrementing by 1. For example,range(3)
produces the numbers 0, 1, 2. If two parameters are given, range starts at the first and ends just before the second, incrementing by one. For example,range(2, 5)
produces 2, 3, 4. Ifrange
is given 3 parameters, it starts at the first one, ends just before the second one, and increments by the third one. For example,range(3, 10, 2)
produces 3, 5, 7, 9. Usingrange
, write a loop that prints the first 3 natural numbers:2.
Given the following loop, how many times is
print
called? 3, 4, 5, or 6 times?3.
Exponentiation is built into Python and is done with
**
.Can you calculate 5 to the power 3 using multiplication (
*
) and loops instead of the**
operator?- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Tell us at least one good thing and something we could improve by leaving feedback as post-its on this interactive board.
Good things
Things to improve
Python - day 2 - Tom Dowrick
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Use a for-loop to convert the string "hello" into a list of letters:
Exercise 2
Plot the difference between the average inflammations reported in the first and second datasets (stored in inflammation-01.csv and inflammation-02.csv, correspondingly), i.e., the difference between the leftmost plots of the first two figures.
Don't need to use for loops.
Exercise 3
What would be printed if you run this code?
Exercise 4
Write a function that takes a string, and returns the first and last character.
Exercise 5
Write a command line application that takes a string and two numbers, and outputs those two characters from the string.
e.g. hello 1 3
hl
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →Tell us at least one good thing and something we could improve by leaving feedback as post-its on this interactive board.
tags:
swc
teaching
live-notes