├── .deepsource.toml ├── .eslintrc.json ├── .forestry └── settings.yml ├── .github ├── FUNDING.yml └── workflows │ ├── codeql-analysis.yml │ └── stale.yml ├── .gitignore ├── .prettierrc.json ├── components ├── footer.js ├── homepage.js ├── layout.js ├── link.js ├── mdx │ ├── code.js │ ├── image.js │ ├── pre.js │ └── table.js ├── navbar.js └── sidebar │ ├── ActiveLink.js │ ├── LinkList.js │ └── sidebar.js ├── config.json ├── jsconfig.json ├── lib ├── hydrate.js ├── idle-callback-polyfill.js ├── lecture.js ├── remark-math │ ├── block.js │ ├── index.js │ ├── inline.js │ ├── package.json │ ├── readme.md │ ├── test.js │ └── util.js ├── remark.js ├── remarkSmartypants.js ├── rendermath.js └── tree.js ├── next-sitemap.js ├── next.config.js ├── notes ├── Certifications │ └── AZ900 │ │ ├── Architecture_and_Service.md │ │ ├── Compute.md │ │ ├── Core_Cloud_Services.md │ │ ├── Costs_and_Spending.md │ │ ├── Creating_an_account.md │ │ ├── Data_Storage.md │ │ ├── Managing_Services.md │ │ ├── Networking.md │ │ ├── Policy.md │ │ ├── Principles_of_cloud_computing.md │ │ ├── Resource_Manager.md │ │ └── Security.md ├── Open_Source │ ├── Git │ │ ├── Commands.md │ │ ├── GitKraken.md │ │ └── Introduction.md │ ├── GitHub │ │ └── Fork_and_PR.md │ ├── HTML │ │ ├── Boilerplate.md │ │ ├── Introduction.md │ │ ├── Links_and_Images.md │ │ ├── Lists.md │ │ ├── Tables.md │ │ └── Text_Formatting.md │ └── Markdown │ │ ├── Code.md │ │ ├── Introduction.md │ │ ├── Links_and_Images.md │ │ ├── Lists.md │ │ ├── Tables.md │ │ └── Text_Formatting.md └── University_Illustrations │ ├── CaC │ ├── ECC │ │ ├── Error_Correcting.md │ │ ├── Finite_Fields.md │ │ ├── Hamming_Codes.md │ │ ├── Linear_Codes.md │ │ └── Reed-Muller.md │ └── Information_Theory │ │ ├── Capacity.md │ │ ├── Introduction.md │ │ └── Mutual_Information.md │ └── DADS │ ├── Cuckoo_Hashing.md │ └── Probability.md ├── package.json ├── pages ├── 404.js ├── [...slug].js ├── _app.js ├── _document.js └── index.js ├── postcss.config.js ├── public ├── favicon.ico ├── home │ ├── MessyDoodle.svg │ ├── down.svg │ ├── font.svg │ ├── next.svg │ ├── open_source.svg │ ├── tailwind.svg │ ├── undraw_algolia_msba.svg │ └── undraw_noted_pc9f.svg ├── img │ ├── Certifications │ │ └── AZ900 │ │ │ ├── Account │ │ │ └── 4-billing-structure-overview.png │ │ │ ├── Compute │ │ │ └── 4-kub-migration.png │ │ │ ├── Principles │ │ │ └── 5-layer-diagram.png │ │ │ └── Security │ │ │ └── 2-shared_responsibilities.png │ ├── Uni │ │ ├── CaC │ │ │ ├── ECC │ │ │ │ ├── add_structure.png │ │ │ │ ├── associativity.png │ │ │ │ ├── commutative.png │ │ │ │ ├── dual_parity.png │ │ │ │ ├── gf_addition.png │ │ │ │ ├── gf_mult.png │ │ │ │ ├── hamming_distance.png │ │ │ │ ├── hamming_generator.png │ │ │ │ ├── hamming_structure.png │ │ │ │ ├── identity.png │ │ │ │ ├── inverse.png │ │ │ │ ├── mind_proof.png │ │ │ │ ├── minimum_distance.png │ │ │ │ ├── mult_cycle.png │ │ │ │ ├── mult_distributes.png │ │ │ │ ├── or_mod2.png │ │ │ │ ├── parity_check.png │ │ │ │ ├── pc_matrix.png │ │ │ │ ├── primitive.png │ │ │ │ ├── repetition_code.png │ │ │ │ └── systematic_form.png │ │ │ └── InfTheo │ │ │ │ ├── channel.png │ │ │ │ ├── convex.png │ │ │ │ ├── drv.png │ │ │ │ ├── drv_expectation.png │ │ │ │ ├── entropy.png │ │ │ │ ├── entropy_venn.png │ │ │ │ ├── jensen.png │ │ │ │ └── memoryless_channel.png │ │ └── DADS │ │ │ ├── Cuckoo │ │ │ ├── chaining.png │ │ │ ├── cuckoo.png │ │ │ ├── cuckoo_graph.png │ │ │ ├── dictionary_operations.png │ │ │ └── hash_table.png │ │ │ ├── Intro │ │ │ ├── axioms.png │ │ │ ├── conditional_probability.png │ │ │ ├── expected.png │ │ │ ├── further_rules.png │ │ │ ├── independence.png │ │ │ ├── independent.png │ │ │ ├── linearity_of_expectation.png │ │ │ ├── mutual_independent.png │ │ │ ├── pairwise_independent.png │ │ │ ├── random_variable.png │ │ │ └── uniform_distribution.png │ │ │ └── Universal │ │ │ └── k-universal.png │ └── open_source │ │ ├── git │ │ ├── commands │ │ │ └── clone.png │ │ └── gitkraken │ │ │ ├── GitKraken_Main.webp │ │ │ ├── left_bar.png │ │ │ ├── middle.png │ │ │ ├── right_bar.png │ │ │ └── top.png │ │ └── github │ │ └── fork │ │ ├── Forked_Repo.webp │ │ └── create_pr.webp └── robots.txt ├── readme.md ├── styles ├── index.css └── prism-atom-dark.css ├── tailwind.config.js ├── vercel.json └── yarn.lock /.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[analyzers]] 4 | name = "javascript" 5 | enabled = true 6 | 7 | [analyzers.meta] 8 | ecma_version = "2020" 9 | module_system = "es-modules" 10 | environment = [ 11 | "nodejs", 12 | "browser" 13 | ] 14 | plugins = ["react"] -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2020": true 5 | }, 6 | "extends": [ 7 | "eslint:recommended", 8 | "plugin:react/recommended", 9 | "plugin:react-hooks/recommended" 10 | ], 11 | "parserOptions": { 12 | "ecmaFeatures": { 13 | "jsx": true, 14 | "modules": true 15 | }, 16 | "ecmaVersion": 11, 17 | "sourceType": "module" 18 | }, 19 | "plugins": ["react"], 20 | "rules": { 21 | "linebreak-style": ["error", "unix"], 22 | "quotes": ["error", "double"], 23 | "semi": ["error", "always"], 24 | "react/react-in-jsx-scope": "off", 25 | "react/jsx-uses-react": "off", 26 | "no-undef": "off", 27 | "react/prop-types": "off", 28 | "indent": "off", 29 | "no-mixed-spaces-and-tabs": "off" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.forestry/settings.yml: -------------------------------------------------------------------------------- 1 | --- 2 | new_page_extension: md 3 | auto_deploy: false 4 | admin_path: 5 | webhook_url: 6 | sections: 7 | - type: heading 8 | label: Year 1 9 | - type: directory 10 | path: notes/Year_1/Algorithms_and_Data_Structures 11 | label: Algorithms and Data Structures 12 | create: all 13 | match: "**/*" 14 | - type: directory 15 | path: notes/Year_1/Computational_Thinking 16 | label: Computational Thinking 17 | create: all 18 | match: "**/*" 19 | - type: directory 20 | path: notes/Year_1/Computer_Systems 21 | label: Computer Systems 22 | create: all 23 | match: "**/*" 24 | - type: directory 25 | path: notes/Year_1/Maths_for_Computer_Science 26 | label: Maths for Computer Science 27 | create: all 28 | match: "**/*" 29 | - type: directory 30 | path: notes/Year_1/Programming 31 | label: Programming 32 | create: all 33 | match: "**/*" 34 | - type: heading 35 | label: Year 2 36 | - type: directory 37 | path: notes/Year_2/Networks_and_Systems 38 | label: Networks and Systems 39 | create: all 40 | match: "**/*" 41 | - type: directory 42 | path: notes/Year_2/Programming_Paradigms 43 | label: Programming Paradigms 44 | create: all 45 | match: "**/*" 46 | - type: directory 47 | path: notes/Year_2/Software_Engineering 48 | label: Software Engineering 49 | create: all 50 | match: "**/*" 51 | - type: directory 52 | path: notes/Year_2/Software_Methodologies 53 | label: Software Methodologies 54 | create: all 55 | match: "**/*" 56 | - type: directory 57 | path: notes/Year_2/Theory_of_Computation 58 | label: Theory of Computation 59 | create: all 60 | match: "**/*" 61 | upload_dir: public/img 62 | public_path: "/img" 63 | front_matter_path: '' 64 | use_front_matter_path: false 65 | file_template: ":filename:" 66 | build: 67 | preview_output_directory: ".next" 68 | install_dependencies_command: npm install 69 | preview_docker_image: forestryio/node:12 70 | mount_path: "/srv" 71 | working_dir: "/srv" 72 | instant_preview_command: npm run dev 73 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: samrobbins85 2 | custom: "https://www.buymeacoffee.com/samrobbins" 3 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | name: "CodeQL" 7 | 8 | on: 9 | push: 10 | branches: [master] 11 | pull_request: 12 | # The branches below must be a subset of the branches above 13 | branches: [master] 14 | schedule: 15 | - cron: '0 23 * * 3' 16 | 17 | jobs: 18 | analyze: 19 | name: Analyze 20 | runs-on: ubuntu-latest 21 | 22 | strategy: 23 | fail-fast: false 24 | matrix: 25 | # Override automatic language detection by changing the below list 26 | # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] 27 | language: ['javascript'] 28 | # Learn more... 29 | # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection 30 | 31 | steps: 32 | - name: Checkout repository 33 | uses: actions/checkout@v2 34 | with: 35 | # We must fetch at least the immediate parents so that if this is 36 | # a pull request then we can checkout the head. 37 | fetch-depth: 2 38 | 39 | # If this run was triggered by a pull request event, then checkout 40 | # the head of the pull request instead of the merge commit. 41 | - run: git checkout HEAD^2 42 | if: ${{ github.event_name == 'pull_request' }} 43 | 44 | # Initializes the CodeQL tools for scanning. 45 | - name: Initialize CodeQL 46 | uses: github/codeql-action/init@v1 47 | with: 48 | languages: ${{ matrix.language }} 49 | # If you wish to specify custom queries, you can do so here or in a config file. 50 | # By default, queries listed here will override any specified in a config file. 51 | # Prefix the list here with "+" to use these queries and those in the config file. 52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 53 | 54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 55 | # If this step fails, then you should remove it and run the build manually (see below) 56 | - name: Autobuild 57 | uses: github/codeql-action/autobuild@v1 58 | 59 | # ℹ️ Command-line programs to run using the OS shell. 60 | # 📚 https://git.io/JvXDl 61 | 62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 63 | # and modify them (or add more) to build your code if your project 64 | # uses a compiled language 65 | 66 | #- run: | 67 | # make bootstrap 68 | # make release 69 | 70 | - name: Perform CodeQL Analysis 71 | uses: github/codeql-action/analyze@v1 72 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: "Close stale issues" 2 | on: 3 | schedule: 4 | - cron: "0 0 * * *" 5 | 6 | jobs: 7 | stale: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/stale@v3 11 | with: 12 | repo-token: ${{ secrets.GITHUB_TOKEN }} 13 | stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days' 14 | stale-pr-message: 'This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days' 15 | days-before-stale: 30 16 | days-before-close: 5 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | 21 | # debug 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | 26 | # local env files 27 | .env.local 28 | .env.development.local 29 | .env.test.local 30 | .env.production.local 31 | 32 | .mdx-data 33 | .vscode 34 | 35 | public/sitemap.xml -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "tabWidth": 4, 4 | "semi": true, 5 | "singleQuote": false, 6 | "useTabs": true 7 | } 8 | -------------------------------------------------------------------------------- /components/footer.js: -------------------------------------------------------------------------------- 1 | export default function Footer(props) { 2 | return ( 3 | 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /components/homepage.js: -------------------------------------------------------------------------------- 1 | export default function HomePage({ tree }) { 2 | return ( 3 | <> 4 | 8 |
9 |
10 |

11 | {"Sam's Notes"} 12 |

13 |
14 | 15 |

16 | These are my notes from my Course at Durham University 17 |

18 |

19 | If you want to donate: 20 |

21 |
22 |
23 | 27 | Buy me a coffee 31 | Buy me a coffee 32 | 33 |
34 |
35 | 36 | 43 | 49 | 50 | Sponsor on GitHub 51 | 52 |
53 |
54 |
55 |
56 |

57 | Quick Links 58 |

