From e2344342e036b09ae9203e2a263617b99e43e60e Mon Sep 17 00:00:00 2001 From: Jet Hughes Date: Thu, 7 Apr 2022 13:48:54 +1200 Subject: [PATCH] auto update --- content/cheatsheets/bash-tricks.md | 10 +++ content/daily_notes/2022-04-07.md | 1 - content/notes/12-automation.md | 98 +++++++++++++++++++++++++++ content/notes/13-automation.md | 7 ++ content/notes/cosc-202-lectures.md | 18 +++-- content/notes/finite-state-machine.md | 11 +++ content/notes/selenium.md | 11 +++ 7 files changed, 149 insertions(+), 7 deletions(-) create mode 100644 content/cheatsheets/bash-tricks.md create mode 100644 content/notes/12-automation.md create mode 100644 content/notes/13-automation.md create mode 100644 content/notes/finite-state-machine.md create mode 100644 content/notes/selenium.md diff --git a/content/cheatsheets/bash-tricks.md b/content/cheatsheets/bash-tricks.md new file mode 100644 index 000000000..1af48dccd --- /dev/null +++ b/content/cheatsheets/bash-tricks.md @@ -0,0 +1,10 @@ +**Busy waiting + +``` +while sleep 0.5; do + //do something +done +``` + + + diff --git a/content/daily_notes/2022-04-07.md b/content/daily_notes/2022-04-07.md index 62b9bbc86..286922fb8 100644 --- a/content/daily_notes/2022-04-07.md +++ b/content/daily_notes/2022-04-07.md @@ -10,7 +10,6 @@ Screamadelica - Primal Scream - spotify:album:3Kkocxhs4Ek537j67DFNd7 - [ ] 12:00 Cosc201 lab - [ ] 12:00 Info201 Lab - [ ] 11:00 Cosc201 Lecture -- [ ] 14:00 Cosc202 Lab - [ ] 14:00 Info203 Tutorial - [ ] 16:00 Cosc201 Tutorial diff --git a/content/notes/12-automation.md b/content/notes/12-automation.md new file mode 100644 index 000000000..e18ec7a44 --- /dev/null +++ b/content/notes/12-automation.md @@ -0,0 +1,98 @@ +--- +title: "12-automation" +tags: +- cosc202 +- lecture +--- +links: [cosc-202-lectures](notes/cosc-202-lectures.md) + +--- + +The use of automatic equipment in a production process. We desire to remove repetive work within software development + +1. Automation within existing tools +2. Tools that control other tools + +This automation should be designed to be efficient and easy to use quickly for a useful purpose. It should also be reliable and safe + +Dont spend more time automating than the time you will save. It's good to periodically re-check whether maintaining/developing an automation is warranted +[Relevant xkdc](https://i.imgur.com/RvYHIUW.png) + +# 1 Beware + +Automation bugs can rapidly cause big messes which can be difficult to undo + +So it is useful to do a 'dry run' first to check you automation works + +As always, keep backups + + +# 2 Automating GUI's + +- Windows: AutoHotkey +- macOS: Open Scripting Architecture +- Linux: most tools aren't GUI-only + + +# 3 Automating web apps + +[selenium](notes/selenium) can automate access to websites. + + +# 4 Macros and snippets + +[integrated-development-environments](notes/integrated-development-environments.md) can create macros. For example within vscode you can define snippets. These are are often included in laguage extensions. These snippets are templates for often repeated chunks of text. + +For example a snippet to create a latex slide + +``` +"dframe": { + "prefix": "BDF" + "body": "\\begin{dframe}{$1}\n \\1 $2\n\\end{dframe} + "description": "New dframe" }, +} +``` + + +## 4.1 Programming language macros + +Many programming languages include macros. These are "text replacement" macros. + +For example you can define a macro "pi 3.14....". This will then be expanded when the program is compiled + + +## 4.2 Shell automation + +Most command [shell](notes/shell.md) faciliate automation using shell scripts with loops and conditions. + +These are more suited to quick and simple tasks, as more with more complex tasks it is hard to handle edge cases and quirks. + +A good way to make scripts safetly is to test the steps interactively before making them into a script + +If a script is becoming complex, it is worth switching to python or some other language + + +## 4.3 Office 365 automation + +Office 365 has built in tools for automation. You can record macros using a GUI. You can use Visual Basic for applications. They also have a tool called Power Automate or Flow, which is used for building cloud based automations between products. This can faciliate forms of [continuous-integration](notes/continuous-integration.md) + +[Example Flow](https://i.imgur.com/Liiqzlh.png) + +# 5 Using tools to automate other tools + +## 5.1 Using code to create code + +You can you a program to product source code. For example you can write a java program to generate java code. This is suited for producing repetitive error prone source code. + +For example. You are building a command line tool. You want to have a help option. You can create a YAML definition to define command line arguments. You could then create code to parse this YAML and create generate the source code. + +[finite-state-machine](notes/finite-state-machine.md) are another example of something that may benefit from being created programatically + + +## 5.2 Code generation using spreadsheets + +Spreadsheets allow a mix of pattern (using formula) and exceptions (overriding formula for a particular row). This allows you to "eye ball" your shell commands. + +For example. each row is a command invocation. Columns build up command's invocation, including formulae. Then use concatenate function to join text from other columns. And copy and paste the rows into your shell + +This is useful for idempotent commands. i.e., change happens once. As nothing bad will happen if a command is run twice \ No newline at end of file diff --git a/content/notes/13-automation.md b/content/notes/13-automation.md new file mode 100644 index 000000000..97de105cd --- /dev/null +++ b/content/notes/13-automation.md @@ -0,0 +1,7 @@ +--- +title: "13-automation" +tags: +- +--- + + diff --git a/content/notes/cosc-202-lectures.md b/content/notes/cosc-202-lectures.md index be11c9251..918b194c2 100644 --- a/content/notes/cosc-202-lectures.md +++ b/content/notes/cosc-202-lectures.md @@ -4,12 +4,18 @@ tags: - lectures - cosc202 --- -links: [[[notes/cosc-202]]] +links: [cosc-202](notes/cosc-202.md) --- -- [[notes/07-testing]] -- [[notes/08-debugging]] -- [[notes/09-documentation]] -- [[notes/10-continuous-integration-1]] -- [[notes/11-continuous-integration-2]] +- [07-testing](notes/07-testing.md) +- [08-debugging](notes/08-debugging.md) +- [09-documentation](notes/09-documentation.md) +- [10-continuous-integration-1](notes/10-continuous-integration-1.md) +- [11-continuous-integration-2](notes/11-continuous-integration-2.md) +- [12-automation](notes/12-automation) + +```dataview +list +from #cosc202 and #lecture +``` \ No newline at end of file diff --git a/content/notes/finite-state-machine.md b/content/notes/finite-state-machine.md new file mode 100644 index 000000000..3f406d61b --- /dev/null +++ b/content/notes/finite-state-machine.md @@ -0,0 +1,11 @@ +--- +title: "finite-state-machine" +tags: +- cosc202 +--- + +A finite state machine is a program which has a number of states called nodes with transition edges between them. You then move the state of the program to a particular state by navigating through the edges. + +This can be implemented as a large switch block. However, this results code which is not suited for readability. It may be useful to define the program using some higher order structure, and create it programmatically via [2 1 Using code to create code](notes/12-automation#2%201%20Using%20code%20to%20create%20code) + +For example something like a phone machine could be implemented as a finite state machine \ No newline at end of file diff --git a/content/notes/selenium.md b/content/notes/selenium.md new file mode 100644 index 000000000..c4f4428b3 --- /dev/null +++ b/content/notes/selenium.md @@ -0,0 +1,11 @@ +--- +title: "selenium" +tags: +- cosc202 +--- + +Webdriver: implements web based tests + +IDE: record/playback interactions with web browsers + +You can mix automated and interactive options. \ No newline at end of file