Skip to content

Commit c389789

Browse files
learn-linux-shell-iterm2: fix code block formatting
1 parent 89ac7af commit c389789

File tree

1 file changed

+66
-14
lines changed

1 file changed

+66
-14
lines changed

data/scorecards/learn-linux-shell-iterm2.yaml

Lines changed: 66 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,76 @@ evaluation:
1414
ladder:
1515
name: Default Ladder
1616
levels:
17-
- name: Incomplete
18-
rank: 1
19-
color: "#FF9E9E"
20-
- name: Completed
21-
rank: 2
22-
color: "#7CCB92"
17+
- name: Incomplete
18+
rank: 1
19+
color: "#FF9E9E"
20+
- name: Completed
21+
rank: 2
22+
color: "#7CCB92"
2323
rules:
24-
- title: Learned
25-
expression: "customEvents(lookback = duration(\"P10Y\"), types = [\"LEARN_CORTEX\"]).filter((event) => event.title == \"Learn Linux shell - iterm2\").length > 0"
26-
identifier: 921bc595-5a12-3aa1-af45-e17d17e0d649
27-
weight: 1
28-
level: Completed
29-
failureMessage: "# About\nIn this Learn Cortex scorecard you will:\n- install [iterm2](https://iterm2.com/), an alternate MacOS terminal program\n- add the CORTEX_API_KEY environment variable to your .bashrc file\n\n# Set up\n- [Download](https://iterm2.com/downloads/stable/latest) and install [iterm2](https://iterm2.com).\n- After installing, click on the iterm2 icon to launch the terminal.\n\n## Change the default SHELL to bash\nFrom [LinuxCommand.org](https://linuxcommand.org), the shell is a program that takes commands from the keyboard and gives them to the operating system to perform.\n\nThe default shell on MacOS is zsh. We are going to change it to bash because I'm most familiar with bash.\n\n- Type \n ```\n echo $SHELL\n ```\n and press return to see the name of the default shell.\n ```\n jeffschnitter@mac ~ $ echo $SHELL\n /bin/zsh\n ```\n- Type \n ```\n chsh -s /bin/bash\n ```\n to change the default shell to bash.\n\n You will be prompted to enter your Mac login password.\n\n ```\n jeffschnitter@mac ~ $ chsh -s /bin/bash\n Changing shell for jeffschnitter.\n Password for jeffschnitter:\n jeffschnitter@mac ~ $\n ```\n- Close iterm2 and reopen it.\n- Type `echo $SHELL` and press return to see the name of the default shell. It should be changed to /bin/bash.\n ```\n jeffschnitter@mac ~ $ echo $SHELL\n/bin/bash\n ```\n\n## Add your CORTEX_API_KEY variable to your .bashrc file\n\n- When your shell program is /bin/bash, any time you start a terminal window, a file in your home directory named .bashrc will get sourced, meaning all the shell commands in that file will get executed.\n\n- Your home directory is defined with an environment variable named $HOME. A shorthand way to refer to your home directory is to use the ~ character.\n ```\n jeffschnitter@mac ~ $ echo $HOME\n /Users/jeffschnitter\n jeffschnitter@mac ~ $ echo ~\n /Users/jeffschnitter\n ```\n\n- Therefore, we can refer to your .bashrc file in your home directory with both of these forms:\n - $HOME/.bashrc\n - ~/.bashrc\n\n- If you have not previously created a personal token, follow the directions at https://docs.cortex.io/settings/api-keys/personal-tokens#creating-a-personal-token. Save the contents of the key in your clipboard.\n\n- Paste the following contents (replace _yourApiKey_ with the contents of your personal token or API key) into your terminal and press enter.\n ````\n cat << EOF >> ~/.bashrc\n export CORTEX_API_KEY=_your API key_\n EOF\n ```\n- ~/.bashrc is sourced when you open a new terminal. Alternatively you can type \n ```\n source ~/.bashrc\n ```\n to source the command. Do one of these things to have the contents of your ~/.bashrc file re-evaluated.\n\n- Enter \n ```\n echo $CORTEX_API_KEY\n ```\n\n- You should see the contents of your API key on the terminal.\n ```\n jeffschnitter@mac ~ $ echo $CORTEX_API_KEY\n eyJhbGciOifYouCanReadThisYouAreTooCloseiJIUzUxMiIs\n jeffschnitter@mac ~ $\n ```\n\n\n## Further reading\n- [LinuxCommand.org](https://linuxcommand.org/)\n\n# Related Cortex Academy courses\nNone.\n\n# Task\nPaste the contents below into your shell and press enter. This will use the value of your CORTEX_API_KEY environment variable set in your ~/.bashrc file to authenticate with the Cortex API and create a custom event for the Learn Cortex entity.\n \n```\ncurl -X POST \"https://api.getcortexapp.com/api/v1/catalog/learn-cortex/custom-events\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer ${CORTEX_API_KEY}\" \\\n --data-binary @- <<EOF\n {\n \"customData\": {\n },\n \"description\": \"Custom event created from a terminal curl command\",\n \"timestamp\": \"$(date +'%Y-%m-%dT%H:%M:%S.%3Z')\",\n \"title\": \"Learn Linux Shell - iterm2\",\n \"type\": \"LEARN_CORTEX\"\n }\nEOF\n```\n\n\n# CQL Rule\nThe CQL checks to see if you have a Custom Event of type 'LEARN_CORTEX' with a title of \"Learn Linux Shell - iterm2\". You need to recreate this event every 10 years or else this rule will fail. :)\n"
24+
- title: Learned
25+
expression: "customEvents(lookback = duration(\"P10Y\"), types = [\"LEARN_CORTEX\"\
26+
]).filter((event) => event.title == \"Learn Linux shell - iterm2\").length > 0"
27+
identifier: 921bc595-5a12-3aa1-af45-e17d17e0d649
28+
weight: 1
29+
level: Completed
30+
failureMessage: "# About\nIn this Learn Cortex scorecard you will:\n- install [iterm2](https://iterm2.com/),\
31+
\ an alternate MacOS terminal program\n- add the CORTEX_API_KEY environment variable\
32+
\ to your .bashrc file\n\n# Set up\n- [Download](https://iterm2.com/downloads/stable/latest)\
33+
\ and install [iterm2](https://iterm2.com).\n- After installing, click on the\
34+
\ iterm2 icon to launch the terminal.\n\n## Change the default SHELL to bash\n\
35+
From [LinuxCommand.org](https://linuxcommand.org), the shell is a program that\
36+
\ takes commands from the keyboard and gives them to the operating system to perform.\n\
37+
\nThe default shell on MacOS is zsh. We are going to change it to bash because\
38+
\ I'm most familiar with bash.\n\n- Type \n ```\n echo $SHELL\n ```\n\
39+
\ and press return to see the name of the default shell.\n ```\n jeffschnitter@mac\
40+
\ ~ $ echo $SHELL\n /bin/zsh\n ```\n- Type \n ```\n chsh -s /bin/bash\n\
41+
\ ```\n to change the default shell to bash.\n\n You will be prompted\
42+
\ to enter your Mac login password.\n\n ```\n jeffschnitter@mac ~ $ chsh\
43+
\ -s /bin/bash\n Changing shell for jeffschnitter.\n Password for jeffschnitter:\n\
44+
\ jeffschnitter@mac ~ $\n ```\n- Close iterm2 and reopen it.\n- Type `echo\
45+
\ $SHELL` and press return to see the name of the default shell. It should be\
46+
\ changed to /bin/bash.\n ```\n jeffschnitter@mac ~ $ echo $SHELL\n /bin/bash\n\
47+
\ ```\n\n## Add your CORTEX_API_KEY variable to your .bashrc file\n\n- When\
48+
\ your shell program is /bin/bash, any time you start a terminal window, a file\
49+
\ in your home directory named .bashrc will get sourced, meaning all the shell\
50+
\ commands in that file will get executed.\n\n- Your home directory is defined\
51+
\ with an environment variable named $HOME. A shorthand way to refer to your\
52+
\ home directory is to use the ~ character.\n ```\n jeffschnitter@mac ~\
53+
\ $ echo $HOME\n /Users/jeffschnitter\n jeffschnitter@mac ~ $ echo ~\n \
54+
\ /Users/jeffschnitter\n ```\n\n- Therefore, we can refer to your .bashrc\
55+
\ file in your home directory with both of these forms:\n - $HOME/.bashrc\n\
56+
\ - ~/.bashrc\n\n- If you have not previously created a personal token, follow\
57+
\ the directions at https://docs.cortex.io/settings/api-keys/personal-tokens#creating-a-personal-token.\
58+
\ Save the contents of the key in your clipboard.\n\n- Paste the following contents\
59+
\ (replace _yourApiKey_ with the contents of your personal token or API key) into\
60+
\ your terminal and press enter.\n ```\n cat << EOF >> ~/.bashrc\n export\
61+
\ CORTEX_API_KEY=_your API key_\n EOF\n ```\n- ~/.bashrc is sourced when\
62+
\ you open a new terminal. Alternatively you can type \n ```\n source ~/.bashrc\n\
63+
\ ```\n to source the command. Do one of these things to have the contents\
64+
\ of your ~/.bashrc file re-evaluated.\n\n- Enter \n ```\n echo $CORTEX_API_KEY\n\
65+
\ ```\n\n- You should see the contents of your API key on the terminal.\n\
66+
\ ```\n jeffschnitter@mac ~ $ echo $CORTEX_API_KEY\n eyJhbGciOifYouCanReadThisYouAreTooCloseiJIUzUxMiIs\n\
67+
\ jeffschnitter@mac ~ $\n ```\n\n\n## Further reading\n- [LinuxCommand.org](https://linuxcommand.org/)\n\
68+
\n# Related Cortex Academy courses\nNone.\n\n# Task\nPaste the contents below\
69+
\ into your shell and press enter. This will use the value of your CORTEX_API_KEY\
70+
\ environment variable set in your ~/.bashrc file to authenticate with the Cortex\
71+
\ API and create a custom event for the Learn Cortex entity.\n \n```\ncurl -X\
72+
\ POST \"https://api.getcortexapp.com/api/v1/catalog/learn-cortex/custom-events\"\
73+
\ \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer\
74+
\ ${CORTEX_API_KEY}\" \\\n --data-binary @- <<EOF\n {\n \"customData\"\
75+
: {\n },\n \"description\": \"Custom event created from a terminal\
76+
\ curl command\",\n \"timestamp\": \"$(date +'%Y-%m-%dT%H:%M:%S.%3Z')\"\
77+
,\n \"title\": \"Learn Linux Shell - iterm2\",\n \"type\": \"LEARN_CORTEX\"\
78+
\n }\nEOF\n```\n\n\n# CQL Rule\nThe CQL checks to see if you have a Custom\
79+
\ Event of type 'LEARN_CORTEX' with a title of \"Learn Linux Shell - iterm2\"\
80+
. You need to recreate this event every 10 years or else this rule will fail.\
81+
\ :)\n"
3082
filter:
3183
kind: GENERIC
3284
types:
3385
include:
34-
- service
86+
- service
3587
groups:
3688
include:
37-
- learn-cortex
89+
- learn-cortex

0 commit comments

Comments
 (0)