59 |
60 | {tree.children.map((year) => ( 61 |
62 |

63 | {year.name.replace(/_/g, " ")} 64 |

65 | 82 |
83 | ))} 84 |
85 |
86 | 87 | ); 88 | } 89 | -------------------------------------------------------------------------------- /components/layout.js: -------------------------------------------------------------------------------- 1 | export default function Layout(props) { 2 | const toggle = props.toggle 3 | ? "fixed lg:sticky" 4 | : "hidden lg:sticky lg:block"; 5 | 6 | return ( 7 |
8 |
{props.navbar}
9 |
10 |
13 | {props.sidebar} 14 |
15 |
16 |
21 | {props.main} 22 |
23 |
24 |
25 |
26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /components/link.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var s = require("hastscript/svg"); 4 | 5 | module.exports = link; 6 | 7 | function link() { 8 | return s( 9 | "svg.icon", 10 | { 11 | ariaHidden: "true", 12 | viewBox: [0, 0, 24, 24], 13 | focusable: false, 14 | width: 18, 15 | height: 18, 16 | fill: "none", 17 | className: "stroke-current text-gray-600", 18 | }, 19 | s("path", { 20 | "stroke-linecap": "round", 21 | "stroke-width": 2, 22 | "stroke-linejoin": "round", 23 | d: 24 | "M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1", 25 | }) 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /components/mdx/code.js: -------------------------------------------------------------------------------- 1 | var base64 = require("base-64"); 2 | var utf8 = require("utf8"); 3 | const pako = require("pako"); 4 | 5 | export default function MyCode(props) { 6 | if (props.className === "language-mermaid") { 7 | var result = base64.encode(props.children); 8 | return Diagram; 9 | } else if (props.className === "language-graphviz") { 10 | // var bytes = utf8.encode(props.children); 11 | const compressed = pako.deflate(props.children, { 12 | level: 9, 13 | to: "string", 14 | }); 15 | var result = base64 16 | .encode(compressed) 17 | .replace(/\+/g, "-") 18 | .replace(/\//g, "_"); 19 | return ( 20 | Diagram 24 | ); 25 | } else { 26 | return ; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /components/mdx/image.js: -------------------------------------------------------------------------------- 1 | export default function MyImg(props) { 2 | if (props.title !== undefined) { 3 | return ( 4 |
5 | {props.alt} 10 |
{props.title}
11 |
12 | ); 13 | } else { 14 | return ( 15 | {props.alt} 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /components/mdx/pre.js: -------------------------------------------------------------------------------- 1 | export default function MyPre(props) { 2 | if (["language-mermaid", "language-graphviz"].includes(props.className)) { 3 | return
{props.children}
; 4 | } else { 5 | return
;
6 | 	}
7 | }
8 | 


--------------------------------------------------------------------------------
/components/mdx/table.js:
--------------------------------------------------------------------------------
1 | export default function MyTable(props) {
2 | 	return (
3 | 		
4 | 5 | 6 | ); 7 | } 8 | -------------------------------------------------------------------------------- /components/navbar.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const NavBar = React.forwardRef((props, ref) => { 4 | return ( 5 | 40 | ); 41 | }); 42 | 43 | NavBar.displayName = "NavBar"; 44 | 45 | export default NavBar; 46 | -------------------------------------------------------------------------------- /components/sidebar/ActiveLink.js: -------------------------------------------------------------------------------- 1 | import { useRouter } from "next/router"; 2 | import PropTypes from "prop-types"; 3 | import Link from "next/link"; 4 | import React, { Children } from "react"; 5 | 6 | const ActiveLink = ({ children, activeClassName, ...props }) => { 7 | const { asPath } = useRouter(); 8 | const child = Children.only(children); 9 | const childClassName = child.props.className || ""; 10 | 11 | // pages/index.js will be matched via props.href 12 | // pages/about.js will be matched via props.href 13 | // pages/[slug].js will be matched via props.as 14 | const className = 15 | asPath === props.href || asPath === props.as 16 | ? `${childClassName} ${activeClassName}`.trim() 17 | : childClassName; 18 | 19 | return ( 20 | 21 | {React.cloneElement(child, { 22 | className: className || null, 23 | })} 24 | 25 | ); 26 | }; 27 | 28 | ActiveLink.propTypes = { 29 | activeClassName: PropTypes.string.isRequired, 30 | }; 31 | 32 | export default ActiveLink; 33 | -------------------------------------------------------------------------------- /components/sidebar/LinkList.js: -------------------------------------------------------------------------------- 1 | import ActiveLink from "./ActiveLink"; 2 | export default function LinkList(props) { 3 | return ( 4 |
  • 5 | 17 | 18 | {props.lecture.replace(/\.[^/.]+$/, "").replace(/_/g, " ")} 19 | 20 | 21 |
  • 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /components/sidebar/sidebar.js: -------------------------------------------------------------------------------- 1 | import { useState } from "react"; 2 | import LinkList from "./LinkList"; 3 | import React from "react"; 4 | const Sidebar = React.forwardRef((props, ref) => { 5 | const [year, setYear] = useState(props.slug ? props.slug[0] : "Base"); 6 | const [module, setModule] = useState(props.slug ? props.slug[1] : false); 7 | function handleChange(event) { 8 | setModule(false); 9 | setYear(event.target.value); 10 | } 11 | 12 | function Module_layer() { 13 | return ( 14 |
      15 | {year && 16 | props.tree.children 17 | .find((x) => x.name === year) 18 | .children.map((x) => x.name) 19 | .map((element) => ( 20 |
    • 21 | 24 |
    • 25 | ))} 26 |
    27 | ); 28 | } 29 | 30 | function Submodule_List() { 31 | return ( 32 |
      33 | {props.tree.children 34 | .find((x) => x.name === year) 35 | .children.find((x) => x.name === module) 36 | .children.sort(function (a, b) { 37 | if ("extension" in a && !("extension" in b)) { 38 | return -1; 39 | } 40 | if ("extension" in b && !("extension" in a)) { 41 | return 1; 42 | } 43 | return 0; 44 | }) 45 | .map(function (elem) { 46 | if ("extension" in elem) { 47 | return ( 48 | 54 | ); 55 | } else { 56 | return ( 57 |
    • 61 | {elem.name.replace(/_/g, " ")} 62 |
        63 | {elem.children.map((lecture) => ( 64 | 71 | ))} 72 |
      73 |
    • 74 | ); 75 | } 76 | })} 77 |
    78 | ); 79 | } 80 | 81 | function Submodule_layer() { 82 | return ( 83 | <> 84 |
    85 | 101 |

    102 | {module.replace(/_/g, " ")} 103 |

    104 |
    105 |
    106 | 107 | 108 | ); 109 | } 110 | 111 | function Switching() { 112 | if (module) { 113 | return ; 114 | } else { 115 | return ; 116 | } 117 | } 118 | 119 | return ( 120 |
    121 | 136 | 137 |
    138 | {year !== "Base" && } 139 |
    140 | ); 141 | }); 142 | 143 | Sidebar.displayName = "Sidebar"; 144 | 145 | export default Sidebar; 146 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "index_name": "csnotes", 3 | "sitemap_urls": ["http://notes.samrobbins.uk/sitemap.xml"], 4 | "stop_urls": [], 5 | "selectors": { 6 | "lvl0": ".title", 7 | "lvl1": ".prose h1", 8 | "lvl2": ".prose h2", 9 | "lvl3": ".prose h3", 10 | "lvl4": ".prose h4", 11 | "lvl5": ".prose h5", 12 | "text": ".prose p, li" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "paths": { 5 | "@/components/*": ["components/*"], 6 | "@/lib/*": ["lib/*"], 7 | "@/data/*": ["data/*"] 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /lib/hydrate.js: -------------------------------------------------------------------------------- 1 | require("./idle-callback-polyfill"); 2 | const React = require("react"); 3 | const { mdx, MDXProvider } = require("@mdx-js/react"); 4 | const { useEffect } = require("react"); 5 | 6 | module.exports = function hydrate( 7 | { compiledSource, renderedOutput, scope = {} }, 8 | { components } = {} 9 | ) { 10 | // our default result is the server-rendered output 11 | // we get this in front of users as quickly as possible 12 | const [result, setResult] = React.useState( 13 | React.createElement("span", { 14 | dangerouslySetInnerHTML: { 15 | __html: renderedOutput, 16 | }, 17 | }) 18 | ); 19 | 20 | // if we're server-side, we can return the raw output early 21 | if (typeof window === "undefined") return result; 22 | 23 | // if we're on the client side, we hydrate the mdx content inside 24 | // requestIdleCallback, since we can be fairly confident that 25 | // markdown - embedded components are not a high priority to get 26 | // to interactive compared to...anything else on the page. 27 | // 28 | // once the hydration is complete, we update the state/memo value and 29 | // react re-renders for us 30 | useEffect(() => { 31 | const handle = window.requestIdleCallback(() => { 32 | // first we set up the scope which has to include the mdx custom 33 | // create element function as well as any components we're using 34 | const fullScope = { mdx, ...components, ...scope }; 35 | const keys = Object.keys(fullScope); 36 | const values = Object.values(fullScope); 37 | 38 | // now we eval the source code using a function constructor 39 | // in order for this to work we need to have React, the mdx createElement, 40 | // and all our components in scope for the function, which is the case here 41 | // we pass the names (via keys) in as the function's args, and execute the 42 | // function with the actual values. 43 | const hydratedFn = new Function( 44 | "React", 45 | ...keys, 46 | `${compiledSource} 47 | return React.createElement(MDXContent, {});` 48 | )(React, ...values); 49 | 50 | // wrapping the content with MDXProvider will allow us to customize the standard 51 | // markdown components (such as "h1" or "a") with the "components" object 52 | const wrappedWithMdxProvider = React.createElement( 53 | MDXProvider, 54 | { components }, 55 | hydratedFn 56 | ); 57 | 58 | // finally, set the the output as the new result so that react will re-render for us 59 | // and cancel the idle callback since we don't need it anymore 60 | setResult(wrappedWithMdxProvider); 61 | window.cancelIdleCallback(handle); 62 | 63 | import("@/lib/rendermath").then((renderMath) => { 64 | renderMath.default(); 65 | }); 66 | }); 67 | }, [compiledSource]); 68 | 69 | return result; 70 | }; 71 | -------------------------------------------------------------------------------- /lib/idle-callback-polyfill.js: -------------------------------------------------------------------------------- 1 | if (typeof window !== 'undefined') { 2 | window.requestIdleCallback = 3 | window.requestIdleCallback || 4 | function (cb) { 5 | var start = Date.now() 6 | return setTimeout(function () { 7 | cb({ 8 | didTimeout: false, 9 | timeRemaining: function () { 10 | return Math.max(0, 50 - (Date.now() - start)) 11 | }, 12 | }) 13 | }, 1) 14 | } 15 | 16 | window.cancelIdleCallback = 17 | window.cancelIdleCallback || 18 | function (id) { 19 | clearTimeout(id) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/lecture.js: -------------------------------------------------------------------------------- 1 | import fs from "fs"; 2 | import path from "path"; 3 | import matter from "gray-matter"; 4 | const postsDirectory = path.join(process.cwd(), "notes"); 5 | 6 | export async function getPostData(params) { 7 | if (Object.keys(params).length === 0) { 8 | return { isHome }; 9 | } 10 | const fullPath = path.join(postsDirectory, `/${params.slug.join("/")}.md`); 11 | try { 12 | fs.readFileSync(fullPath, "utf8"); 13 | } catch { 14 | return { params }; 15 | } 16 | const fileContents = fs.readFileSync(fullPath, "utf8"); 17 | 18 | const matterResult = matter(fileContents); 19 | 20 | const contentHtml = matterResult.content; 21 | var exercise; 22 | if ( 23 | fs.existsSync( 24 | path.join(postsDirectory, `/${params.slug.join("/")}.exercise.md`), 25 | "utf8" 26 | ) 27 | ) { 28 | exercise = fs.readFileSync( 29 | path.join(postsDirectory, `/${params.slug.join("/")}.exercise.md`), 30 | "utf8" 31 | ); 32 | } else { 33 | exercise = false; 34 | } 35 | return { 36 | params, 37 | contentHtml, 38 | exercise, 39 | ...matterResult.data, 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /lib/remark-math/block.js: -------------------------------------------------------------------------------- 1 | const util = require('./util') 2 | 3 | module.exports = mathBlock 4 | 5 | const lineFeed = 10 // '\n' 6 | const space = 32 // ' ' 7 | const dollarSign = 36 // '$' 8 | 9 | const lineFeedChar = '\n' 10 | const dollarSignChar = '$' 11 | 12 | const minFenceCount = 2 13 | 14 | const classList = ['math', 'math-display'] 15 | 16 | function mathBlock() { 17 | const parser = this.Parser 18 | const compiler = this.Compiler 19 | 20 | if (util.isRemarkParser(parser)) { 21 | attachParser(parser) 22 | } 23 | 24 | if (util.isRemarkCompiler(compiler)) { 25 | attachCompiler(compiler) 26 | } 27 | } 28 | 29 | function attachParser(parser) { 30 | const proto = parser.prototype 31 | const blockMethods = proto.blockMethods 32 | const interruptParagraph = proto.interruptParagraph 33 | const interruptList = proto.interruptList 34 | const interruptBlockquote = proto.interruptBlockquote 35 | 36 | proto.blockTokenizers.math = mathBlockTokenizer 37 | 38 | blockMethods.splice(blockMethods.indexOf('fencedCode') + 1, 0, 'math') 39 | 40 | // Inject math to interrupt rules 41 | interruptParagraph.splice(interruptParagraph.indexOf('fencedCode') + 1, 0, [ 42 | 'math' 43 | ]) 44 | interruptList.splice(interruptList.indexOf('fencedCode') + 1, 0, ['math']) 45 | interruptBlockquote.splice(interruptBlockquote.indexOf('fencedCode') + 1, 0, [ 46 | 'math' 47 | ]) 48 | 49 | function mathBlockTokenizer(eat, value, silent) { 50 | var length = value.length 51 | var index = 0 52 | let code 53 | let content 54 | let lineEnd 55 | let lineIndex 56 | let openingFenceIndentSize 57 | let openingFenceSize 58 | let openingFenceContentStart 59 | let closingFence 60 | let closingFenceSize 61 | let lineContentStart 62 | let lineContentEnd 63 | 64 | // Skip initial spacing. 65 | while (index < length && value.charCodeAt(index) === space) { 66 | index++ 67 | } 68 | 69 | openingFenceIndentSize = index 70 | 71 | // Skip the fence. 72 | while (index < length && value.charCodeAt(index) === dollarSign) { 73 | index++ 74 | } 75 | 76 | openingFenceSize = index - openingFenceIndentSize 77 | 78 | // Exit if there is not enough of a fence. 79 | if (openingFenceSize < minFenceCount) { 80 | return 81 | } 82 | 83 | // Skip spacing after the fence. 84 | while (index < length && value.charCodeAt(index) === space) { 85 | index++ 86 | } 87 | 88 | openingFenceContentStart = index 89 | 90 | // Eat everything after the fence. 91 | while (index < length) { 92 | code = value.charCodeAt(index) 93 | 94 | // We don’t allow dollar signs here, as that could interfere with inline 95 | // math. 96 | if (code === dollarSign) { 97 | return 98 | } 99 | 100 | if (code === lineFeed) { 101 | break 102 | } 103 | 104 | index++ 105 | } 106 | 107 | if (value.charCodeAt(index) !== lineFeed) { 108 | return 109 | } 110 | 111 | if (silent) { 112 | return true 113 | } 114 | 115 | content = [] 116 | 117 | if (openingFenceContentStart !== index) { 118 | content.push(value.slice(openingFenceContentStart, index)) 119 | } 120 | 121 | index++ 122 | lineEnd = value.indexOf(lineFeedChar, index + 1) 123 | lineEnd = lineEnd === -1 ? length : lineEnd 124 | 125 | while (index < length) { 126 | closingFence = false 127 | lineContentStart = index 128 | lineContentEnd = lineEnd 129 | lineIndex = lineEnd 130 | closingFenceSize = 0 131 | 132 | // First, let’s see if this is a valid closing fence. 133 | // Skip trailing white space 134 | while ( 135 | lineIndex > lineContentStart && 136 | value.charCodeAt(lineIndex - 1) === space 137 | ) { 138 | lineIndex-- 139 | } 140 | 141 | // Skip the fence. 142 | while ( 143 | lineIndex > lineContentStart && 144 | value.charCodeAt(lineIndex - 1) === dollarSign 145 | ) { 146 | closingFenceSize++ 147 | lineIndex-- 148 | } 149 | 150 | // Check if this is a valid closing fence line. 151 | if ( 152 | openingFenceSize <= closingFenceSize && 153 | value.indexOf(dollarSignChar, lineContentStart) === lineIndex 154 | ) { 155 | closingFence = true 156 | lineContentEnd = lineIndex 157 | } 158 | 159 | // Sweet, next, we need to trim the line. 160 | // Skip initial spacing. 161 | while ( 162 | lineContentStart <= lineContentEnd && 163 | lineContentStart - index < openingFenceIndentSize && 164 | value.charCodeAt(lineContentStart) === space 165 | ) { 166 | lineContentStart++ 167 | } 168 | 169 | // If this is a closing fence, skip final spacing. 170 | if (closingFence) { 171 | while ( 172 | lineContentEnd > lineContentStart && 173 | value.charCodeAt(lineContentEnd - 1) === space 174 | ) { 175 | lineContentEnd-- 176 | } 177 | } 178 | 179 | // If this is a content line, or if there is content before the fence: 180 | if (!closingFence || lineContentStart !== lineContentEnd) { 181 | content.push(value.slice(lineContentStart, lineContentEnd)) 182 | } 183 | 184 | if (closingFence) { 185 | break 186 | } 187 | 188 | index = lineEnd + 1 189 | lineEnd = value.indexOf(lineFeedChar, index + 1) 190 | lineEnd = lineEnd === -1 ? length : lineEnd 191 | } 192 | 193 | content = "$$"+content.join('\n')+"$$" 194 | 195 | return eat(value.slice(0, lineEnd))({ 196 | type: 'math', 197 | value: content, 198 | data: { 199 | hName: 'div', 200 | hProperties: { className: classList.concat() }, 201 | hChildren: [{ type: 'text', value: content }] 202 | } 203 | }) 204 | } 205 | } 206 | 207 | function attachCompiler(compiler) { 208 | const proto = compiler.prototype 209 | 210 | proto.visitors.math = compileBlockMath 211 | 212 | function compileBlockMath(node) { 213 | return '$$\n' + node.value + '\n$$' 214 | } 215 | } 216 | -------------------------------------------------------------------------------- /lib/remark-math/index.js: -------------------------------------------------------------------------------- 1 | const inlinePlugin = require('./inline') 2 | const blockPlugin = require('./block') 3 | 4 | module.exports = math 5 | 6 | function math(options) { 7 | var settings = options || {} 8 | blockPlugin.call(this, settings) 9 | inlinePlugin.call(this, settings) 10 | } 11 | -------------------------------------------------------------------------------- /lib/remark-math/inline.js: -------------------------------------------------------------------------------- 1 | var util = require('./util') 2 | 3 | module.exports = mathInline 4 | 5 | const tab = 9 // '\t' 6 | const space = 32 // ' ' 7 | const dollarSign = 36 // '$' 8 | const digit0 = 48 // '0' 9 | const digit9 = 57 // '9' 10 | const backslash = 92 // '\\' 11 | 12 | const classList = ['math', 'math-inline'] 13 | const mathDisplay = 'math-display' 14 | 15 | function mathInline(options) { 16 | const parser = this.Parser 17 | const compiler = this.Compiler 18 | 19 | if (util.isRemarkParser(parser)) { 20 | attachParser(parser, options) 21 | } 22 | 23 | if (util.isRemarkCompiler(compiler)) { 24 | attachCompiler(compiler, options) 25 | } 26 | } 27 | 28 | function attachParser(parser, options) { 29 | const proto = parser.prototype 30 | const inlineMethods = proto.inlineMethods 31 | 32 | mathInlineTokenizer.locator = locator 33 | 34 | proto.inlineTokenizers.math = mathInlineTokenizer 35 | 36 | inlineMethods.splice(inlineMethods.indexOf('text'), 0, 'math') 37 | 38 | function locator(value, fromIndex) { 39 | return value.indexOf('$', fromIndex) 40 | } 41 | 42 | function mathInlineTokenizer(eat, value, silent) { 43 | const length = value.length 44 | let double = false 45 | let escaped = false 46 | let index = 0 47 | let previous 48 | let code 49 | let next 50 | let contentStart 51 | let contentEnd 52 | let valueEnd 53 | let content 54 | 55 | if (value.charCodeAt(index) === backslash) { 56 | escaped = true 57 | index++ 58 | } 59 | 60 | if (value.charCodeAt(index) !== dollarSign) { 61 | return 62 | } 63 | 64 | index++ 65 | 66 | // Support escaped dollars. 67 | if (escaped) { 68 | /* istanbul ignore if - never used (yet) */ 69 | if (silent) { 70 | return true 71 | } 72 | 73 | return eat(value.slice(0, index))({ type: 'text', value: '$' }) 74 | } 75 | 76 | if (value.charCodeAt(index) === dollarSign) { 77 | double = true 78 | index++ 79 | } 80 | 81 | next = value.charCodeAt(index) 82 | 83 | // Opening fence cannot be followed by a space or a tab. 84 | if (next === space || next === tab) { 85 | return 86 | } 87 | 88 | contentStart = index 89 | 90 | while (index < length) { 91 | code = next 92 | next = value.charCodeAt(index + 1) 93 | 94 | if (code === dollarSign) { 95 | previous = value.charCodeAt(index - 1) 96 | 97 | // Closing fence cannot be preceded by a space or a tab, or followed by 98 | // a digit. 99 | // If a double marker was used to open, the closing fence must consist 100 | // of two dollars as well. 101 | if ( 102 | previous !== space && 103 | previous !== tab && 104 | // eslint-disable-next-line no-self-compare 105 | (next !== next || next < digit0 || next > digit9) && 106 | (!double || next === dollarSign) 107 | ) { 108 | contentEnd = index - 1 109 | 110 | index++ 111 | 112 | if (double) { 113 | index++ 114 | } 115 | 116 | valueEnd = index 117 | break 118 | } 119 | } else if (code === backslash) { 120 | index++ 121 | next = value.charCodeAt(index + 1) 122 | } 123 | 124 | index++ 125 | } 126 | 127 | if (valueEnd === undefined) { 128 | return 129 | } 130 | 131 | /* istanbul ignore if - never used (yet) */ 132 | if (silent) { 133 | return true 134 | } 135 | 136 | content = "$"+value.slice(contentStart, contentEnd + 1)+"$" 137 | 138 | return eat(value.slice(0, valueEnd))({ 139 | type: 'inlineMath', 140 | value: content, 141 | data: { 142 | hName: 'span', 143 | hProperties: { 144 | className: classList.concat( 145 | double && options.inlineMathDouble ? [mathDisplay] : [] 146 | ) 147 | }, 148 | hChildren: [{ type: 'text', value: content }] 149 | } 150 | }) 151 | } 152 | } 153 | 154 | function attachCompiler(compiler) { 155 | const proto = compiler.prototype 156 | 157 | proto.visitors.inlineMath = compileInlineMath 158 | 159 | function compileInlineMath(node) { 160 | let fence = '$' 161 | const classes = 162 | (node.data && node.data.hProperties && node.data.hProperties.className) || 163 | [] 164 | 165 | if (classes.includes(mathDisplay)) { 166 | fence = '$$' 167 | } 168 | 169 | return fence + node.value + fence 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /lib/remark-math/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "remark-math", 3 | "version": "2.0.1", 4 | "description": "remark plugin to parse and stringify math", 5 | "license": "MIT", 6 | "keywords": [ 7 | "unified", 8 | "remark", 9 | "remark-plugin", 10 | "plugin", 11 | "mdast", 12 | "markdown", 13 | "math", 14 | "katex", 15 | "latex", 16 | "tex" 17 | ], 18 | "repository": "https://github.com/remarkjs/remark-math/tree/main/packages/remark-math", 19 | "bugs": "https://github.com/remarkjs/remark-math/issues", 20 | "funding": { 21 | "type": "opencollective", 22 | "url": "https://opencollective.com/unified" 23 | }, 24 | "author": "Junyoung Choi (https://rokt33r.github.io)", 25 | "contributors": [ 26 | "Junyoung Choi (https://rokt33r.github.io)", 27 | "Titus Wormer (https://wooorm.com)" 28 | ], 29 | "files": [ 30 | "index.js", 31 | "block.js", 32 | "inline.js", 33 | "util.js" 34 | ], 35 | "main": "index.js", 36 | "dependencies": {}, 37 | "devDependencies": {}, 38 | "xo": false 39 | } 40 | -------------------------------------------------------------------------------- /lib/remark-math/readme.md: -------------------------------------------------------------------------------- 1 | # remark-math 2 | 3 | [![Build][build-badge]][build] 4 | [![Coverage][coverage-badge]][coverage] 5 | [![Downloads][downloads-badge]][downloads] 6 | [![Size][size-badge]][size] 7 | [![Sponsors][sponsors-badge]][collective] 8 | [![Backers][backers-badge]][collective] 9 | [![Chat][chat-badge]][chat] 10 | 11 | [**remark**][remark] plugin to parse and stringify math. 12 | 13 | ## Install 14 | 15 | [npm][]: 16 | 17 | ```sh 18 | npm install remark-math 19 | ``` 20 | 21 | ## Use 22 | 23 | Say we have the following file, `example.md`: 24 | 25 | ```markdown 26 | Lift($L$) can be determined by Lift Coefficient ($C_L$) like the following equation. 27 | 28 | $$ 29 | L = \frac{1}{2} \rho v^2 S C_L 30 | $$ 31 | ``` 32 | 33 | And our script, `example.js`, looks as follows: 34 | 35 | ```js 36 | const vfile = require('to-vfile') 37 | const unified = require('unified') 38 | const markdown = require('remark-parse') 39 | const math = require('remark-math') 40 | const remark2rehype = require('remark-rehype') 41 | const katex = require('rehype-katex') 42 | const stringify = require('rehype-stringify') 43 | 44 | unified() 45 | .use(markdown) 46 | .use(math) 47 | .use(remark2rehype) 48 | .use(katex) 49 | .use(stringify) 50 | .process(vfile.readSync('example.md'), function(err, file) { 51 | if (err) throw err 52 | console.log(String(file)) 53 | }) 54 | ``` 55 | 56 | Now, running `node example` yields: 57 | 58 | ```html 59 |

    Lift(LL) can be determined by Lift Coefficient (CLC_L) like the following equation.

    60 |
    L=12ρv2SCLL = \frac{1}{2} \rho v^2 S C_L
    61 | ``` 62 | 63 | ## API 64 | 65 | ### `remark().use(math[, options])` 66 | 67 | Parse and stringify math. 68 | 69 | Get’s useful when combined with [`rehype-katex`][rehype-katex] or 70 | [`remark-html-katex`][remark-html-katex]. 71 | 72 | You can also support only inline, or online block math, by importing them 73 | directly: 74 | 75 | ```js 76 | const mathInline = require('remark-math/inline') 77 | 78 | // … 79 | 80 | unified() 81 | // … 82 | .use(mathInline) 83 | // … 84 | ``` 85 | 86 | #### `options` 87 | 88 | ##### `options.inlineMathDouble` 89 | 90 | Add an extra `math-display` class to inline `$$` math (default: `false`). 91 | 92 | #### Notes 93 | 94 | ##### Escaping 95 | 96 | You can escape dollar signs with a back slash (`\`): 97 | 98 | ```markdown 99 | \$\alpha\$ 100 | 101 | $\alpha\$$ 102 | 103 | $$ 104 | \beta\$ 105 | $$ 106 | ``` 107 | 108 | ## Security 109 | 110 | Use of `remark-math` itself doesn’t open you up to [cross-site scripting 111 | (XSS)][xss] attacks. 112 | 113 | Always be wary of user input and use [`rehype-sanitize`][rehype-sanitize]. 114 | 115 | ## Contribute 116 | 117 | See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways 118 | to get started. 119 | See [`support.md`][support] for ways to get help. 120 | 121 | This project has a [code of conduct][coc]. 122 | By interacting with this repository, organization, or community you agree to 123 | abide by its terms. 124 | 125 | ## License 126 | 127 | [MIT][license] © [Junyoung Choi][author] 128 | 129 | 130 | 131 | [build-badge]: https://img.shields.io/travis/remarkjs/remark-math/main.svg 132 | 133 | [build]: https://travis-ci.org/remarkjs/remark-math 134 | 135 | [coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-math.svg 136 | 137 | [coverage]: https://codecov.io/github/remarkjs/remark-math 138 | 139 | [downloads-badge]: https://img.shields.io/npm/dm/remark-math.svg 140 | 141 | [downloads]: https://www.npmjs.com/package/remark-math 142 | 143 | [size-badge]: https://img.shields.io/bundlephobia/minzip/remark-math.svg 144 | 145 | [size]: https://bundlephobia.com/result?p=remark-math 146 | 147 | [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg 148 | 149 | [backers-badge]: https://opencollective.com/unified/backers/badge.svg 150 | 151 | [collective]: https://opencollective.com/unified 152 | 153 | [chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg 154 | 155 | [chat]: https://spectrum.chat/unified/remark 156 | 157 | [npm]: https://docs.npmjs.com/cli/install 158 | 159 | [health]: https://github.com/remarkjs/.github 160 | 161 | [contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md 162 | 163 | [support]: https://github.com/remarkjs/.github/blob/HEAD/support.md 164 | 165 | [coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md 166 | 167 | [license]: https://github.com/remarkjs/remark-math/blob/main/license 168 | 169 | [author]: https://rokt33r.github.io 170 | 171 | [remark]: https://github.com/remarkjs/remark 172 | 173 | [xss]: https://en.wikipedia.org/wiki/Cross-site_scripting 174 | 175 | [rehype-katex]: https://github.com/remarkjs/remark-math/tree/main/packages/rehype-katex 176 | 177 | [remark-html-katex]: https://github.com/remarkjs/remark-math/tree/main/packages/remark-html-katex 178 | 179 | [rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize 180 | -------------------------------------------------------------------------------- /lib/remark-math/util.js: -------------------------------------------------------------------------------- 1 | exports.isRemarkParser = isRemarkParser 2 | exports.isRemarkCompiler = isRemarkCompiler 3 | 4 | function isRemarkParser(parser) { 5 | return Boolean(parser && parser.prototype && parser.prototype.blockTokenizers) 6 | } 7 | 8 | function isRemarkCompiler(compiler) { 9 | return Boolean(compiler && compiler.prototype && compiler.prototype.visitors) 10 | } 11 | -------------------------------------------------------------------------------- /lib/remark.js: -------------------------------------------------------------------------------- 1 | // This is used in the components such as definition and important 2 | import remark from "remark"; 3 | import html from "remark-html"; 4 | import math from "../lib/remark-math"; 5 | export default function mdconvert(set, data) { 6 | const newchild = data.replace(/\\n /g, "\n"); 7 | remark() 8 | .use(math) 9 | .use(html) 10 | .process(newchild, function (err, file) { 11 | set(file); 12 | }); 13 | } 14 | -------------------------------------------------------------------------------- /lib/remarkSmartypants.js: -------------------------------------------------------------------------------- 1 | const visit = require("unist-util-visit"); 2 | const retext = require("retext"); 3 | const retextSmartypants = require("retext-smartypants"); 4 | export default function remarkSmartypants(options) { 5 | const processor = retext().use(retextSmartypants, options); 6 | function transformer(tree) { 7 | visit(tree, "text", (node) => { 8 | node.value = String(processor.processSync(node.value)); 9 | }); 10 | } 11 | return transformer; 12 | } 13 | -------------------------------------------------------------------------------- /lib/rendermath.js: -------------------------------------------------------------------------------- 1 | import renderMathInElement from "katex/dist/contrib/auto-render"; 2 | 3 | export default function math() { 4 | renderMathInElement(document.body, { 5 | delimiters: [ 6 | { left: "$$", right: "$$", display: true }, 7 | { left: "$", right: "$", display: false }, 8 | { left: "\\(", right: "\\)", display: false }, 9 | { left: "\\[", right: "\\]", display: true }, 10 | ], 11 | }); 12 | } 13 | -------------------------------------------------------------------------------- /lib/tree.js: -------------------------------------------------------------------------------- 1 | const dirTree = require("directory-tree"); 2 | 3 | function removesize(tree) { 4 | var prop; 5 | for (prop in tree) { 6 | if (prop === "size" || prop === "path" || prop === "type") { 7 | delete tree[prop]; 8 | } else if (prop === "children") { 9 | tree[prop] = tree[prop].filter( 10 | (item) => item.name.split(".")[1] !== "exercise" 11 | ); 12 | var element; 13 | for (element in tree[prop]) { 14 | removesize(tree[prop][element]); 15 | } 16 | } 17 | } 18 | } 19 | 20 | function removeexercise(tree) { 21 | var prop; 22 | for (prop in tree) { 23 | if (prop === "children") { 24 | tree[prop] = tree[prop].filter( 25 | (item) => item.name.split(".")[1] !== "exercise" 26 | ); 27 | var element; 28 | for (element in tree[prop]) { 29 | removeexercise(tree[prop][element]); 30 | } 31 | } 32 | } 33 | } 34 | 35 | export function getTree() { 36 | const tree = dirTree("notes"); 37 | removesize(tree); 38 | return tree; 39 | } 40 | 41 | export function getPaths() { 42 | const tree = dirTree("notes"); 43 | removeexercise(tree); 44 | const list = []; 45 | 46 | for (var i of tree.children) { 47 | list.push({ params: { slug: [i.name] } }); 48 | for (var j of i.children) { 49 | list.push({ params: { slug: [i.name, j.name] } }); 50 | for (var k of j.children) { 51 | if (k.name.endsWith(".md")) { 52 | list.push({ 53 | params: { 54 | slug: [ 55 | i.name, 56 | j.name, 57 | k.name.replace(/\.[^/.]+$/, ""), 58 | ], 59 | }, 60 | }); 61 | } else { 62 | list.push({ params: { slug: [i.name, j.name, k.name] } }); 63 | for (var l of k.children) { 64 | list.push({ 65 | params: { 66 | slug: [ 67 | i.name, 68 | j.name, 69 | k.name, 70 | l.name.replace(/\.[^/.]+$/, ""), 71 | ], 72 | }, 73 | }); 74 | } 75 | } 76 | } 77 | } 78 | } 79 | return list; 80 | } 81 | -------------------------------------------------------------------------------- /next-sitemap.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | siteUrl: "https://notes.samrobbins.uk", 3 | generateRobotsTxt: true, 4 | }; 5 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | eslint: { 3 | ignoreDuringBuilds: true, 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /notes/Certifications/AZ900/Architecture_and_Service.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Azure Architecture and Service Guarantees 3 | --- 4 | 5 | # Datacenters and Regions 6 | 7 | 8 | A geographical area on the planet containing at least one, but potentially multiple datacenters networked together 9 | 10 | 11 | Note that some services or features are only available in certain 12 | regions 13 | 14 | ## Special Regions 15 | 16 | - US DoD and Gov are separate datacenters specifically for government 17 | applications 18 | 19 | - China datacenters are managed by 21Vianet 20 | 21 | # Geographies 22 | 23 | Geographies are defined by geopolitical boundaries or county borders. 24 | This has the benefits: 25 | 26 | - Allow customers with specific compliance to keep their data close 27 | 28 | - Ensure data residency, sovereignty, compliance and resiliency 29 | requirements are honoured within geographical boundaries. 30 | 31 | - Ensure fault tolerance. 32 | 33 | 34 | The physical or geographic location of an organization's data or information. 35 | 36 | 37 | Azure has the following geographies: 38 | 39 | - Americas 40 | 41 | - Europe 42 | 43 | - Asia Pacific 44 | 45 | - Middle East and Africa 46 | 47 | # Availability Zones 48 | 49 | 50 | Physically separate datacenters within an Azure region 51 | 52 | 53 | This means that if one zone goes down, the other continues working 54 | 55 | ## Using Availability Zones 56 | 57 | Azure services that support availability zones fall in two categories: 58 | 59 | - Zonal services - Pin the resource to a specific zone 60 | 61 | - Zone-redundant services - Platform replicates automatically across 62 | zones 63 | 64 | # Region Pairs 65 | 66 | 67 | Another region within the same geography at least 300 miles away 68 | 69 | This reduces the likelihood of interruptions such as natural disasters. 70 | 71 | 72 | An availability zone sits within a region pair. So an availability zone may be two datacenters in the UK, and a region pair may be one in the UK and one in France 73 | 74 | 75 | Advantages of region pairs: 76 | 77 | - If there’s a large azure outage, one region out of every pair is 78 | prioritized to be restored as quickly as possible 79 | 80 | - Planned Azure updates are rolled out to paired regions one region at 81 | a time to minimise downtime and risk of application outage 82 | 83 | - Data continues to reside in the same geography as its pair for 84 | compliance purposes 85 | 86 | # Service Level Agreements 87 | 88 | 89 | Azure does not provide SLAs for most services under the Free or Shared tiers 90 | 91 | 92 | ## Performance targets 93 | 94 | An SLA provides performance targets for a product or service 95 | 96 | ## Uptime and connectivity guarantees 97 | 98 | Typical SLA ranges from 99.9% to 99.999% 99 | 100 | ## Service credits 101 | 102 | Define how Microsoft will respond if a product fails to perform to its 103 | SLA spec. 104 | 105 | The lower the uptime percentage, the greater the service credit 106 | percentage given 107 | 108 | ## Composing SLAs across services 109 | 110 | Calculating the SLA of two services together is just multiplying them 111 | 112 | However if you install redundancy such as two databases, the SLA is 113 | calculated with 114 | 115 | $$ 116 | 1-(\text{Failure chance of service 1} \times \text{Failure chance of service 2}) 117 | $$ 118 | 119 | And this result is then multiplied by the SLA of the other component to 120 | get the SLA 121 | 122 | ## Improving App Reliability 123 | 124 | 125 | The ability of a system to recover from failures and continue to function 126 | 127 | 128 | 129 | Identifying points of failure and defining how the application will respond to those failures 130 | 131 | 132 | 133 | The time that the system is functional and working 134 | 135 | 136 | Maximizing availability requires implementing measures to prevent 137 | service failures. However this can be difficult and expensive. 138 | 139 | You need to ensure that the minimum SLA in your system is one that you 140 | are happy with your service performing at. 141 | -------------------------------------------------------------------------------- /notes/Certifications/AZ900/Compute.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Azure Compute Options 3 | --- 4 | 5 | # Essential Azure compute concepts 6 | 7 | 8 | Software emulations of physical computers. 9 | 10 | 11 | 12 | A virtualization environment for running applications. Don't include an operating system for the apps running inside the container. Bundle the libraries and components needed to run the application and use the existing host OS running the container. 13 | 14 | 15 | 16 | Platform as a service designed to host web oriented applications. 17 | 18 | 19 | 20 | Cloud hosted execution environment that runs your code but abstracts the underlying hosting environments. 21 | 22 | 23 | # Azure Virtual Machines 24 | 25 | VMs are an ideal choice when you need: 26 | 27 | - Total control over the OS 28 | 29 | - The ability to run custom software 30 | 31 | - To use custom hosting configurations 32 | 33 | When to use virtual machines: 34 | 35 | - During testing and development 36 | 37 | - When running applications in the cloud 38 | 39 | - When extending your datacenter to the cloud 40 | 41 | - During disaster recovery 42 | 43 | ## Scaling VMs 44 | 45 | ### Availability set 46 | 47 | 48 | A logical grouping of two or more VMs that help keep your application available during planned or unplanned maintenance. 49 | 50 | 51 | 52 | When the underlying Azure fabric that hosts VMs is updated by Microsoft 53 | 54 | 55 | When the VM is part of an availability set, updates are sequenced so 56 | that not all the associated VMs are rebooted at the same time. They are 57 | put into different update domains 58 | 59 | 60 | Groups of VMs and underlying physical hardware that can be rebooted at the same time 61 | 62 | 63 | 64 | Hardware failure in the data centre, such as power outage or disk failure 65 | 66 | 67 | 68 | The group of virtual machines that all share common hardware that has failed. 69 | 70 | 71 | With an availability set you get: 72 | 73 | - Up to three fault domains that have a server rack with dedicated 74 | power and network resources 75 | 76 | - Five logical update domains which then can be increased to 10 77 | 78 | There is no cost for an availability set, just for the VMs in the set 79 | 80 | ### Virtual Machine Scale Sets 81 | 82 | Virtual machine scale sets let you create and manage a group of 83 | identical, load balanced VMs. 84 | 85 | This allows you to centrally manage, configure and update many VMs to 86 | provide highly available applications. 87 | 88 | ### Azure Batch 89 | 90 | Azure batch enables large scale job scheduling and compute management 91 | 92 | Batch: 93 | 94 | - Starts a pool of compute VMs for you 95 | 96 | - Installs applications and staging data 97 | 98 | - Runs jobs with as many tasks as you have 99 | 100 | - Identifies failures 101 | 102 | - Requeues work 103 | 104 | - Scales down the pool as work completes 105 | 106 | # Containers 107 | 108 | ## Azure Container Instances 109 | 110 | PaaS to upload containers and execute them directly with automatic 111 | elastic scale 112 | 113 | ## Azure Kubernetes Service 114 | 115 | A complete orchestration service for containers with multiple 116 | architectures with multiple containers 117 | 118 | 119 | The task of automating, managing and interacting with many containers 120 | 121 | 122 | ## Microservice architecture 123 | 124 | Breaking solutions into smaller, independent pieces. This allows the 125 | separate components of the app to be maintained, scaled or updated 126 | independently. 127 | 128 | ## Migrating to containers 129 | 130 | ![Migration to containers](/img/Certifications/AZ900/Compute/4-kub-migration.png) 131 | 132 | The process is as follows: 133 | 134 | 1. Convert the application to containers and publish to Azure Container 135 | Registry 136 | 137 | 2. Deploy the containers to an AKS cluster 138 | 139 | 3. Azure AD controls access to AKS resources 140 | 141 | 4. You access Azure services 142 | 143 | 5. Optionally, AKS is deployed with a virtual network 144 | 145 | # Azure App Service 146 | 147 | ## Costs 148 | 149 | You pay for the compute resources your app uses. The app service plan 150 | determines how much hardware is devoted to the host. There’s even a free 151 | tier for low traffic sites 152 | 153 | ## Types of app services 154 | 155 | - Web apps - Host web apps 156 | 157 | - API apps - Build REST-based Web APIs 158 | 159 | - Web Jobs - Run a program or script in the same context as a web app. 160 | They can be scheduled or run by a trigger 161 | 162 | - Mobile app back ends 163 | 164 | - Store mobile app data in a cloud based SQL database 165 | 166 | - Authenticate customers 167 | 168 | - Send push notifications 169 | 170 | - Execute custom back end logic 171 | 172 | # Serverless 173 | 174 | Serverless encompasses three ideas: 175 | 176 | - Abstraction of servers - Don’t need to manage them 177 | 178 | - Event-driven scale - Code runs when events come in 179 | 180 | - Micro billing - Only pay for the time code runs 181 | 182 | ## Azure functions 183 | 184 | Azure functions are ideal for when you’re only concerned about the code 185 | running your service. They commonly perform work in response to an 186 | event. 187 | 188 | Azure functions scale automatically based on demand. 189 | 190 | Azure functions can be either: 191 | 192 | - Stateless - Behave as if they’ve been restarted every time they 193 | respond to an event 194 | 195 | - Stateful - A context is passed through the function to track prior 196 | activity 197 | 198 | ## Azure Logic Apps 199 | 200 | Logic apps execute workflows designed to automate business scenarios and 201 | built from predefined logic blocks. 202 | 203 | Every logic app workflow starts with a trigger. Azure Logic apps can be 204 | designed without code. 205 | 206 | ## Comparison 207 | 208 | | | Functions | Logic apps | 209 | | --------------------- | --------------------------------------------------------------------- | ----------------------------------------------------- | 210 | | **Development** | Code First | Designer First | 211 | | **Connectivity** | Few built in bindings, write code for all else | large collection of connectors, write code for others | 212 | | **Actions** | Each activity is an Azure function; write code for activity functions | Large collection of ready made functions | 213 | | **Monitoring** | Azure application insights | Azure portal, Log Analytics | 214 | | **Management** | REST API, Visual Studio | Azure portal, REST API, PowerShell, Visual Studio | 215 | | **Execution context** | Locally and in cloud | Only in cloud | 216 | -------------------------------------------------------------------------------- /notes/Certifications/AZ900/Core_Cloud_Services.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Core Cloud Services 3 | --- 4 | 5 | # Compute 6 | 7 | | Service | Description | 8 | | -------------------------------- | ------------------------------------------------------------------------ | 9 | | Azure Virtual Machines | Windows or Linux VMs | 10 | | Azure Virtual Machine Scale Sets | Scaling for Azure VMs | 11 | | Azure Kubernetes Service | Enables management of a cluster of VMs that run containerized services | 12 | | Azure Service Fabric | Distributed systems platform | 13 | | Azure Batch | Managed service for parallel and high performance computing applications | 14 | | Azure container instances | Run containerized apps on Azure without provisioning servers or VMs | 15 | | Azure Functions | An event driven, serverless compute service | 16 | 17 | # Storage 18 | 19 | | Service | Description | 20 | | ------------------- | ------------------------------------------------------------------------------- | 21 | | Azure Blob storage | Storage service for very large objects, such as video files or bitmaps | 22 | | Azure File storage | File shares that you can access and manage like a file server | 23 | | Azure Queue storage | A data store for queueing and reliably delivering messages between applications | 24 | | Azure Table storage | A NoSQL store that hosts unstructured data independent of any schema | 25 | 26 | These services all share several common characteristics: 27 | 28 | - Durable 29 | 30 | - Secure 31 | 32 | - Scalable 33 | 34 | - Managed 35 | 36 | - Accessible 37 | 38 | # Networking 39 | 40 | | Service | Description | 41 | | ------------------------- | ------------------------------------------------------------------------ | 42 | | Azure Virtual Network | Connects VMs to incoming VPN connections | 43 | | Azure Load Balancer | Balances inbound and outbound connections to apps or service endpoints | 44 | | Azure Application Gateway | Optimizes app server farm delivery while increasing application security | 45 | | Azure VPN gateway | Access Azure Virtual Networks through VPN gateways | 46 | | Azure DNS | Provides fast DNS responses | 47 | | Azure CDN | Provides high bandwidth content to customers | 48 | | Azure DDoS protection | Protects Azure applications from DDoS attacks | 49 | | Azure Traffic Manager | Distributed network traffic across Azure regions worldwide | 50 | | Azure ExpressRoute | Connects to Azure over high bandwidth dedicated secure connections | 51 | | Azure Network Watcher | Monitors and diagnoses network issues using scenario based analysis | 52 | | Azure Firewall | High security and availability Firewall with unlimited scalability | 53 | | Azure Virtual WAN | Created a unified WAN connecting local and remote sites | 54 | 55 | # Mobile 56 | 57 | It is simple to include features such as SAP, Oracle, SQL Server and 58 | sharepoint for mobile apps. Other features of this service include: 59 | 60 | - Offline data synchronization 61 | 62 | - Connectivity to on-premises data 63 | 64 | - Broadcasting push notifications 65 | 66 | - Autoscaling to match business needs 67 | 68 | # Databases 69 | 70 | | Service | Description | 71 | | -------------------------------- | ----------------------------------------------------------------------------- | 72 | | Azure Cosmos DB | Globally distributed database that supports NoSQL options | 73 | | Azure SQL database | Fully managed relational database | 74 | | Azure database for MySQL | Fully managed and scalable MySQL relational database | 75 | | Azure Database for PostgreSQL | Fully managed and scalable PostgreSQL relational database | 76 | | SQL server on VMs | Host enterprise SQL server apps in the cloud | 77 | | Azure synapse analytics | Fully managed data warehouse | 78 | | Azure Database Migration Service | Migrate your databases to the cloud with no application code changes | 79 | | Azure Cache for Redis | Caches frequently used and static data to reduce data and application latency | 80 | | Azure Database for MariaDB | Fully managed and scalable MariaDB database | 81 | 82 | # Web 83 | 84 | | Service | Description | 85 | | ------------------------------------- | --------------------------------------------------------- | 86 | | Azure App Service | Create web-based apps | 87 | | Azure Notification Hubs | Send push notifications to any platform from any back end | 88 | | Azure API Management | Publish APIs | 89 | | Azure Cognitive Search | Search as a service | 90 | | Web apps feature of azure app service | Create and deploy mission critical apps | 91 | | Azure SignalIR Service | Add real time web functionalities | 92 | 93 | # IoT 94 | 95 | | Service | Description | 96 | | ------------- | ------------------------------------------ | 97 | | IoT Central | IoT SaaS | 98 | | Azure IoT Hub | Messaging hub for IoT devices | 99 | | IoT Edge | Push data analysis models onto IoT devices | 100 | 101 | # Big Data 102 | 103 | | Service | Description | 104 | | ---------------- | ------------------------------------------ | 105 | | Azure HDInsight | process data with Hadoop in the cloud | 106 | | Azure Databricks | Collaborative Apache Spark based analytics | 107 | 108 | # AI 109 | 110 | | Service | Description | 111 | | ------------------------------ | ------------------------------ | 112 | | Azure Machine Learning Service | In depth machine learning | 113 | | Azure Machine Learning Studio | Drag and drop machine learning | 114 | 115 | # Cognitive services 116 | 117 | | Service | Description | 118 | | --------------------------- | ---------------------------------------------------------- | 119 | | Vision | Image processing algorithms | 120 | | Speech | Convert spoken audio to text or use voice for verification | 121 | | Knowledge mapping | Map information and data to solve tasks | 122 | | Bing search | Use bing search API | 123 | | Natural language processing | Allow apps to process natural language | 124 | 125 | # DevOps 126 | 127 | | Service | Description | 128 | | ------------------ | --------------------------------------------------------------------- | 129 | | Azure DevOps | High performance pipelines, Git repos, Kanban boards and load testing | 130 | | Azure DevTest Labs | Create Windows and Linux environments for testing | 131 | -------------------------------------------------------------------------------- /notes/Certifications/AZ900/Costs_and_Spending.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Predict costs and optimize spending for Azure 3 | --- 4 | 5 | # Purchasing Azure products and services 6 | 7 | At the end of each monthly billing cycle, the usage values will be 8 | charges to your payment method and the meters are reset. 9 | 10 | You can deallocate a VM so that it is not assigned to a CPU or network 11 | in a datacenter, but the physical disks maintain so that it is easy to 12 | resume it. 13 | 14 | # Factors affecting cost 15 | 16 | ## Resource Type 17 | 18 | Costs are resource specific, so different resources cost different 19 | amounts 20 | 21 | ## Services 22 | 23 | Azure usage rates differ between Enterprise, Web Direct and CSP 24 | customers 25 | 26 | ## Location 27 | 28 | Cost depends on what datacenter is running the service due to efficiency 29 | and cost of local resources 30 | 31 | ## Azure Billing Zones 32 | 33 | Data transfer pricing depends on what zones are being used 34 | 35 | # Saving on infrastructure costs 36 | 37 | ## Azure Credits 38 | 39 | Visual Studio subscribers get a monthly credit benefit for testing 40 | 41 | ## Use spending limits 42 | 43 | You can set a limit so that you aren’t charged once you have used up 44 | your credits. This is specific to subscriptions that include a monthly 45 | Azure credit allotment 46 | 47 | ## Reserved instances 48 | 49 | If you know you have static and predictable costs, you can reserve for 50 | one or three year to save money 51 | 52 | ## Low cost locations and regions 53 | 54 | Some regions are cheaper, so ensure all resources are in that region or you 55 | will have a cost of sending data between regions 56 | 57 | ## Reduce the size of Virtual machines 58 | 59 | Oversized virtual machines will cost money for performance that isn’t 60 | being used 61 | 62 | ## Deallocate virtual machines in off hours 63 | 64 | You can use the auto shutdown feature to either reduce capacity by 65 | reducing the number of virtual machines behind a load balancer or stopping a 66 | service 67 | 68 | ## Migrate to PaaS or SaaS 69 | 70 | The higher up you go, the cheaper the cost 71 | 72 | # Save on licensing cost 73 | 74 | In Linux you don’t have to pay a licence cost. 75 | 76 | ## Azure Hybrid Benefit 77 | 78 | If you already have a Windows Server Licence covered by software 79 | assurance, you can get a large discount by using this licence in Azure. 80 | 81 | ### Azure Hybrid Benefit for SQL Server 82 | 83 | Similarly, SQL licences can be given for a saving. 84 | 85 | ## Use Dev/Test subscription offers 86 | 87 | By specifying you are in a non-production environment, you don’t need to 88 | pay a licence fee 89 | 90 | ## Bring your own SQL server license 91 | 92 | If you are on an Enterprise agreement and have an investment in SQL 93 | server licences, you can use this in Virtual Machines for free. 94 | 95 | ## Use SQL server developer edition 96 | 97 | SQL server developer edition is a free product for non-production use 98 | 99 | ## Use constrained instance sizes of database workloads 100 | 101 | SQL server costs are per core, so by reducing the number of cores, you 102 | can save on cost 103 | -------------------------------------------------------------------------------- /notes/Certifications/AZ900/Creating_an_account.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Creating an Azure Account 3 | --- 4 | 5 | # Purchasing Options 6 | 7 | - **Azure.com** - Fastest and easiest 8 | 9 | - **Microsoft Representative** - Intended for large organizations 10 | 11 | - **Microsoft partner** - Partner provides access to Azure, manages 12 | billing and provides support. 13 | 14 | # Azure Billing 15 | 16 | ## Azure subscription 17 | 18 | **Azure subscription** - a logical container used to provision resources 19 | in Azure. 20 | 21 | You might want to create additional subscriptions to separate: 22 | 23 | - **Environments** - development and testing 24 | 25 | - **Organisational structures** - different departments 26 | 27 | - **Billing** - manage and track costs 28 | 29 | You may also need additional subscriptions due to subscription limits as 30 | they have hard limits, such as the max number of Express Route circuits 31 | per subscription is 10. 32 | 33 | ![Billing structure](/img/Certifications/AZ900/Account/4-billing-structure-overview.png) 34 | 35 | # Support options 36 | 37 | ## Free resources 38 | 39 | - Online documentation 40 | 41 | - Community support 42 | 43 | - Azure Knowledge Center 44 | 45 | - Microsoft Tech Community 46 | 47 | - Stack Overflow 48 | 49 | - Server Fault 50 | 51 | - Azure Feedback Forums 52 | 53 | - Twitter 54 | 55 | - Demo videos 56 | 57 | - Billing and subscription management support 58 | 59 | - Azure Quickstart Center 60 | 61 | - Azure Service Health 62 | 63 | - Azure Advisor 64 | 65 | ## Support plans 66 | 67 | | | Developer | Standard | Professional Direct | 68 | | ------------------------------- | ---------------------- | -------------------- | ----------------------------------------- | 69 | | **Best for** | Non-critical workloads | Production workloads | Business-critical workloads | 70 | | **Reactive technical support** | 1 business day | 1 hour for critical | 1 hour and priority tracking for critical | 71 | | **Proactive technical support** | N/A | N/A | Access to a pool of technical experts | 72 | -------------------------------------------------------------------------------- /notes/Certifications/AZ900/Data_Storage.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Azure Data Storage Options 3 | --- 4 | 5 | # Benefits of storing data in the cloud 6 | 7 | - Automated backup and recovery 8 | 9 | - Replication across the globe 10 | 11 | - Support for data analytics 12 | 13 | - Encryption capabilities 14 | 15 | - Multiple data types 16 | 17 | - Data storage in virtual disks 18 | 19 | - Storage tiers 20 | 21 | ## Types of data 22 | 23 | 24 | Data that adheres to a schema. Relational data 25 | 26 | 27 | 28 | Using tags and keys to provide hierarchy. Used in NoSQL databases 29 | 30 | 31 | 32 | Data with no designated structure 33 | 34 | 35 | # Azure Data storage 36 | 37 | ## Azure SQL database 38 | 39 | Relational Database as a service. Based on Microsoft SQL Server database 40 | engine. 41 | 42 | Uses the Microsoft Data Migration Assistant to generate reports to guide 43 | through migration. 44 | 45 | ## Azure Cosmos DB 46 | 47 | Globally distributed database service supporting schema-less data 48 | (NoSQL). Used for highly responsive and always-on applications 49 | 50 | ## Azure Blob storage 51 | 52 | Holds unstructured data 53 | 54 | ## Azure data lake 55 | 56 | Allows you to perform analytics on your data usage and prepare reports. 57 | Data lake is a large repository that stores both structured and 58 | unstructured data. 59 | 60 | ## Azure Files 61 | 62 | Offers fully managed file shares in the cloud over SMB (Server Message 63 | Block). 64 | 65 | ## Azure Queue 66 | 67 | Used for storing large numbers of messages 68 | 69 | Can be used to: 70 | 71 | - Create a backlog of work and to pass messages between different 72 | Azure web servers 73 | 74 | - Distribute load among different web servers/infrastructure and to 75 | manage bursts of traffic 76 | 77 | - Build resilience against component failure when multiple users 78 | access your data at the same time 79 | 80 | ## Disk storage 81 | 82 | Provides disks for virtual machines and other services to access as they 83 | need. Comes in many different sizes and performance levels, from SSDs to 84 | HDDs. 85 | 86 | ## Storage tiers 87 | 88 | Azure offers 3 storage tiers for blob object storage 89 | 90 | 1. Hot storage - Accessed frequently 91 | 92 | 2. Cool storage - Infrequent access 93 | 94 | 3. Archive storage - Rarely accessed 95 | 96 | ## Encryption and replication 97 | 98 | The following encryption types are available for your resources: 99 | 100 | - Azure Storage Service Encryption (SSE) - For data at rest. Encrypts 101 | before storing and decrypts during retrieval 102 | 103 | - Client side encryption - Data already encrypted by the client 104 | libraries. Decrypted during retrieval 105 | 106 | # Comparison with on premises storage 107 | 108 | | Needs | On Premises | Azure data storage | 109 | | -------------------------------------------------- | ------------------------------------------------------------------ | ----------------------------------------------------------------- | 110 | | Compliance and security | Dedicated servers required for privacy and security | Client side encryption and encryption at rest | 111 | | Store structured and unstructured data | Additional IT resources with dedicated servers required | Azure data lake and portal analyses and manages all types of data | 112 | | Replication and high availability | More resources, licensing and servers required | Built in replication and redundancy features available | 113 | | Application sharing and access to shared resources | File sharing requires additional administration resources | File sharing options without additional license | 114 | | Relational data storage | Needs a database server with database admin role | Offers DBaaS options | 115 | | Distributed storage and data access | Expensive storage, networking and compute resources needed | Azure Cosmos DB provides distributed access | 116 | | Messaging and load balancing | Hardware redundancy impacts budget and resources | Azure Queue provides effective load balancing | 117 | | Tiered storage | Management of tiered storage needs technology and labour skill set | Azure offers automated tiered storage of data | 118 | -------------------------------------------------------------------------------- /notes/Certifications/AZ900/Managing_Services.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Managing services with the Azure portal 3 | --- 4 | 5 | # Azure management options 6 | 7 | Tools that are commonly used for management include: 8 | 9 | - Azure portal 10 | 11 | - Access with any web browser 12 | 13 | - Doesn’t provide a way to automate repetitive tasks 14 | 15 | - Azure Powershell 16 | 17 | - Module for windows powershell or powershell core (crossplatform 18 | version of powershell) 19 | 20 | - Allows you to automate repetitive tasks 21 | 22 | - Azure CLI 23 | 24 | - Cross platform 25 | 26 | - Commands start with `az` 27 | 28 | - Azure Cloud Shell 29 | 30 | - Interactive, authenticated browser-accessible shell 31 | 32 | - Can use either bash or powershell 33 | 34 | - Range of CLI tools already installed such as git 35 | 36 | - Azure Mobile App 37 | 38 | - Both iOS and Android 39 | 40 | - Easy to check status 41 | 42 | - Access Azure Cloud Shell 43 | 44 | - Other Options 45 | 46 | - Azure SDKs for range of language 47 | 48 | - REST APIs 49 | 50 | # Navigating the portal 51 | 52 | - Resource Panel - Left sidebar. Can customize with specific 53 | resources. 54 | 55 | - Azure Marketplace - Good for creating new resources in Azure. 56 | Provision applications and services from service providers 57 | 58 | - Directory and Subscription - Change between subscriptions 59 | 60 | - Help Pane 61 | 62 | - Create new support requests 63 | 64 | - Documentation and other guided support 65 | 66 | - Azure Advisor 67 | 68 | - Get proactive, actionable and personalized best practice 69 | recommendations 70 | 71 | - Improve performance, security and availability of resources 72 | 73 | # Azure Portal dashboards 74 | 75 | ## What is a dashboard? 76 | 77 | 78 | Customizable collection of UI tiles displayed in the Azure Portal 79 | 80 | 81 | Dashboards are stored as JSON files, making them easy to transfer. 82 | 83 | ## Sharing a dashboard 84 | 85 | You can share a dashboard in a resource group. 86 | 87 | # Preview features 88 | 89 | Common areas you will see previews for: 90 | 91 | - New storage types 92 | 93 | - New Azure services 94 | 95 | - New or enhanced integration with other platforms 96 | 97 | - New APIs for services 98 | 99 | 100 | When a feature is released as part of Azure's default product set after evaluation and testing 101 | 102 | 103 | ## Preview Categories 104 | 105 | 106 | Available to specific Azure customers. Typically, invite only 107 | 108 | 109 | 110 | Available to all Azure customers for evaluation 111 | 112 | -------------------------------------------------------------------------------- /notes/Certifications/AZ900/Networking.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Azure Networking Options 3 | --- 4 | 5 | # Deploying your site to Azure 6 | 7 | ## Using an N tier architecture 8 | 9 | An architectural pattern that can be used to build loosely-coupled 10 | systems is N-tier 11 | 12 | This divides an architecture into two or more logical tiers. 13 | Architecturally, a higher tier can access services from a lower tier, 14 | but a lower tier should never access a higher tier. 15 | 16 | Tiers help separate concerns and ideally are designed to be reusable. 17 | Using a tiered architecture also simplifies maintenance. Tiers can be 18 | updated or replaced independently, and new tiers can be inserted if 19 | needed. 20 | 21 | ## Virtual Network 22 | 23 | 24 | A logically isolated network on Azure 25 | 26 | 27 | A virtual network allows Azure resources to securely communicate with 28 | each other, the internet and on premises networks. 29 | 30 | A virtual network is scoped to a single region; however, multiple 31 | virtual networks from different regions can be connected together using 32 | virtual network peering. 33 | 34 | Virtual networks can be segmented into one or more subnets to allow you 35 | to organize and secure your resources into discrete sections. 36 | 37 | For VMs that the users interact with directly, such as the web tier, the 38 | VM will have both a public and private IP, whereas other tiers will just 39 | have private IPs. 40 | 41 | 42 | Allows a secure connection between an Azure Virtual Network and an on-premises location over the internet 43 | 44 | 45 | ## Network security group 46 | 47 | This allows or denies inbound network traffic to your Azure resources in 48 | a similar way to a firewall. 49 | 50 | # Azure Load Balancer 51 | 52 | 53 | How long your service is up and running without interruption 54 | 55 | 56 | 57 | A system's ability to stay operational during abnormal conditions 58 | 59 | 60 | 61 | A way of distributing traffic evenly among each system in a pool 62 | 63 | 64 | The user connects to the load balancer, which then decides which Virtual 65 | Machine will process the request. This also allows you to run 66 | maintenance tasks without interrupting service as the load balancer 67 | detects that the VM is unresponsive and directs traffic to other VMs in 68 | the pool. 69 | 70 | ## What is Azure load balancer? 71 | 72 | You can use it with: 73 | 74 | - Incoming internet traffic 75 | 76 | - Internal traffic across Azure services 77 | 78 | - Port forwarding for specific traffic 79 | 80 | - Outbound connectivity for VMs in your virtual network 81 | 82 | With Azure load balancer, there’s no infrastructure or software to 83 | maintain, just a set of rules. 84 | 85 | ## Azure Application Gateway 86 | 87 | Azure Application gateway is a load balancer for web applications. It 88 | uses Azure Load balancer at the transport level but uses routing rules 89 | for more advanced scenarios. 90 | 91 | Benefits over a load balancer: 92 | 93 | - Cookie affinity 94 | 95 | - SSL termination 96 | 97 | - Web application firewall 98 | 99 | - URL rule based routes 100 | 101 | - Rewrite HTTP headers 102 | 103 | # Azure Traffic Manager 104 | 105 | 106 | The time it takes for data to travel over the network 107 | 108 | 109 | One way to improve network latency is to scale out exact copies of your 110 | service to more than one region 111 | 112 | Azure Traffic Manager uses the DNS server that’s closest to the user to 113 | direct user traffic to a globally distributed endpoint. 114 | -------------------------------------------------------------------------------- /notes/Certifications/AZ900/Policy.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Apply and monitor infrastructure standards with Azure Policy 3 | --- 4 | 5 | # IT Compliance 6 | 7 | 8 | An Azure service to create, assign and manage policies 9 | 10 | 11 | RBAC focuses on user actions at different scopes whereas Azure Policy 12 | focuses on resource properties during deployment. Azure Policy is a 13 | default allow and explicit deny system, in contrast with RBAC 14 | 15 | ## Creating a policy 16 | 17 | To apply a policy you will: 18 | 19 | - Create a policy definition 20 | 21 | - Assign a definition to a scope of resources 22 | 23 | - View policy evaluation results 24 | 25 | ### Policy definition 26 | 27 | A policy definition expresses what to evaluate and what action to take 28 | 29 | The policy definition itself is represented as a JSON file 30 | 31 | ### Applying Azure Policy 32 | 33 | This can be done using the Azure portal or one of the command line 34 | tools. It takes the following parameters: 35 | 36 | | Parameter | Description | 37 | | ----------- | ------------------------------------------------------------------------------------------------- | 38 | | Name | The actual name of the assignment | 39 | | DisplayName | Display name for the policy assignment | 40 | | Definition | The policy definition, based on which you're using to create the assignment | 41 | | Scope | A scope determines what resources or grouping of resources the policy assignment gets enforced on | 42 | 43 | ## Identifying non-compliant resources 44 | 45 | We can use the applied policy definition to identify resources that 46 | aren’t compliant with the policy assignment through the Azure portal. 47 | Similarly, this can be done through the command line 48 | 49 | ## Assigning a definition to a scope of resources 50 | 51 | 52 | A policy definition that has been assigned to take place within a specific scope 53 | 54 | 55 | Policy assignments are inherited by all child resources. This 56 | inheritance means that if a policy is applied to a resource group, it is 57 | applied to that resource group. 58 | 59 | ## Policy effects 60 | 61 | | Policy effect | What happens | 62 | | ----------------------- | ------------------------------------------------------------------------------------ | 63 | | Name | The actual name of the assignment | 64 | | Deny | The resource creation/update fails due to policy | 65 | | Disabled | The policy rule is ignored | 66 | | Append | Adds additional parameters/field to the requested resource during creation or update | 67 | | Audit, AuditifNotExists | Creates a warning event in the activity log, but doesn't stop the request | 68 | | DeployIfNotExists | Executes a template deployment when a specific condition is met | 69 | 70 | # Organise policy with initiatives 71 | 72 | 73 | A set or group of policy definitions to help track your compliance state for a larger goal 74 | 75 | 76 | 77 | An initiative definition assigned to a specific scope 78 | 79 | 80 | # Enterprise governance management 81 | 82 | 83 | Containers for managing access, policies and compliance across multiple Azure subscriptions 84 | 85 | 86 | Management groups allow you to order your Azure resources hierarchically 87 | into collections, which provide a further level of classification that 88 | is above the level of subscriptions. 89 | 90 | # Azure Blueprints 91 | 92 | Azure Blueprints is a declarative way to orchestrate the deployment of 93 | various resource templates and other artefacts such as: 94 | 95 | - Role assignments 96 | 97 | - Policy assignments 98 | 99 | - Azure resource manager templates 100 | 101 | - Resource groups 102 | 103 | The process of implementing Azure Blueprints consists of the following 104 | high-level steps: 105 | 106 | 1. Create an Azure Blueprint 107 | 108 | 2. Assign the blueprint 109 | 110 | 3. Track the blueprint assignments 111 | 112 | The Azure Blueprints service is backed by the Azure Cosmos database to 113 | provide low latency and high availability. 114 | 115 | ## Comparison with Resource Manager Templates 116 | 117 | Blueprints sit above Resource Manager Templates, also including resource 118 | groups, policies and role assignments. 119 | 120 | Blueprints can be managed directly in Azure, whereas Resource Manager 121 | Templates have to be managed separately. 122 | 123 | ## Comparison with Azure Policy 124 | 125 | Including a policy in a blueprint enables the creation of the right 126 | pattern or design during assignment of the blueprint. 127 | 128 | # Compliance Manager 129 | 130 | Microsoft provides resource transparency using the following tools 131 | 132 | ## Microsoft Privacy Statement 133 | 134 | This explains what personal data Microsoft processes, how it is 135 | processed and for what purpose 136 | 137 | ## Microsoft trust center 138 | 139 | This contains all the details about how Microsoft implements and 140 | supports security, privacy, compliance and transparency in all Microsoft 141 | cloud products. 142 | 143 | ## Service Trust Portal 144 | 145 | This hosts the compliance manager service and is the Microsoft public 146 | site for publishing audit reports. 147 | 148 | ## Compliance Manager 149 | 150 | This provides the following features: 151 | 152 | - Combines 153 | 154 | 1. Audit results 155 | 156 | 2. Information Microsoft compiles internally for its compliance 157 | with regulations 158 | 159 | 3. An organisation’s self-assessment of their own compliance with 160 | these standards and regulations 161 | 162 | - Enables you to assign, track, and record compliance and 163 | assessment-related activities 164 | 165 | - Provides a compliance score to track progress 166 | 167 | - Provides a repository for managing evidence relating to compliance 168 | 169 | - Produces reports 170 | 171 | # Monitoring service health 172 | 173 | ## Azure Monitor 174 | 175 | This maximizes the availability and performance of applications using 176 | telemetry. 177 | 178 | ### Data sources 179 | 180 | | Data Tier | Description | 181 | | ---------------------------------- | --------------------------------------------------------------------------------- | 182 | | Application monitoring data | Data about the performance and functionality of written code | 183 | | Guest OS monitoring data | Data about the OS your application is running | 184 | | Azure resource monitoring data | Data about the operation of an Azure resource | 185 | | Azure subscription monitoring data | Data about the operation and management of an Azure subscription and Azure itself | 186 | | Azure tenant monitoring data | Data about the operation of tenant-level Azure services | 187 | 188 | ### Diagnostic Settings 189 | 190 | **Activity logs** record when resources are created or modified 191 | 192 | **Metrics** tell you how the resource is performing and the resources 193 | it’s consuming 194 | 195 | You can enable diagnostics 196 | 197 | - Enable guest-level monitoring 198 | 199 | - Performance counters - collect performance data 200 | 201 | - Event logs - Enable various event logs 202 | 203 | - Crash dumps - enable or disable 204 | 205 | - Sinks - send your diagnostic data to other services for more 206 | analysis 207 | 208 | - Agent - configure agent settings 209 | 210 | ### Getting more data from your apps 211 | 212 | Application insights - Monitors the availability, performance and usage 213 | of your web applications 214 | 215 | Azure Monitor for containers - Monitors the performance of container 216 | workloads 217 | 218 | Azure Monitor for VMs - Monitors the performance and health of your 219 | Windows and Linux VMs 220 | 221 | ### Responding to alert notifications 222 | 223 | Alerts - Azure notifies you of critical conditions using alerts and can 224 | attempt to take corrective actions 225 | 226 | Autoscale - Ensures you have the right amount of resources running to 227 | manage the load on your application effectively 228 | 229 | ## Azure Service Health 230 | 231 | This provides guidance when issues with Azure notify you. It is composed 232 | of the following views: 233 | 234 | - Azure Status - Global view of the health state of Azure Services 235 | 236 | - Service health - Tracks the state of your services in the regions 237 | you use them 238 | 239 | - Resource health - Diagnose and support when an Azure service issue 240 | affects your resources 241 | -------------------------------------------------------------------------------- /notes/Certifications/AZ900/Principles_of_cloud_computing.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Principles of cloud computing 3 | --- 4 | 5 | # What is cloud computing 6 | 7 | Services typically offered 8 | 9 | - Compute power 10 | 11 | - Storage 12 | 13 | - Networking 14 | 15 | - Analytics 16 | 17 | Containers - Provide a consistent, isolated execution environment for 18 | applications. 19 | 20 | - Standard runtime environment used to execute the app 21 | 22 | - Leading platform is docker 23 | 24 | Serverless computing - Run application code without creating, 25 | configuring or maintaining a server 26 | 27 | - Application is broken into separate functions that run when 28 | triggered by some action 29 | 30 | - Only pay for the processing time used by each function as it 31 | executes 32 | 33 | # Benefits of cloud computing 34 | 35 | Cost effective 36 | 37 | - No upfront infrastructure costs 38 | 39 | - Not buying infrastructure that isn’t fully utilised 40 | 41 | - Can scale up and down with demand 42 | 43 | Scalability 44 | 45 | - Vertical scaling (scaling up) 46 | 47 | - Adding more resources to a server 48 | 49 | - Horizontal scaling (scaling out) 50 | 51 | - Adding more servers 52 | 53 | Elasticity 54 | 55 | - Automatically adding more resources to handle traffic 56 | 57 | Current 58 | 59 | - Don’t have to think about having current hardware and patches 60 | 61 | Reliability (Microsoft responsibility) 62 | 63 | - Provided backup, recovery replication etc 64 | 65 | - Fault tolerance 66 | 67 | Global 68 | 69 | - Fully redundant datacenters 70 | 71 | - High availability (shared responsibility) 72 | 73 | - Lower customer latency 74 | 75 | Security (shared responsibility) 76 | 77 | - Both physical and digital 78 | 79 | Agility (speed to set up) 80 | 81 | # Compliance terms and requirements 82 | 83 | Questions include: 84 | 85 | - How compliant is the cloud provider when it comes to handling 86 | sensitive data? 87 | 88 | - How compliant are the services offered by the cloud provider? 89 | 90 | - How can I deploy my own cloud-based solutions to scenarios that have 91 | accreditation or compliance requirements? 92 | 93 | - What terms are part of the privacy statement for the provider? 94 | 95 | # Economies of scale 96 | 97 | - Less expensive 98 | 99 | - More efficient 100 | 101 | - Pass benefits on 102 | 103 | # CapEx vs OpEx 104 | 105 | ## CapEx (Capital expenditure) 106 | 107 | - Spend on physical infrastructure 108 | 109 | - Storage 110 | 111 | - Network 112 | 113 | - Backup and archive 114 | 115 | - Organisation continuity and disaster recovery 116 | 117 | - Datacentre infrastructure 118 | 119 | - Technical personnel 120 | 121 | ## Benefits 122 | 123 | Fixed costs make prediction easier 124 | 125 | ## OpEx (operational expenditure) 126 | 127 | - Monthly bill 128 | 129 | - Pay as you go 130 | 131 | - Get set up immediately 132 | 133 | - No upfront costs 134 | 135 | - Leasing software and customised features 136 | 137 | - Scaling charges based on usage/demand 138 | 139 | - Billing at the user or organisation level 140 | 141 | Azure follows a consumption based model, which just has operational 142 | expenditure 143 | 144 | ## Benefits 145 | 146 | Easier to respond to change 147 | 148 | # Types of cloud models 149 | 150 | | Name | Description | Advantages | Disadvantages | 151 | | ------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 152 | | Private Cloud | Cloud set up in own datacenter |
    • Ensure the configuration is as needed
    • Control over security and compliance
    |
    • Some initial CapEx costs
    • Limited agility
    • Require IT skills
    | 153 | | Public cloud | No local hardware, all running on cloud provider's hardware |
    • High scalability/agility
    • Pay-as-you-go pricing
    • Not responsible for maintenance and updates of the hardware
    • Minimal technical knowledge required
    |
    • May be security requirement that can't be met
    • May be government policies, industry standards or legal requirements that can't be met
    • Can't manage hardware in the way you want to
    • May not work with legacy applications
    | 154 | | Hybrid Cloud | Combining public and private clouds |
    • Keep any legacy systems running
    • Flexibility to choose where things run
    • Get economies of scale from public cloud where available
    • Meet more compliance
    • Run things where it is most appropriate
    | Increased cost and complexity | 155 | 156 | # Types of cloud services 157 | 158 | ## IaaS 159 | 160 | Most flexible category; gives control over hardware. 161 | 162 | Commonly used for: 163 | 164 | - Migrating workflows 165 | 166 | - Test and development 167 | 168 | - Storage, backup and recovery 169 | 170 | **Shared responsibility model** - Cloud provider ensures infrastructure 171 | is working correctly, customer makes sure the service they are using is 172 | configured correctly, is up to date and is available to users. 173 | 174 | ## PaaS 175 | 176 | Provides an environment for building, testing and deploying software 177 | applications. Don’t have to manage infrastructure. 178 | Commonly used for: 179 | 180 | - Development framework 181 | 182 | - Analytics or business intelligence 183 | 184 | ## SaaS 185 | 186 | Only responsible for data+access 187 | 188 | Access in Azure via marketplace 189 | 190 | Pay-as-you-go pricing 191 | 192 | Users pay for software they use on a subscription model 193 | 194 | ## Cost and Ownership 195 | 196 | | | IaaS | PaaS | SaaS | 197 | | ------------------------ | -------------------------------------------------------------- | ------------------------------------------------- | -------------------------------------------------------------- | 198 | | Upfront costs | None, pay for consumption | None, pay for consumption | None, pay subscription | 199 | | User ownership | User responsible for software, OS, middleware and applications | User responsible for development of applications | Users just use software | 200 | | Cloud provider ownership | Infrastructure is available to user | OS, Network and service | Provision, management and maintenance of application software. | 201 | 202 | ![5 Layer Diagram](/img/Certifications/AZ900/Principles/5-layer-diagram.png) 203 | -------------------------------------------------------------------------------- /notes/Certifications/AZ900/Resource_Manager.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Control and organize Azure resources with Azure Resource Manager 3 | --- 4 | 5 | # Principles of resource groups 6 | 7 | 8 | A logical container for resources deployed on Azure 9 | 10 | 11 | All resources must be in a resource group and a resource can only be a 12 | member of a single resource group. 13 | 14 | If you delete a resource group, all resources container within are also 15 | deleted. 16 | 17 | Resource groups are a scope for applying RBAC to limit access to allow 18 | only what is needed 19 | 20 | # Using tagging to organise resources 21 | 22 | 23 | Name/value pairs of text data that you can apply to resources and resource groups 24 | 25 | 26 | A resource can have up to 50 tags 27 | 28 | Tags can be used to group billing data or to keep track of usage for 29 | different projects 30 | 31 | Not all resources support tags, so you need to check if your resource 32 | supports them 33 | 34 | # Resource locks 35 | 36 | 37 | A setting that can be applied to any resource to block modification or deletion 38 | 39 | 40 | Resource locks can be either: 41 | 42 | - Delete - Allow all operations against the resource but block the 43 | ability to delete it 44 | 45 | - Read-only - Only allow read activities to be performed against it, 46 | blocking any modification or deletion of the resource 47 | -------------------------------------------------------------------------------- /notes/Certifications/AZ900/Security.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Security, responsibility and trust in Azure 3 | --- 4 | 5 | # Shared responsibility of cloud security 6 | 7 | ![Shared-Responsibilities-of-cloud-security](/img/Certifications/AZ900/Security/2-shared_responsibilities.png) 8 | 9 | Regardless of the deployment type, you always retain responsibility for: 10 | 11 | - Data 12 | 13 | - Endpoints 14 | 15 | - Accounts 16 | 17 | - Access Management 18 | 19 | ## Layered approach to security 20 | 21 | ### Data 22 | 23 | It is the responsibility of those storing and controlling access to the 24 | data to ensure that it’s properly secured. There are often regulatory 25 | requirements for the CIA of this data 26 | 27 | ### Application 28 | 29 | - Ensure applications are secure and free of vulnerabilities 30 | 31 | - Store sensitive application secrets in a secure storage medium 32 | 33 | - Make security a design requirement for all application development 34 | 35 | ### Compute 36 | 37 | - Secure access to virtual machines 38 | 39 | - Implement endpoint protection and keep systems patched and current 40 | 41 | ### Networking 42 | 43 | - Limit communication between resources 44 | 45 | - Deny by default 46 | 47 | - Restrict inbound internet access and limit outbound, where 48 | appropriate 49 | 50 | - Implement secure connectivity to on-premises networks 51 | 52 | ## Perimeter 53 | 54 | - Use DDoS protection 55 | 56 | - Use perimeter firewalls to identify and alert on malicious attacks 57 | against your network 58 | 59 | ## Identity and access 60 | 61 | - Control access to infrastructure and change control 62 | 63 | - Use single sign-on and multi-factor authentication 64 | 65 | - Audit events and changes 66 | 67 | ## Physical security 68 | 69 | - Physical building security and controlling access to computing 70 | hardware within the data center is the first line of defence 71 | 72 | # Azure Security Center 73 | 74 | Security Center can: 75 | 76 | - Provide security recommendations based on your configurations, 77 | resources and networks 78 | 79 | - Monitor security settings and automatically apply required security 80 | to new services 81 | 82 | - Continuously monitor services to provide automatic security 83 | assessments 84 | 85 | - Use machine learning to detect and block malware from being installed 86 | 87 | - Analyse and identify inbound attacks 88 | 89 | - Provide just-in-time access control for ports 90 | 91 | ## Pricing Tiers 92 | 93 | - Free - Just assessments and recommendations of resources 94 | 95 | - Standard - Including continuous monitoring, threat detection etc. 96 | 97 | ## Usage scenarios 98 | 99 | You can use Security Center to: 100 | 101 | - Detect - Review the first indication of an event investigation 102 | 103 | - Assess - Perform the initial assessment to obtain more information 104 | about the suspicious activity 105 | 106 | - Implement a recommended security policy 107 | 108 | # Identity and access 109 | 110 | 111 | Establish the identity of a person or service looking to access a resource 112 | 113 | 114 | 115 | Establish what level of access an authenticated person or service has 116 | 117 | 118 | ## Azure Active Directory 119 | 120 | Azure AD provides services such as: 121 | 122 | - Authentication 123 | 124 | - Single Sign-On - One ID and password for multiple services 125 | 126 | - Application management 127 | 128 | - Business-to-Business identity services 129 | 130 | - Business-to-Customer identity services 131 | 132 | - Device management 133 | 134 | ## Providing identities to services 135 | 136 | ### Service Principals 137 | 138 | 139 | A thing that can be authenticated 140 | 141 | 142 | 143 | An identity acting with certain roles or claims 144 | 145 | 146 | 147 | An identity that is used by a service or application 148 | 149 | 150 | ### Managed identities for Azure services 151 | 152 | This makes creating service principles easier. A managed identity can be 153 | instantly created for any Azure service that supports it. 154 | 155 | ## Role based access control 156 | 157 | Roles are sets of permissions that users can be granted to access an 158 | Azure service instance. 159 | 160 | Identities are mapped to roles directly or through group membership. 161 | 162 | Roles can be granted at the individual service instance level, but they 163 | also flow down the Azure Resource Manager hierarchy. 164 | 165 | ### Privileged Identity Management 166 | 167 | This is an additional offering that provides oversight of role 168 | assignments to ensure people don’t have excess privileges. 169 | 170 | # Encryption 171 | 172 | 173 | Uses the same key to encrypt and decrypt the data 174 | 175 | 176 | 177 | Uses a public and private key pair 178 | 179 | 180 | 181 | Encrypting data that has been stored on a physical medium 182 | 183 | 184 | 185 | Encrypting data that is actively moving from one location to another 186 | 187 | 188 | ## Encryption on Azure 189 | 190 | - Azure Storage Service Encryption - For data at rest 191 | 192 | - Azure Disk Encryption - Encrypt virtual machine disks 193 | 194 | - Transparent data encryption - Protect Azure SQL database and Azure 195 | data warehouse 196 | 197 | - Azure key vault - encrypt secrets 198 | 199 | Benefits of using key vault: 200 | 201 | - Centralized application secrets 202 | 203 | - Securely stored secrets and keys 204 | 205 | - Monitor access and use 206 | 207 | - Simplified administration of application secrets 208 | 209 | - Integrate with other Azure services 210 | 211 | # Azure Certificates 212 | 213 | Certificates in Azure are **x.509 v3** and can be signed by a CA or self 214 | signed 215 | 216 | ## Service Certificates 217 | 218 | These are attached to cloud services and enable secure communication to 219 | and from this service. 220 | 221 | These are managed separately from the services. 222 | 223 | ## Management certificates 224 | 225 | These allow you to authenticate with the classic deployment model 226 | 227 | # Protect your network 228 | 229 | 230 | A service that grants server access based on the originating IP address of each request 231 | 232 | 233 | To provide inbound protection at the perimeter, you have several 234 | choices: 235 | 236 | - Azure Firewall - Managed cloud based network security service 237 | 238 | - Azure Application Gateway - Load balancer that includes a web 239 | application firewall 240 | 241 | - Network Virtual Appliances (NVAs) - Ideal for non-HTTP services or 242 | advanced configs 243 | 244 | ## DDoS Protection 245 | 246 | Basic: 247 | 248 | - Automatically enabled 249 | 250 | - Always on traffic monitoring and real time mitigation of common 251 | network level attcks 252 | 253 | Standard: 254 | 255 | - Can mitigate: 256 | 257 | - Volumetric attacks - Flooding network layer with traffic 258 | 259 | - Protocol attacks - Exploit weakness in layer 3 and layer 4 260 | protocol stack 261 | 262 | - Resource layer attacks - Target web application packets to 263 | disrupt the transmission of data between hosts 264 | 265 | ## Virtual network security 266 | 267 | For communication between virtual machines, Network Security Groups are 268 | a critical piece to restrict unnecessary communication. 269 | 270 | This allows you to filter network traffic to and from Azure resources in 271 | an Azure virtual network 272 | 273 | ## Network Integration 274 | 275 | To provide a dedicated private network between your network and Azure, 276 | you can use Azure ExpressRoute. 277 | 278 | # Protecting shared documents 279 | 280 | Azure information protection - A cloud-based solution to help 281 | organizations classify and optionally protect documents by applying 282 | labels 283 | 284 | # Azure Advanced Threat Protection 285 | 286 | This is a cloud-based solution to identify, detect and help to 287 | investigate threats. 288 | 289 | It has the following components: 290 | 291 | - ATP portal - Allows you to monitor and respond to suspicious 292 | activity 293 | 294 | - ATP sensor - Installed directly on domain controllers to monitor 295 | traffic 296 | 297 | - ATP cloud service - Runs on Azure infrastructure and is connected to 298 | Microsoft’s intelligent security graph 299 | 300 | # Security considerations for Application Lifecycle Management Solutions 301 | 302 | - Provide training to ensure everyone knows the threats 303 | 304 | - Define security requirements - Update continuously to address change 305 | in threat landscape. 306 | 307 | - Define metrics and compliance reporting - Have minimum levels of 308 | security quality 309 | 310 | - Perform threat modelling - Allows development teams to consider the 311 | security implications of designs 312 | 313 | - Establish design requirements - Specific security features must be 314 | implemented 315 | 316 | - Define and use cryptography standards 317 | 318 | - Manage security risks from using third-party components - Keep an 319 | accurate inventory and plan to respond when new vulnerabilities are 320 | discovered 321 | 322 | - Use approved tools - Define and publish a list of approved tools 323 | 324 | - Perform Static Analysis Security Testing - Analyse source code prior 325 | to compilation 326 | 327 | - Perform Dynamic Analysis Security Testing - Analyse fully-compiled 328 | code 329 | 330 | - Perform penetration testing 331 | 332 | - Establish a standard incident response process 333 | -------------------------------------------------------------------------------- /notes/Open_Source/Git/Commands.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Git Commands" 3 | --- 4 | 5 | # Init 6 | 7 | To create a new git repository, you should use the `init` command, you can run 8 | it like so 9 | 10 | ```shell 11 | git init 12 | ``` 13 | 14 | and a git repository will be created in your current directory 15 | 16 | # Clone 17 | 18 | However in many cases you will be working from a repository on a git provider 19 | like GitHub. For this you should use the `clone` command, this allows you to 20 | make a copy on your computer and links the repository so you can use the `push` 21 | and `pull` commands (explained later). 22 | 23 | You can do this simply from the GitHub website by clicking on the green **code** 24 | button and copying the link provided 25 | 26 | ![Clone URL](/img/open_source/git/commands/clone.png "Getting the clone URL") 27 | 28 | Once you copy this URL, add it after `git clone` like so 29 | 30 | ```shell 31 | git clone https://github.com/init-OSS/initoss.git 32 | ``` 33 | 34 | This will create a copy of the repository in the current directory 35 | 36 | # Add 37 | 38 | Prior to understanding the `git add` command, you must first understand the 39 | **staging area** 40 | 41 | ## Staging area 42 | 43 | The staging area is a place between your working directory and the git tree. The 44 | benefit here is that you might not want to add all the files you have changed in 45 | one commit. An example of why you might want to do this is if you have forgotten 46 | to commit for a while and so have changed files that reflect a number of 47 | different changes. This will work to help you to separate those changes. 48 | 49 | ## Add command 50 | 51 | A common use case is that you want to add all the changed files to the staging 52 | area, this can be done like so 53 | 54 | ```shell 55 | git add -A 56 | ``` 57 | 58 | However you can also add single files like this: 59 | 60 | ```shell 61 | git add file.txt 62 | ``` 63 | 64 | # Commit 65 | 66 | A git commit is a snapshot of the code in its current state. This is useful as 67 | it allows you to see how the code has changed over time, and if you introduce 68 | any bugs, it allows you to go back to a version prior to that introduction. 69 | 70 | It also allows others to better understand the code as they can see how 71 | different features were introduced. 72 | 73 | A git commit will be made from the **staging area**, so you will have to run 74 | `git add` in some way before this 75 | 76 | The most common way to do this from the command line is: 77 | 78 | ```shell 79 | git commit -m "Message" 80 | ``` 81 | 82 | The `-m` flag here is to provide a message. If you do a simple `git commit` it 83 | will open your text editor to provide a message. 84 | 85 | # Push 86 | 87 | A git push is the process of moving the code from your computer to where it is 88 | hosted. 89 | 90 | A project can have multiple **remotes**, which are places the code is stored, 91 | however most will only have one. The naming convention for a single remote is to 92 | call it `origin`. This is what the remote will be called if you clone a 93 | repository. 94 | 95 | A git push command is accompanied by the remote you want and the branch in that 96 | remote, so the most common git push command will be: 97 | 98 | ```shell 99 | git push origin main 100 | ``` 101 | 102 | `main` is moving to be the default branch name over `master`, but you will still 103 | see many repositories with `master` as the default branch, and so a push command 104 | would be 105 | 106 | ```shell 107 | git push origin master 108 | ``` 109 | -------------------------------------------------------------------------------- /notes/Open_Source/Git/GitKraken.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "GitKraken" 3 | --- 4 | 5 | Remembering all the git commands and what state all your files are in can 6 | sometimes be complex. For this reason, people create Graphical User Interfaces 7 | (GUIs) for git, one of the most popular being 8 | [GitKraken](https://www.gitkraken.com/invite/uPfG7AbY). 9 | 10 | An example view is this, showing the repository for this website: 11 | 12 | ![GitKraken Main View](/img/open_source/git/gitkraken/GitKraken_Main.webp) 13 | 14 | This looks complicated, so we'll walk through each section 15 | 16 | ## Top bar 17 | 18 | ![GitKraken Top Bar](/img/open_source/git/gitkraken/top.png) 19 | 20 | Many of the commands here are just replicas of git commands, so **Pull** is 21 | `git pull` etc. As discussed before, `git push` needs to be accompanied by the 22 | branch and remote, so GitKraken lets you set up defaults. 23 | 24 | If you've cloned a repo, then the branches will push to their counterparts on 25 | the remote, so `main` will push to `main` etc. When you create a branch, the 26 | first time you push the branch, it will ask you which branch you want to push it 27 | to, with the default being one with the same name. 28 | 29 | **Branch** allows you to create a new git branch, and prompts you for the name. 30 | Stash and pop are for more advanced git concepts called stashes. 31 | 32 | Timelines is a GitKraken exclusive feature and isn't git related. 33 | 34 | Another benefit here is the **Undo** and **Redo** buttons, these will try their 35 | best to undo and redo changes you've made if it's possible, so might save you 36 | from some mistakes. 37 | 38 | ## Right sidebar 39 | 40 | ![GitKraken Right sidebar](/img/open_source/git/gitkraken/right_bar.png) 41 | 42 | This allows you to see your changed files, here you can see I'm working on this 43 | document about GitKraken. Those with the plus symbol are new files and ones with 44 | a pencil are edited files. You can easily stage all of these files with the 45 | **Stage all changes** button, or you can stage each individually. You also have 46 | the section at the bottom to add a commit message, then the button at the bottom 47 | can be used to commit the changes. 48 | 49 | ## Left sidebar 50 | 51 | ![GitKraken Left sidebar](/img/open_source/git/gitkraken/left_bar.png) 52 | 53 | In general, you will use this sidebar much less than the right sidebar, but it 54 | is useful for some configuration. 55 | 56 | At the top under **LOCAL**, you can change between local branches, the 57 | equivalent of `git switch`. 58 | 59 | **REMOTE** lets you manage your remotes, here you can see I have this repo on 60 | both GitHub and GitLab. 61 | 62 | The next two sections are for Git hosting providers, showing both pull requests 63 | and issues. 64 | 65 | Git tags let you show versions of your code, and you will often see these being 66 | used in larger repositories. 67 | 68 | Git submodules let you embed a repository inside another, as a beginner you 69 | won't often see this. 70 | 71 | GitHub actions let you run scripts after you commit, here you can see I am using 72 | one called **CodeQL** which checks code for security vulnerabilities. 73 | 74 | ## Middle 75 | 76 | ![GitKraken Left sidebar](/img/open_source/git/gitkraken/middle.png) 77 | 78 | You can see all your past commits in the middle section. Here you can see the 79 | merging of many dependency updates with **Bump** followed by **Merge** 80 | 81 | At the very top you can see `//WIP`, this is to show that I have uncommitted 82 | changes. 83 | 84 | Down the left-hand side you can see branches, both local and remote. Hovering 85 | over them shows their name, and the one with the laptop symbol signifies it is a 86 | local branch. 87 | 88 | This allows you to see where each branch is in your code, and how the remote 89 | compares with local. This is useful as you can see if other people have made 90 | changes to the code since you last pulled it and what changes the different 91 | branches have. 92 | -------------------------------------------------------------------------------- /notes/Open_Source/Git/Introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Introduction to Git" 3 | --- 4 | 5 | Git is a **version control system**, this allows programmers to keep track of 6 | changes in their code. 7 | 8 | The benefit of this is that if you make changes that break functionality, you 9 | can easily go back to a previous version. It also allows for developing multiple 10 | things at once using a feature called **branches** and incorporating them into 11 | the main code when the feature is ready. 12 | 13 | While there are other version control systems, git is by far the most popular, 14 | particularly in open source projects. It has been popularised by the git hosting 15 | services [GitHub](https://github.com/) and [GitLab](https://about.gitlab.com/). 16 | 17 | Anything can be tracked in a git, but it is best for text files, as the changes 18 | to them are small. Using it for other things such as images does not being the 19 | same benefits as the changes are not as simple. 20 | -------------------------------------------------------------------------------- /notes/Open_Source/GitHub/Fork_and_PR.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Forking and Pull Requests" 3 | --- 4 | 5 | The first step in contributing to an open source project is to **fork** it. This 6 | means to create a copy of the repository in your account. Once you do this, you 7 | can then make whatever changes you feel are appropriate. You can see which of 8 | your repositories are forks as they come with a note under the title (red added 9 | by me): 10 | 11 | ![Forked Repo](/img/open_source/github/fork/Forked_Repo.webp) 12 | 13 | A **pull request** is a request from the forked repository back to the original 14 | repository to add the improvements. You can easily create a pull request from 15 | any branch back to the original repository, as they will have this banner above 16 | the code, and you can click **Pull Request** to start one 17 | 18 | ![Creating a pull request](/img/open_source/github/fork/create_pr.webp) 19 | 20 | After doing this, you need to describe what your pull request does. Many large 21 | projects will have a template for pull requests, and the contents of that will 22 | be filled out already for you. You should edit this to describe your particular 23 | change, this allows the maintainers to better understand what your pull request 24 | does and why it is needed. If your problem is solving a certain issue, you 25 | should also mention that in your pull request. 26 | -------------------------------------------------------------------------------- /notes/Open_Source/HTML/Boilerplate.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "HTML Boilerplate" 3 | --- 4 | 5 | The **boilerplate** of a HTML page looks like the below code snippet 6 | 7 | 8 | Sections of code that have to be included in many places with little or no 9 | alteration 10 | 11 | 12 | ```HTML 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ``` 23 | 24 | ## DOCTYPE 25 | 26 | At the top of every HTML document you will see ``, this tells the 27 | browser that the content of the file is HTML. This is largely unneeded in modern 28 | browsers as they will assume this, but it is best practice, so you should still 29 | include it. 30 | 31 | ## html tag 32 | 33 | The `html` tag is used to show that all the content inside should be processed 34 | as HTML. This is the root (top level) element of a HTML document. An important 35 | attribute to include on this tag is `lang`. This allows you to specify the 36 | language of your page, this is useful for screen readers for people with visual 37 | impairment. To specify the language to be english you would do 38 | 39 | ```HTML 40 | 41 | 42 | 43 | ``` 44 | 45 | ## head tag 46 | 47 | The head is used for all the data that isn't displayed on the page. This 48 | includes a variety of things, including setting the page title and importing 49 | content. 50 | 51 | ### meta tag 52 | 53 | This tag is used to set **metadata** about the page 54 | 55 | Data about data 56 | 57 | The example here is to set the character set to be unicode. This allows for a 58 | wider range of characters, such as emojis. If this is not set, then characters 59 | might appear differently on different devices as it will be left to the browser 60 | to choose the character set. 61 | 62 | ### title tag 63 | 64 | This tag is used to set the title of the page, this will appear in the tabs in a 65 | browser. To set it, just insert the desired title inside the tag, for example. 66 | 67 | ```html 68 | Hello, World! 69 | ``` 70 | 71 | ### body tag 72 | 73 | This is used for all the content on the page. Whatever you put in here will be 74 | put onto the page. 75 | -------------------------------------------------------------------------------- /notes/Open_Source/HTML/Introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Introduction to HTML" 3 | --- 4 | 5 | HTML determines the content of a webpage, and is a standard shared across all 6 | browsers. 7 | 8 | # Tags 9 | 10 | Tags in HTML are used structure the content in a webpage. They are denoted using 11 | less than and greater than symbols, such as ``. These symbols are 12 | sometimes called **angle brackets** as they act as brackets around the content. 13 | 14 | Tags that are opened should also be closed. This is done with the same tag, but 15 | with a slash immediately after the less than sign. 16 | 17 | ```HTML 18 | 19 | 20 | 21 | ``` 22 | 23 | Some tags don't need closing, and we will get into those later 24 | 25 | ## Tag Attributes 26 | 27 | Opening tags can also have attributes, an example of this is the `` tag, 28 | this has a `lang` attribute 29 | 30 | ```HTML 31 | 32 | 33 | 34 | ``` 35 | 36 | The most common uses of attributes are `style` and `class`, which we will get 37 | into later 38 | -------------------------------------------------------------------------------- /notes/Open_Source/HTML/Links_and_Images.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Using links and images in HTML 3 | --- 4 | 5 | # Links 6 | 7 | Links allow you to direct the user to different pages on your site, or to 8 | different sites on the internet. 9 | 10 | Links use the `` tag and `href` attribute in order to work. An example of 11 | linking to google is 12 | 13 | ```HTML 14 | Google 15 | ``` 16 | 17 | If you want to link to a page in your site, include all the link after your 18 | domain, including the slash. For example, if you look at the address bar for 19 | this page it says `https://initoss.dev/learn_code/HTML/4-Links`, so all you need 20 | to include is `/learn_code/HTML/4-Links` like this 21 | 22 | ```HTML 23 | Links 24 | ``` 25 | 26 | If you instead want to link relative to where you are, start the URL with a dot. 27 | For example, if there was a page under this one called `relative`, using the 28 | link 29 | 30 | ```HTML 31 | Links 32 | ``` 33 | 34 | would link there. 35 | 36 | # Images 37 | 38 | Images are inserted into HTML using the `` tag The source of the image is 39 | passed in using the `src` attribute, like in the following example 40 | 41 | ```html 42 | Image description 43 | ``` 44 | 45 | `alt` is provided for if the image can't be found and for accessibility. An 46 | example of why it might not be found is that you are using an image from a 47 | remote site and the site has gone down. 48 | 49 | As for accessibility, people who use screen readers will be read the `alt` text, 50 | so it is important for them that it is descriptive. 51 | -------------------------------------------------------------------------------- /notes/Open_Source/HTML/Lists.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Using Lists in HTML 3 | --- 4 | 5 | There are two main types of lists in HTML, ordered and unordered. An ordered 6 | list uses numbers or another method of showing the items are ordered, whereas an 7 | unordered list will use bullet points. 8 | 9 | ## Ordered List 10 | 11 | An ordered list looks like this 12 | 13 | 1. Three 14 | 2. Ordered 15 | 3. Items 16 | 17 | It is implemented using the `ol` tag. List items are implemented using the `li` 18 | tag. So the above list looks like this in HTML: 19 | 20 | ```html 21 |
      22 |
    1. Three
    2. 23 |
    3. Ordered
    4. 24 |
    5. Items
    6. 25 |
    26 | ``` 27 | 28 | ## Unordered list 29 | 30 | An unordered list looks like this: 31 | 32 | - Three 33 | - Unordered 34 | - Items 35 | 36 | It is implemented using the `ul` tag. Again list items are implemented using the 37 | `li` tag. Meaning the above list looks like this in HTML 38 | 39 | ```html 40 |
      41 |
    • Three
    • 42 |
    • Unordered
    • 43 |
    • Items
    • 44 |
    45 | ``` 46 | -------------------------------------------------------------------------------- /notes/Open_Source/HTML/Tables.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Using Tables in HTML 3 | --- 4 | 5 | To start with tables you use a `
    ` tag, this wraps the whole structure, in 6 | the same way as `` wraps your website. 7 | 8 | Each row is then implemented using `` (table row) 9 | 10 | The in each row, you insert cells that are either **header** or **data** 11 | 12 | For header cells, you use the tag `
    ` and for data cells you use the tag 13 | ``. 14 | 15 | There's a lot more to think about here than the previous examples, but an 16 | example should help 17 | 18 | ```html 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
    Header 1Header 2
    Data 1Data 2
    29 | ``` 30 | 31 | This would form a table that looks like this 32 | 33 | | Header 1 | Header 2 | 34 | | -------- | -------- | 35 | | Data 1 | Data 2 | 36 | 37 | We will come to the particular way in which tables can be styled in the CSS 38 | section 39 | -------------------------------------------------------------------------------- /notes/Open_Source/HTML/Text_Formatting.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Basic Text Formatting" 3 | --- 4 | 5 | The most basic way to include text in your website is inside a `

    ` tag, this 6 | is for **paragraphs**, so standard formatted text. You use it as follows: 7 | 8 | ```html 9 |

    Include your text here

    10 | ``` 11 | 12 | # Headings 13 | 14 | You can also add headings to your website, these are numbered `

    ` through to 15 | `

    ` and will be smaller as you increase the number. The styling of these is 16 | determined by your browser, but they will all follow this rule. 17 | 18 | You would use these as follows: 19 | 20 | ```html 21 |

    Biggest title

    22 |

    Then this one

    23 |

    Then this one

    24 |

    Then this one

    25 |
    Then this one
    26 |
    And this is the smallest
    27 | ``` 28 | 29 | # Text styling 30 | 31 | There are many ways to style your text using HTML tags 32 | 33 | ## Bold 34 | 35 | To make text **bold**, you need to use the `` tag 36 | 37 | ```HTML 38 |

    Normal text Now the text is bold back to normal

    39 | ``` 40 | 41 | You may also see `` being used. Most browsers will style these the same. 42 | `` is for text with "strong importance". 43 | 44 | ## Italic 45 | 46 | To make text _italic_, you need to use the `` tag, used in a very similar way 47 | to bold 48 | 49 | ```HTML 50 |

    Normal text Here is italic text now back to normal

    51 | ``` 52 | 53 | There is also a similar tag ``, used for emphasis. Again this will usually 54 | be styled in the same way. A screen reader will place verbal stress on words in 55 | `` tags but not ``, so that is to consider 56 | 57 | ## Other styling 58 | 59 | There are a range of other styles, including 60 | 61 | - [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/small) 62 | for small text 63 | - [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub) for 64 | subscript text 65 | - [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ins) for 66 | text that has been added to a document 67 | - [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/del) for 68 | text that has been removed from a document 69 | - [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark) 70 | for highlighted text 71 | 72 | However they are not commonly used so I won't go into detail on them 73 | -------------------------------------------------------------------------------- /notes/Open_Source/Markdown/Code.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Code in Markdown" 3 | --- 4 | 5 | # Inline 6 | 7 | Inline code flows with the text, for example `function`, the backticks here 8 | aren't default in HTML, instead are part of my styling. However backticks is how 9 | you use inline code. 10 | 11 | ```md 12 | for example `function` 13 | ``` 14 | 15 | # Block 16 | 17 | Code blocks are distinct from the text, for example: 18 | 19 | ```js 20 | console.log("Hello World"); 21 | ``` 22 | 23 | These are used for larger snippets of code. They also have the option to add a 24 | language attribute, which can be used for syntax highlighting 25 | 26 | They are started with three backticks followed by the language and ended with 27 | three backticks. 28 | 29 |
    30 | 	
    31 | 		```js
    32 | 		
    33 | console.log("Hello World") 34 |
    35 | ``` 36 |
    37 |
    38 | -------------------------------------------------------------------------------- /notes/Open_Source/Markdown/Introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Introduction to Markdown" 3 | --- 4 | 5 | Markdown is a **markup language** in the same way that HTML is, allowing for 6 | dictating content structure. 7 | 8 | The advantage of markdown is that it has a much simpler syntax when compared to 9 | HTML, which we will go through in ths guide. 10 | 11 | Markdown also provides a subset of the features of HTML, meaning that markdown 12 | can be translated to HTML. 13 | 14 | For this reason, it is extensively used in documentation websites as they don't 15 | require complicated layouts. Some examples of this is the 16 | [Next.js documentation](https://nextjs.org/docs/getting-started), 17 | [Gatsby documentation](https://www.gatsbyjs.com/docs/), and many more, including 18 | this website. 19 | 20 | Contributing to documentation is a great way to get started with open source as 21 | it doesn't require in depth knowledge of the codebase and can even be done 22 | directly in the GitHub website. 23 | 24 | As well as in documentation, Markdown is used for README files, so whenever you 25 | see one of these in an open source project, it is made using Markdown. 26 | 27 | The file extension for markdown files is `.md`. You may also see files with the 28 | extension `.mdx`, such as the ones for this site, this is a superset of 29 | markdown, so you can use markdown inside it. I may also explain what you can do 30 | with `.mdx` in more advanced versions of this guide. 31 | -------------------------------------------------------------------------------- /notes/Open_Source/Markdown/Links_and_Images.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Links and Images in Markdown" 3 | --- 4 | 5 | # Links 6 | 7 | Links in markdown are inserted using the following syntax 8 | 9 | ```md 10 | [alt](https://google.com) 11 | ``` 12 | 13 | The first parameter is mapped to the `alt` attribute in HTML and the second is 14 | mapped to the `href` attribute 15 | 16 | # Images 17 | 18 | Images use a very similar syntax, but with an exclamation point in front: 19 | 20 | ```md 21 | ![alt](https://example.com/image.png) 22 | ``` 23 | -------------------------------------------------------------------------------- /notes/Open_Source/Markdown/Lists.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Lists in Markdown" 3 | --- 4 | 5 | Lists can be written basically as you would type it out. Bullets can be written 6 | with either a start `*` or dash `-` 7 | 8 | ```md 9 | - This 10 | - Is 11 | - An 12 | - Unordered 13 | - List 14 | ``` 15 | 16 | For ordered lists, just start with numbers: 17 | 18 | ```md 19 | 1. This 20 | 2. Is 21 | 3. An 22 | 4. Ordered 23 | 5. List 24 | ``` 25 | 26 | List with checkboxes. 27 | 28 | For a checked box, use `- [x]` and for an unchecked box, use `- [ ]` 29 | 30 | ```md 31 | - [x] Checked 32 | - [x] Box 33 | - [x] Example 34 | - [ ] Unchecked 35 | - [ ] Box 36 | - [ ] Example 37 | ``` 38 | -------------------------------------------------------------------------------- /notes/Open_Source/Markdown/Tables.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Tables in Markdown" 3 | --- 4 | 5 | Tables in markdown have a much nicer syntax than in HTML, allowing them to be 6 | more easily interpreted 7 | 8 | The distinction between cells is created using the vertical bar symbol `|` 9 | dashes are also used to separate the header 10 | 11 | ```md 12 | | Heading 1 | Heading 2 | 13 | | --------- | --------- | 14 | | Cell 1 | Cell 2 | 15 | ``` 16 | 17 | This translates to the table: 18 | 19 | | Heading 1 | Heading 2 | 20 | | --------- | --------- | 21 | | Cell 1 | Cell 2 | 22 | -------------------------------------------------------------------------------- /notes/Open_Source/Markdown/Text_Formatting.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Text formatting in Markdown" 3 | --- 4 | 5 | # Headings 6 | 7 | Using headings in Markdown has a much nicer syntax than that in HTML, all you 8 | need is the hash symbol (`#`). 9 | 10 | The number of hashes corresponds to the `h` value in HTML. So `#` is for a 11 | `

    `, `##` is for a `

    ` and so on. 12 | 13 | You add text to these headings by adding a space after the symbol then putting 14 | whatever you want the title to be 15 | 16 | ```md 17 | # This is the top level heading 18 | 19 | ## This is the second level 20 | 21 | ### Third level 22 | 23 | ###### And like HTML, it goes all the way down to 6 24 | ``` 25 | 26 | # Text styling 27 | 28 | ## Bold 29 | 30 | For bold text there are two ways of formatting it, either with stars or 31 | underscores. Unlike in HTML, these do exactly the same thing and so are just 32 | personal preference. The only thing to remember is that there should be **two** 33 | of the symbol on each side 34 | 35 | ```md 36 | **This is bold** 37 | ``` 38 | 39 | ## Italic 40 | 41 | Italics have very similar syntax, with the option of stars or underscores, but 42 | just with **one** symbol on each side 43 | 44 | ```md 45 | _This is italic_ 46 | ``` 47 | 48 | You will notice that I have done the two examples with different symbols, this 49 | is due to my code formatter, but is a good idea so that you can do things such 50 | as: 51 | 52 | ```md 53 | **This is bold _but with italic inside_ ** 54 | ``` 55 | 56 | with less confusion 57 | -------------------------------------------------------------------------------- /notes/University_Illustrations/CaC/ECC/Error_Correcting.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Error correcting codes 3 | --- 4 | 5 | ## Parity Check code 6 | 7 | ![Parity Check](/img/Uni/CaC/ECC/parity_check.png) 8 | 9 | Can only detect **one** error and cannot correct any errors 10 | 11 | ## Repetition Code 12 | 13 | ![Repetition Code](/img/Uni/CaC/ECC/repetition_code.png) 14 | 15 | Can correct 16 | 17 | $$ 18 | \bigg\lfloor \dfrac{n-1}{2} \bigg\rfloor 19 | $$ 20 | 21 | errors 22 | 23 | and can detect $n-1$ errors 24 | 25 | ## Hamming distance 26 | 27 | ![Hamming Distance](/img/Uni/CaC/ECC/hamming_distance.png) 28 | 29 | Measures the number of differences (in this case 1) 30 | 31 | The **Hamming weight** is the number of non zeroes (2 for top, 1 for bottom) 32 | 33 | ## Minimum distance 34 | 35 | ![Minimum Distance](/img/Uni/CaC/ECC/minimum_distance.png) 36 | 37 | A code can correct t errors iff it has a minimum distance 38 | 39 | $$ 40 | d_{min}\geqslant 2t+1 41 | $$ 42 | 43 | So for this code it can correct 1 error (min distance of 3 would also work to correct 1 error) 44 | 45 | ![Minimum distance proof](/img/Uni/CaC/ECC/mind_proof.png) 46 | 47 | There needs to be overlap between the codes in order to be able to distinguish them 48 | 49 | As the $d_{min}$ is an integer value, the formula is equivalent to $d_{min}>2t$ 50 | -------------------------------------------------------------------------------- /notes/University_Illustrations/CaC/ECC/Finite_Fields.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Finite Fields 3 | --- 4 | 5 | A group must follow the following rules 6 | 7 | Associativity: 8 | 9 | ![Associativity](/img/Uni/CaC/ECC/associativity.png) 10 | 11 | Identity element: 12 | 13 | ![Identity](/img/Uni/CaC/ECC/identity.png) 14 | 15 | Inverses: 16 | 17 | ![Inverse](/img/Uni/CaC/ECC/inverse.png) 18 | 19 | ## Abelian group 20 | 21 | An abelian group is also commutative: 22 | 23 | ![Commutative](/img/Uni/CaC/ECC/commutative.png) 24 | 25 | ## Field 26 | 27 | A field is a 5-tuple 28 | 29 | $$ 30 | (F, +, \times, 0, 1) 31 | $$ 32 | 33 | with 34 | 35 | 1. $(F, +)$ being an Abelian group with identity 0 36 | 37 | e.g. $1+0=0+1=1$ 38 | 39 | 2. $(F*, \times)$ being an Abelian group with identity 1 40 | 41 | e.g. $2\times 1=1\times 2 = 2$ 42 | 43 | 3. Multiplication distributes over the addition 44 | 45 | ![Multiplication distributes](/img/Uni/CaC/ECC/mult_distributes.png) 46 | 47 | ## Galois field 48 | 49 | 50 | 51 | Any finite field is of order $q=p^m$, where p is a prime number and m is an integer $\geqslant 1$. All fields of a given size are the same. 52 | 53 | 54 | 55 | These have two different notations that mean the same thing, $GF(q)$ and $\mathbb{F}_q$ 56 | 57 | ## Extension field 58 | 59 | ![Primitive and Irreducible](/img/Uni/CaC/ECC/primitive.png) 60 | 61 | ![Addition](/img/Uni/CaC/ECC/gf_addition.png) 62 | 63 | ![Multiplication](/img/Uni/CaC/ECC/gf_mult.png) 64 | 65 | ### Properties 66 | 67 | Multiplicative structure 68 | 69 | ![Multiplicative cycle](/img/Uni/CaC/ECC/mult_cycle.png) 70 | 71 | Additive structure 72 | 73 | ![Additive structure](/img/Uni/CaC/ECC/add_structure.png) 74 | -------------------------------------------------------------------------------- /notes/University_Illustrations/CaC/ECC/Hamming_Codes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Hamming Codes 3 | --- 4 | 5 | ## Structure of a hamming code 6 | 7 | ![Structure of a hamming code](/img/Uni/CaC/ECC/hamming_structure.png) 8 | 9 | This H is the **parity check matrix** 10 | 11 | ### Properties 12 | 13 | | Property | Value | 14 | | --------------------------- | ------------- | 15 | | Length | $2^r-1$ | 16 | | Dimension | $2^r-r-1$ | 17 | | Minimum distance | 3 | 18 | | Field order | 2 | 19 | | Redundancy | $r-k$ | 20 | | Rate | $1-r/(2^r-1)$ | 21 | | Error correction capability | 1 | 22 | 23 | From the parity check matrix, you can then form the Generator matrix 24 | 25 | ![Hamming code generator matrix](/img/Uni/CaC/ECC/hamming_generator.png) 26 | -------------------------------------------------------------------------------- /notes/University_Illustrations/CaC/ECC/Linear_Codes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Linear codes 3 | --- 4 | 5 | ## Duals 6 | 7 | ![Parity check and repetition codes are dual](/img/Uni/CaC/ECC/dual_parity.png) 8 | 9 | ## Systematic form 10 | 11 | ![Systematic form](/img/Uni/CaC/ECC/systematic_form.png) 12 | 13 | ## Parity check matrix 14 | 15 | ![Parity Check Matrix](/img/Uni/CaC/ECC/pc_matrix.png) 16 | 17 | You can use the knowledge of these two values to then find out the value of $k$ 18 | -------------------------------------------------------------------------------- /notes/University_Illustrations/CaC/ECC/Reed-Muller.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Reed-Muller codes 3 | --- 4 | 5 | Boolean logic can also be expressed as calculations mod 2 6 | 7 | ![Or mod 2](/img/Uni/CaC/ECC/or_mod2.png) 8 | 9 | | Boolean | Mod 2 | 10 | | ----------- | -------- | 11 | | $x \land y$ | $xy$ | 12 | | $x \lor y$ | $x+y+xy$ | 13 | | $\lnot x$ | $x+1$ | 14 | | $x\oplus y$ | $x+y$ | 15 | -------------------------------------------------------------------------------- /notes/University_Illustrations/CaC/Information_Theory/Capacity.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Capacity 3 | --- 4 | 5 | ![Memoryless Channel](/img/Uni/CaC/InfTheo/memoryless_channel.png) 6 | 7 | The channel capacity is: 8 | 9 | $$ 10 | \max_{p(x)} I(X;Y) 11 | $$ 12 | -------------------------------------------------------------------------------- /notes/University_Illustrations/CaC/Information_Theory/Introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Introduction to Information Theory 3 | --- 4 | 5 | ## Discrete random variables 6 | 7 | ![Discrete random variable](/img/Uni/CaC/InfTheo/drv.png) 8 | 9 | ![Expectation of a DRV](/img/Uni/CaC/InfTheo/drv_expectation.png) 10 | 11 | ## Entropy 12 | 13 | ![Entropy of a DRV](/img/Uni/CaC/InfTheo/entropy.png) 14 | 15 | ## Jensen's inequality 16 | 17 | ![Convex](/img/Uni/CaC/InfTheo/convex.png) 18 | 19 | Jensen's inequality states 20 | 21 | $$ 22 | \mathbb{E}(f(Y))\geqslant f(\mathbb{E}(Y)) 23 | $$ 24 | 25 | This can be shown in the below diagram 26 | 27 | ![Jensen's inequality](/img/Uni/CaC/InfTheo/jensen.png) 28 | -------------------------------------------------------------------------------- /notes/University_Illustrations/CaC/Information_Theory/Mutual_Information.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Mutual Information 3 | --- 4 | 5 | ## Venn Diagram of Entropy 6 | 7 | ![Entropy Venn](/img/Uni/CaC/InfTheo/entropy_venn.png) 8 | 9 | $I(X,Y)$ is the **mutual information** 10 | 11 | $H(Y|X)$ is the information Y provides given that X is known. This is expected to be less than $H(Y)$ as by having joint entropy, the value of X provides some information about Y. 12 | -------------------------------------------------------------------------------- /notes/University_Illustrations/DADS/Cuckoo_Hashing.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Cuckoo Hashing 3 | --- 4 | 5 | # Hash Tables 6 | 7 | ![Hash Table](/img/Uni/DADS/Cuckoo/hash_table.png) 8 | 9 | # Dictionary Operations 10 | 11 | ![Dictionary Operations](/img/Uni/DADS/Cuckoo/dictionary_operations.png) 12 | 13 | # Hashing with chaining 14 | 15 | ![Chaining](/img/Uni/DADS/Cuckoo/chaining.png) 16 | 17 | [Link](https://excalidraw.com/#json=4841504023511040,zBZTnaNbquBLNZtd_z8V5A) 18 | 19 | # Cuckoo Hashing 20 | 21 | ![Cuckoo Hashing](/img/Uni/DADS/Cuckoo/cuckoo.png) 22 | 23 | ![Cuckoo Graph](/img/Uni/DADS/Cuckoo/cuckoo_graph.png) 24 | -------------------------------------------------------------------------------- /notes/University_Illustrations/DADS/Probability.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Introduction to Probability 3 | --- 4 | 5 | # Axioms of Probability 6 | 7 | ![Axioms of probability](/img/Uni/DADS/Intro/axioms.png) 8 | 9 | This then leads to further rules 10 | 11 | ![Further Rules](/img/Uni/DADS/Intro/further_rules.png) 12 | 13 | # Conditional Probability 14 | 15 | ![Conditional Probability](/img/Uni/DADS/Intro/conditional_probability.png) 16 | 17 | # Uniform Distribution 18 | 19 | ![Uniform Distribution](/img/Uni/DADS/Intro/uniform_distribution.png) 20 | 21 | # Independent Probabilities 22 | 23 | ![Independent](/img/Uni/DADS/Intro/independent.png) 24 | 25 | ## Pairwise Independence 26 | 27 | ![Pairwise Independence](/img/Uni/DADS/Intro/pairwise_independent.png) 28 | 29 | Every pair of events are independent of each other 30 | 31 | ## Mutual Independence 32 | 33 | The probability of all of a subset of events happening in the multiplication 34 | 35 | ![Mutual Independence](/img/Uni/DADS/Intro/mutual_independent.png) 36 | 37 | # Random variable 38 | 39 | ![Random Variable](/img/Uni/DADS/Intro/random_variable.png) 40 | 41 | The probability that a variable takes a certain value 42 | 43 | ## Independence 44 | 45 | ![Independence](/img/Uni/DADS/Intro/independence.png) 46 | 47 | The probability $A=x$ and $B=y$ is the probability $A=x$ multiplied by the probability $B=y$ 48 | 49 | ## Expected value 50 | 51 | ![Expected Value](/img/Uni/DADS/Intro/expected.png) 52 | 53 | The expected value is x times the probability of x for all x 54 | 55 | This can also be shown as the area under the curve 56 | 57 | ## Linearity of expectation 58 | 59 | ![Linearity of Expectation](/img/Uni/DADS/Intro/linearity_of_expectation.png) 60 | 61 | The expected value of A and B is the expected value of A plus the expected value of B 62 | 63 | **This doesn't apply for multiplication, only if they are independent** 64 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "notes-site", 3 | "version": "1.0.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build", 7 | "dev": "next", 8 | "export": "next build && next export", 9 | "find:unused": "next-unused", 10 | "postbuild": "next-sitemap", 11 | "start": "next start" 12 | }, 13 | "dependencies": { 14 | "@mapbox/rehype-prism": "^0.6.0", 15 | "@samrobbins/admonition-components": "^3.0.0", 16 | "@samrobbins/typography": "^1.3.0", 17 | "@tailwindcss/forms": "^0.3.3", 18 | "@tailwindcss/typography": "^0.4.0", 19 | "autoprefixer": "^10.2.0", 20 | "base-64": "^1.0.0", 21 | "directory-tree": "^2.2.5", 22 | "gray-matter": "^4.0.2", 23 | "katex": "^0.16.10", 24 | "next": "^14.2.21", 25 | "next-mdx-remote": "^3.0.4", 26 | "pako": "^2.0.4", 27 | "postcss": "^8.4.31", 28 | "postcss-import": "^14.0.0", 29 | "postcss-preset-env": "^6.7.0", 30 | "react": "^18.2.0", 31 | "react-dom": "^18.2.0", 32 | "rehype-katex": "^4.0.0", 33 | "remark": "^13.0.0", 34 | "remark-autolink-headings": "^6.0.1", 35 | "remark-emoji": "^2.1.0", 36 | "remark-footnotes": "^3.0.0", 37 | "remark-html": "^13.0.2", 38 | "remark-math": "^4.0.0", 39 | "remark-slug": "^6.0.0", 40 | "retext": "^7.0.1", 41 | "retext-smartypants": "^4.0.0", 42 | "tailwindcss": "^2.1.2", 43 | "unist-util-visit": "^2.0.3", 44 | "utf8": "^3.0.0" 45 | }, 46 | "devDependencies": { 47 | "@next/bundle-analyzer": "^11.1.0", 48 | "eslint": "^7.32.0", 49 | "eslint-plugin-react": "^7.22.0", 50 | "eslint-plugin-react-hooks": "^4.2.0", 51 | "next-sitemap": "^1.6.148", 52 | "next-unused": "^0.0.6", 53 | "nextjs-sitemap-generator": "^1.3.0", 54 | "prettier": "^2.3.2", 55 | "prettier-plugin-package": "^1.3.0" 56 | }, 57 | "next-unused": { 58 | "alias": {}, 59 | "include": [ 60 | "pages", 61 | "components", 62 | "lib" 63 | ], 64 | "exclude": [], 65 | "entrypoints": [ 66 | "pages", 67 | "components", 68 | "lib" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /pages/404.js: -------------------------------------------------------------------------------- 1 | import Link from "next/link"; 2 | import Head from "next/head"; 3 | export default function Custom404() { 4 | return ( 5 | <> 6 | 7 | 404 - Page not found 8 | 9 |
    10 |
    11 |

    12 | Oops, that's a 404, looks like you're lost 13 |

    14 | Page not found doodle 19 |
    20 | 21 | 22 | Go Home 23 | 24 | 25 |
    26 |

    27 | Don't think this should be a 404? Let me know in a{" "} 28 | 32 | GitHub Issue 33 | 34 |

    35 |
    36 |
    37 | 38 | ); 39 | } 40 | -------------------------------------------------------------------------------- /pages/[...slug].js: -------------------------------------------------------------------------------- 1 | import { useRef, useEffect, useState } from "react"; 2 | import Sidebar from "../components/sidebar/sidebar"; 3 | import NavBar from "../components/navbar"; 4 | import { getTree, getPaths } from "../lib/tree"; 5 | import { getPostData } from "../lib/lecture"; 6 | import Head from "next/head"; 7 | import { useRouter } from "next/router"; 8 | import Link from "next/link"; 9 | 10 | import { 11 | Definition, 12 | Important, 13 | Theorem, 14 | Corollary, 15 | Lemma, 16 | Problem, 17 | Example, 18 | Question, 19 | Answer, 20 | Exercise, 21 | } from "@samrobbins/admonition-components"; 22 | 23 | import MyImg from "@/components/mdx/image"; 24 | import MyTable from "@/components/mdx/table"; 25 | import MyCode from "@/components/mdx/code"; 26 | import MyPre from "@/components/mdx/pre"; 27 | import slug from "remark-slug"; 28 | import remarkSmartypants from "@/lib/remarkSmartypants"; 29 | import math from "@/lib/remark-math"; 30 | import highlightCode from "@mapbox/rehype-prism"; 31 | import footnotes from "remark-footnotes"; 32 | import Layout from "@/components/layout"; 33 | import { serialize } from "next-mdx-remote/serialize"; 34 | import { MDXRemote } from "next-mdx-remote"; 35 | const components = { 36 | table: MyTable, 37 | img: MyImg, 38 | code: MyCode, 39 | pre: MyPre, 40 | Definition, 41 | Important, 42 | Theorem, 43 | Corollary, 44 | Lemma, 45 | Problem, 46 | Example, 47 | Question, 48 | Answer, 49 | Exercise, 50 | }; 51 | function Lecture({ 52 | tree, 53 | postData, 54 | params, 55 | source, 56 | sidebarVisible, 57 | setSidebarVisible, 58 | exercise, 59 | }) { 60 | const [tab, setTab] = useState("Notes"); 61 | const router = useRouter(); 62 | const node = useRef(); 63 | const node2 = useRef(); 64 | 65 | function toggleSidebar() { 66 | setSidebarVisible(!sidebarVisible); 67 | } 68 | 69 | useEffect(() => { 70 | if (open) { 71 | document.addEventListener("mousedown", handleClickOutside); 72 | } else { 73 | document.removeEventListener("mousedown", handleClickOutside); 74 | } 75 | 76 | return () => { 77 | document.removeEventListener("mousedown", handleClickOutside); 78 | }; 79 | }); 80 | 81 | useEffect(() => { 82 | router.events.on("routeChangeComplete", function () { 83 | setSidebarVisible(false); 84 | setTab("Notes"); 85 | }); 86 | }, []); 87 | 88 | useEffect(() => { 89 | if (postData.contentHtml !== undefined) { 90 | import("../lib/rendermath").then((renderMath) => { 91 | renderMath.default(); 92 | }); 93 | } 94 | }, [tab, postData]); 95 | 96 | useEffect(() => { 97 | if (postData.contentHtml !== undefined) { 98 | import("../lib/rendermath").then((renderMath) => { 99 | renderMath.default(); 100 | }); 101 | } 102 | }, []); 103 | 104 | const handleClickOutside = (e) => { 105 | if ( 106 | node.current.contains(e.target) || 107 | node2.current.contains(e.target) 108 | ) { 109 | // inside click 110 | return; 111 | } 112 | // outside click 113 | setSidebarVisible(false); 114 | }; 115 | 116 | var list = []; 117 | if (postData.contentHtml === undefined) { 118 | var i; 119 | var temp = tree; 120 | for (i = 0; i < params.slug.length; i++) { 121 | temp = temp.children.find((x) => x.name === params.slug[i]); 122 | } 123 | list = temp; 124 | } 125 | 126 | function Main() { 127 | if (postData.contentHtml === undefined) { 128 | return ; 129 | } else { 130 | return ; 131 | } 132 | } 133 | 134 | function LecturePage() { 135 | return ( 136 | <> 137 |
    138 |

    139 | {postData.title} 140 |

    141 |

    142 | {params.slug[1].replace(/_/g, " ")} 143 |

    144 | {postData.author && ( 145 |

    146 | Written by{" "} 147 | 154 | {postData.author.name} 155 | 156 |

    157 | )} 158 |
    159 | {postData.exercise && ( 160 |
    161 |
    162 | 174 | 175 | 187 |
    188 |
    189 | )} 190 |
    191 | {(tab === "Notes" || !postData.exercise) && ( 192 | 218 | )} 219 | {tab === "Exercises" && postData.exercise && ( 220 |
    221 |
    222 | { 223 |
    224 |
    225 | { 226 | 230 | } 231 |
    232 | 253 |
    254 | } 255 |
    256 |
    257 | )} 258 | 259 | ); 260 | } 261 | 262 | function IntermediatePage() { 263 | return ( 264 | <> 265 |

    266 | {params.slug.length <= 2 && 267 | params.slug[params.slug.length - 1].replace(/_/g, " ")} 268 | {params.slug.length === 3 && 269 | params.slug[params.slug.length - 2].replace(/_/g, " ") + 270 | " - " + 271 | params.slug[params.slug.length - 1].replace( 272 | /_/g, 273 | " " 274 | )} 275 |

    276 | 277 |
    278 | 300 |
    301 | 302 | ); 303 | } 304 | 305 | return ( 306 | <> 307 | 308 | 309 | {(params.slug !== undefined 310 | ? params.slug[params.slug.length - 1].replace( 311 | /_/g, 312 | " " 313 | ) + " | " 314 | : "") + "Sam's Notes"} 315 | 316 | 317 | 330 | 337 | 338 | } 340 | sidebar={} 341 | navbar={} 342 | toggle={sidebarVisible} 343 | /> 344 | 345 | ); 346 | } 347 | 348 | export default Lecture; 349 | 350 | export async function getStaticProps({ params }) { 351 | const postData = await getPostData(params); 352 | const source = await serialize(postData.contentHtml, { 353 | components: components, 354 | mdxOptions: { 355 | remarkPlugins: [slug, math, remarkSmartypants, footnotes], 356 | rehypePlugins: [[highlightCode, { ignoreMissing: true }]], 357 | }, 358 | }); 359 | var exercise; 360 | if (postData.exercise) { 361 | exercise = await serialize(postData.exercise, { 362 | components: components, 363 | mdxOptions: { 364 | remarkPlugins: [slug, math, remarkSmartypants, footnotes], 365 | rehypePlugins: [[highlightCode, { ignoreMissing: true }]], 366 | }, 367 | }); 368 | } else { 369 | exercise = false; 370 | } 371 | const tree = getTree(); 372 | return { 373 | props: { 374 | tree, 375 | postData, 376 | params, 377 | source, 378 | exercise, 379 | }, 380 | }; 381 | } 382 | 383 | export async function getStaticPaths() { 384 | const paths = getPaths(); 385 | return { 386 | paths: paths, 387 | fallback: false, 388 | }; 389 | } 390 | -------------------------------------------------------------------------------- /pages/_app.js: -------------------------------------------------------------------------------- 1 | import "../styles/index.css"; 2 | import "katex/dist/katex.min.css"; 3 | import { useState } from "react"; 4 | 5 | function MyApp({ Component, pageProps }) { 6 | const [sidebarVisible, setSidebarVisible] = useState(false); 7 | return ( 8 | 13 | ); 14 | } 15 | 16 | export default MyApp; 17 | -------------------------------------------------------------------------------- /pages/_document.js: -------------------------------------------------------------------------------- 1 | import Document, { Html, Head, Main, NextScript } from "next/document"; 2 | class MyDocument extends Document { 3 | render() { 4 | return ( 5 | 6 | 7 | 8 | 13 | 18 | 19 | 20 |
    21 | 22 | 23 | 24 | 25 | ); 26 | } 27 | } 28 | 29 | export default MyDocument; 30 | -------------------------------------------------------------------------------- /pages/index.js: -------------------------------------------------------------------------------- 1 | import { useRef, useEffect } from "react"; 2 | import Sidebar from "../components/sidebar/sidebar"; 3 | import NavBar from "../components/navbar"; 4 | import { getTree } from "../lib/tree"; 5 | import Head from "next/head"; 6 | import { useRouter } from "next/router"; 7 | import Layout from "@/components/layout"; 8 | export default function Homepage({ tree, sidebarVisible, setSidebarVisible }) { 9 | const router = useRouter(); 10 | const node = useRef(); 11 | const node2 = useRef(); 12 | function toggleSidebar() { 13 | setSidebarVisible(!sidebarVisible); 14 | } 15 | 16 | useEffect(() => { 17 | if (open) { 18 | document.addEventListener("mousedown", handleClickOutside); 19 | } else { 20 | document.removeEventListener("mousedown", handleClickOutside); 21 | } 22 | 23 | return () => { 24 | document.removeEventListener("mousedown", handleClickOutside); 25 | }; 26 | }); 27 | 28 | useEffect(() => { 29 | router.events.on("routeChangeComplete", function () { 30 | setSidebarVisible(false); 31 | }); 32 | }, []); 33 | 34 | const handleClickOutside = (e) => { 35 | if ( 36 | node.current.contains(e.target) || 37 | node2.current.contains(e.target) 38 | ) { 39 | // inside click 40 | return; 41 | } 42 | // outside click 43 | setSidebarVisible(false); 44 | }; 45 | 46 | function Home() { 47 | return ( 48 |
    49 | 53 |
    54 |
    55 |

    56 | {"Sam's Notes"} 57 |

    58 |
    59 | 60 |

    61 | Notes taken for a variety of reasons 62 |

    63 |
    64 |
    65 | ); 66 | } 67 | 68 | return ( 69 | <> 70 | 71 | {"Sam's Notes"} 72 | 73 | 79 | 80 | 81 | } 83 | sidebar={ 84 | 85 | } 86 | navbar={} 87 | isFooter={false} 88 | toggle={sidebarVisible} 89 | /> 90 | 91 | ); 92 | } 93 | 94 | export async function getStaticProps() { 95 | const tree = getTree(); 96 | return { 97 | props: { 98 | tree, 99 | }, 100 | }; 101 | } 102 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: ["tailwindcss", "autoprefixer", "postcss-preset-env"], 3 | }; 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/favicon.ico -------------------------------------------------------------------------------- /public/home/down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /public/home/font.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/home/tailwind.svg: -------------------------------------------------------------------------------- 1 | tailwind_css -------------------------------------------------------------------------------- /public/home/undraw_noted_pc9f.svg: -------------------------------------------------------------------------------- 1 | noted -------------------------------------------------------------------------------- /public/img/Certifications/AZ900/Account/4-billing-structure-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Certifications/AZ900/Account/4-billing-structure-overview.png -------------------------------------------------------------------------------- /public/img/Certifications/AZ900/Compute/4-kub-migration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Certifications/AZ900/Compute/4-kub-migration.png -------------------------------------------------------------------------------- /public/img/Certifications/AZ900/Principles/5-layer-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Certifications/AZ900/Principles/5-layer-diagram.png -------------------------------------------------------------------------------- /public/img/Certifications/AZ900/Security/2-shared_responsibilities.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Certifications/AZ900/Security/2-shared_responsibilities.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/add_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/add_structure.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/associativity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/associativity.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/commutative.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/commutative.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/dual_parity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/dual_parity.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/gf_addition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/gf_addition.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/gf_mult.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/gf_mult.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/hamming_distance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/hamming_distance.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/hamming_generator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/hamming_generator.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/hamming_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/hamming_structure.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/identity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/identity.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/inverse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/inverse.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/mind_proof.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/mind_proof.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/minimum_distance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/minimum_distance.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/mult_cycle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/mult_cycle.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/mult_distributes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/mult_distributes.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/or_mod2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/or_mod2.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/parity_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/parity_check.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/pc_matrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/pc_matrix.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/primitive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/primitive.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/repetition_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/repetition_code.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/ECC/systematic_form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/ECC/systematic_form.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/InfTheo/channel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/InfTheo/channel.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/InfTheo/convex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/InfTheo/convex.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/InfTheo/drv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/InfTheo/drv.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/InfTheo/drv_expectation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/InfTheo/drv_expectation.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/InfTheo/entropy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/InfTheo/entropy.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/InfTheo/entropy_venn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/InfTheo/entropy_venn.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/InfTheo/jensen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/InfTheo/jensen.png -------------------------------------------------------------------------------- /public/img/Uni/CaC/InfTheo/memoryless_channel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/CaC/InfTheo/memoryless_channel.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Cuckoo/chaining.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Cuckoo/chaining.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Cuckoo/cuckoo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Cuckoo/cuckoo.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Cuckoo/cuckoo_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Cuckoo/cuckoo_graph.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Cuckoo/dictionary_operations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Cuckoo/dictionary_operations.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Cuckoo/hash_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Cuckoo/hash_table.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Intro/axioms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Intro/axioms.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Intro/conditional_probability.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Intro/conditional_probability.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Intro/expected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Intro/expected.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Intro/further_rules.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Intro/further_rules.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Intro/independence.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Intro/independence.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Intro/independent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Intro/independent.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Intro/linearity_of_expectation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Intro/linearity_of_expectation.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Intro/mutual_independent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Intro/mutual_independent.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Intro/pairwise_independent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Intro/pairwise_independent.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Intro/random_variable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Intro/random_variable.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Intro/uniform_distribution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Intro/uniform_distribution.png -------------------------------------------------------------------------------- /public/img/Uni/DADS/Universal/k-universal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/Uni/DADS/Universal/k-universal.png -------------------------------------------------------------------------------- /public/img/open_source/git/commands/clone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/open_source/git/commands/clone.png -------------------------------------------------------------------------------- /public/img/open_source/git/gitkraken/GitKraken_Main.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/open_source/git/gitkraken/GitKraken_Main.webp -------------------------------------------------------------------------------- /public/img/open_source/git/gitkraken/left_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/open_source/git/gitkraken/left_bar.png -------------------------------------------------------------------------------- /public/img/open_source/git/gitkraken/middle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/open_source/git/gitkraken/middle.png -------------------------------------------------------------------------------- /public/img/open_source/git/gitkraken/right_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/open_source/git/gitkraken/right_bar.png -------------------------------------------------------------------------------- /public/img/open_source/git/gitkraken/top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/open_source/git/gitkraken/top.png -------------------------------------------------------------------------------- /public/img/open_source/github/fork/Forked_Repo.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/open_source/github/fork/Forked_Repo.webp -------------------------------------------------------------------------------- /public/img/open_source/github/fork/create_pr.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samrobbins85/general-notes/7ae77f067f69b7086691e617cf9a73120abfa4f9/public/img/open_source/github/fork/create_pr.webp -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # * 2 | User-agent: * 3 | Allow: / 4 | 5 | # Host 6 | Host: https://notes.samrobbins.uk 7 | 8 | # Sitemaps 9 | Sitemap: https://notes.samrobbins.uk/sitemap.xml 10 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Notes Site 2 | 3 | This is a site for my university notes, written in MDX 4 | 5 | You can find the markdown for all the lectures in the `notes` directory, and all the images in the `public` directory. When adding styles you can use [Tailwind CSS](https://tailwindcss.com/). 6 | 7 | ## Diagrams 8 | 9 | You can add diagrams using [mermaidjs](https://mermaid-js.github.io/mermaid/#/) and [graphviz](https://www.graphviz.org/). I also can easily add any of the diagram types from [kroki](https://kroki.io/), so raise an issue if you want to use one of them. 10 | 11 | To use them, simply create a codeblock with the language of `mermaid` and `graphviz` respectively and write the diagram and it will be imported 12 | 13 | ## Workarounds 14 | 15 | For all the admonitions, such as ``, have a space before and after the text, such as 16 | 17 | ``` 18 | 19 | 20 | **Content** in here 21 | 22 | 23 | ``` 24 | 25 | This allows the markdown to be processed 26 | 27 | ## Performance issues in Firefox with uBlock Origin 28 | 29 | By default uBlock Origin disables link prefetching, which is one of the methods that the website uses to increase performance. If you notice the site being slow when you are using Firefox with uBlock Origin, you can change this in the uBlock Origin settings on the **settings** tab under **privacy** uncheck **disable link prefetching**. 30 | -------------------------------------------------------------------------------- /styles/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | @layer base { 6 | /* CSS for Docsearch */ 7 | @import url(https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css); 8 | /* Prism CSS */ 9 | 10 | @import "prism-atom-dark.css"; 11 | 12 | /* CSS for Inter Font */ 13 | 14 | @import url("https://rsms.me/inter/inter.css"); 15 | html { 16 | font-family: "Inter", sans-serif; 17 | font-feature-settings: "frac"; 18 | } 19 | @supports (font-variation-settings: normal) { 20 | html { 21 | font-family: "Inter var", sans-serif; 22 | font-feature-settings: "frac"; 23 | } 24 | } 25 | 26 | @font-face { 27 | font-family: "JetBrains Mono"; 28 | src: url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/eot/JetBrainsMono-Regular.eot") 29 | format("embedded-opentype"), 30 | url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff2/JetBrainsMono-Regular.woff2") 31 | format("woff2"), 32 | url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/web/woff/JetBrainsMono-Regular.woff") 33 | format("woff"), 34 | url("https://cdn.jsdelivr.net/gh/JetBrains/JetBrainsMono/ttf/JetBrainsMono-Regular.ttf") 35 | format("truetype"); 36 | font-weight: default; 37 | } 38 | 39 | span.overline-line { 40 | border-color: #4a5568 !important; 41 | } 42 | 43 | /* CSS for the colours in code */ 44 | 45 | :root { 46 | --color-code-green: #b5f4a5; 47 | --color-code-yellow: #ffe484; 48 | --color-code-purple: #d9a9ff; 49 | --color-code-red: #ff8383; 50 | --color-code-blue: #93ddfd; 51 | --color-code-white: #fff; 52 | } 53 | 54 | /* Offset content by navbar */ 55 | .main-content { 56 | height: calc(100vh - 3rem); 57 | } 58 | 59 | .math-display { 60 | @apply overflow-x-auto; 61 | @apply overflow-y-hidden; 62 | @apply py-4; 63 | } 64 | 65 | /* Styling for anchor links */ 66 | 67 | .prose h1 a, 68 | .prose h2 a, 69 | .prose h3 a, 70 | .prose h4 a, 71 | .prose h5 a, 72 | .prose h6 a { 73 | @apply inline-block opacity-0 ml-1; 74 | } 75 | 76 | .prose h1:hover a, 77 | .prose h2:hover a, 78 | .prose h3:hover a, 79 | .prose h4:hover a, 80 | .prose h5:hover a, 81 | .prose h6:hover a { 82 | @apply opacity-100; 83 | } 84 | 85 | h1, 86 | h2, 87 | h3, 88 | h4, 89 | h5, 90 | h6, 91 | sup { 92 | scroll-margin-top: 6em; 93 | } 94 | 95 | .bmc-button img { 96 | height: 34px !important; 97 | width: 35px !important; 98 | margin-bottom: 1px !important; 99 | box-shadow: none !important; 100 | border: none !important; 101 | vertical-align: middle !important; 102 | } 103 | .bmc-button { 104 | padding: 7px 15px 7px 10px !important; 105 | line-height: 35px !important; 106 | height: 51px !important; 107 | text-decoration: none !important; 108 | display: inline-flex !important; 109 | color: #ffffff !important; 110 | background-color: #ff813f !important; 111 | border-radius: 8px !important; 112 | border: 1px solid transparent !important; 113 | font-size: 24px !important; 114 | letter-spacing: 0.6px !important; 115 | box-shadow: 0px 1px 2px rgba(190, 190, 190, 0.5) !important; 116 | -webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important; 117 | margin: 0 auto !important; 118 | font-family: "Cookie", cursive !important; 119 | -webkit-box-sizing: border-box !important; 120 | box-sizing: border-box !important; 121 | } 122 | .bmc-button:hover, 123 | .bmc-button:active, 124 | .bmc-button:focus { 125 | -webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important; 126 | text-decoration: none !important; 127 | box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important; 128 | opacity: 0.85 !important; 129 | color: #ffffff !important; 130 | } 131 | } 132 | 133 | @media (max-width: 768px) { 134 | .algolia-autocomplete .ds-dropdown-menu { 135 | max-width: calc(100vw - 32px) !important; 136 | min-width: calc(100vw - 32px) !important; 137 | width: calc(100vw - 32px) !important; 138 | margin-left: 16px !important; 139 | } 140 | .algolia-autocomplete .algolia-docsearch-suggestion--content { 141 | width: 100% !important; 142 | padding-left: 0 !important; 143 | } 144 | .algolia-autocomplete .algolia-docsearch-suggestion--content:before { 145 | display: none !important; 146 | } 147 | .algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { 148 | display: none !important; 149 | } 150 | } 151 | 152 | #carbonads { 153 | @apply flex bg-white border border-gray-400 rounded; 154 | max-width: 330px; 155 | } 156 | 157 | #carbonads span { 158 | @apply relative block overflow-hidden; 159 | } 160 | 161 | #carbonads .carbon-wrap { 162 | @apply flex; 163 | } 164 | 165 | .carbon-img { 166 | @apply block m-0 leading-none; 167 | } 168 | 169 | .carbon-img img { 170 | @apply block; 171 | } 172 | 173 | .carbon-text { 174 | font-size: 13px; 175 | padding: 10px; 176 | line-height: 1.5; 177 | text-align: left; 178 | } 179 | 180 | .carbon-poweredby { 181 | @apply block text-center uppercase font-semibold text-gray-600 leading-none text-xs tracking-wide py-2 border-t border-gray-400; 182 | } 183 | 184 | /* #carbonads_1 { 185 | display: none; 186 | } */ 187 | 188 | div[id^="carbonads_"] { 189 | display: none; 190 | } 191 | 192 | .adwrap > div { 193 | @apply my-auto; 194 | } 195 | -------------------------------------------------------------------------------- /styles/prism-atom-dark.css: -------------------------------------------------------------------------------- 1 | .token.tag, 2 | .token.class-name, 3 | .token.selector, 4 | .token.selector .class, 5 | .token.function { 6 | @apply text-fuchsia-400; 7 | } 8 | 9 | .token.attr-name, 10 | .token.keyword, 11 | .token.rule, 12 | .token.operator, 13 | .token.pseudo-class, 14 | .token.important { 15 | @apply text-cyan-400; 16 | } 17 | 18 | .token.attr-value, 19 | .token.class, 20 | .token.string, 21 | .token.number, 22 | .token.unit, 23 | .token.color { 24 | @apply text-lime-300; 25 | } 26 | 27 | .token.punctuation, 28 | .token.module, 29 | .token.property { 30 | @apply text-light-blue-200; 31 | } 32 | 33 | .token.atapply .token:not(.rule):not(.important) { 34 | color: inherit; 35 | } 36 | 37 | .language-shell .token:not(.comment) { 38 | color: inherit; 39 | } 40 | 41 | .language-css .token.function { 42 | color: inherit; 43 | } 44 | 45 | .token.comment { 46 | @apply text-gray-400; 47 | } 48 | 49 | .token.deleted:not(.prefix) { 50 | @apply relative block -mx-4 px-4; 51 | } 52 | 53 | .token.deleted:not(.prefix)::after { 54 | content: ""; 55 | @apply pointer-events-none absolute inset-0 block bg-rose-400 bg-opacity-25; 56 | } 57 | 58 | .token.deleted.prefix { 59 | @apply text-gray-400 select-none; 60 | } 61 | 62 | .token.inserted:not(.prefix) { 63 | @apply block bg-emerald-700 bg-opacity-50 -mx-4 px-4; 64 | } 65 | 66 | .token.inserted.prefix { 67 | @apply text-emerald-200 text-opacity-75 select-none; 68 | } 69 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | const colors = require("tailwindcss/colors"); 2 | 3 | module.exports = { 4 | mode: "jit", 5 | presets: [require("@samrobbins/typography")], 6 | purge: [ 7 | "./components/**/*.{js,ts,jsx,tsx}", 8 | "./pages/**/*.{js,ts,jsx,tsx}", 9 | "./layouts/**/*.{js,ts,jsx,tsx}", 10 | "./lib/**/*.{js,ts,jsx,tsx}", 11 | "./notes/**/*.md", 12 | ], 13 | theme: { 14 | fontFamily: { 15 | mono: ["Jetbrains Mono"], 16 | }, 17 | extend: { 18 | maxWidth: { 19 | ch64: "64ch", 20 | }, 21 | colors: { 22 | gray: colors.coolGray, 23 | teal: colors.teal, 24 | orange: colors.orange, 25 | fuchsia: colors.fuchsia, 26 | cyan: colors.cyan, 27 | lime: colors.lime, 28 | "light-blue": colors.lightBlue, 29 | rose: colors.rose, 30 | emerald: colors.emerald, 31 | }, 32 | }, 33 | }, 34 | variants: {}, 35 | plugins: [require("@tailwindcss/forms")], 36 | }; 37 | -------------------------------------------------------------------------------- /vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "github": { 4 | "silent": true 5 | } 6 | } 7 | --------------------------------------------------------------------------------