mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 13:24:05 -06:00
auto update
This commit is contained in:
parent
2c4ec910fe
commit
e2344342e0
10
content/cheatsheets/bash-tricks.md
Normal file
10
content/cheatsheets/bash-tricks.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
**Busy waiting
|
||||||
|
|
||||||
|
```
|
||||||
|
while sleep 0.5; do
|
||||||
|
//do something
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -10,7 +10,6 @@ Screamadelica - Primal Scream - spotify:album:3Kkocxhs4Ek537j67DFNd7
|
|||||||
- [ ] 12:00 Cosc201 lab
|
- [ ] 12:00 Cosc201 lab
|
||||||
- [ ] 12:00 Info201 Lab
|
- [ ] 12:00 Info201 Lab
|
||||||
- [ ] 11:00 Cosc201 Lecture
|
- [ ] 11:00 Cosc201 Lecture
|
||||||
- [ ] 14:00 Cosc202 Lab
|
|
||||||
- [ ] 14:00 Info203 Tutorial
|
- [ ] 14:00 Info203 Tutorial
|
||||||
- [ ] 16:00 Cosc201 Tutorial
|
- [ ] 16:00 Cosc201 Tutorial
|
||||||
|
|
||||||
|
|||||||
98
content/notes/12-automation.md
Normal file
98
content/notes/12-automation.md
Normal file
@ -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
|
||||||
7
content/notes/13-automation.md
Normal file
7
content/notes/13-automation.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
title: "13-automation"
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
@ -4,12 +4,18 @@ tags:
|
|||||||
- lectures
|
- lectures
|
||||||
- cosc202
|
- cosc202
|
||||||
---
|
---
|
||||||
links: [[[notes/cosc-202]]]
|
links: [cosc-202](notes/cosc-202.md)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
- [[notes/07-testing]]
|
- [07-testing](notes/07-testing.md)
|
||||||
- [[notes/08-debugging]]
|
- [08-debugging](notes/08-debugging.md)
|
||||||
- [[notes/09-documentation]]
|
- [09-documentation](notes/09-documentation.md)
|
||||||
- [[notes/10-continuous-integration-1]]
|
- [10-continuous-integration-1](notes/10-continuous-integration-1.md)
|
||||||
- [[notes/11-continuous-integration-2]]
|
- [11-continuous-integration-2](notes/11-continuous-integration-2.md)
|
||||||
|
- [12-automation](notes/12-automation)
|
||||||
|
|
||||||
|
```dataview
|
||||||
|
list
|
||||||
|
from #cosc202 and #lecture
|
||||||
|
```
|
||||||
11
content/notes/finite-state-machine.md
Normal file
11
content/notes/finite-state-machine.md
Normal file
@ -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
|
||||||
11
content/notes/selenium.md
Normal file
11
content/notes/selenium.md
Normal file
@ -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.
|
||||||
Loading…
Reference in New Issue
Block a user