There is no need to install Java or Graphviz on your Windows 10 Desktop. These are contained neatly within a Docker Container.
- Windows 10
- WSL2 (Ubuntu) - optional
- VSCode
- Docker Desktop
| #!/bin/bash | |
| function bin_check() { | |
| which $1 > /dev/null; exists=$? | |
| [ $exists -ne 0 ] && echo -e "\nERROR: $1 not found" && exit 1 | |
| printf "%-20s" $1 | |
| [ $exists -eq 0 ] && echo "OK" || echo "MISSING" | |
| } |
| /** | |
| ================================================================================= | |
| NextJS Link React component using next-link, next-router, muilink and TypeScript. | |
| Updated to resolve the following browser warning regarding passing "ref" to the DOM: | |
| > Warning: Failed prop type: Invalid prop `component` supplied to `ForwardRef(Link)`. | |
| > Expected an element type that can hold a ref. Did you accidentally provide a plain function component instead? | |
| > For more information see https://material-ui.com/r/caveat-with-refs-guide | |
| Example usage with Material UI: |
| { | |
| "workbench.startupEditor": "newUntitledFile", | |
| // Controls auto save of dirty files. Accepted values: 'off', 'afterDelay', 'onFocusChange' (editor loses focus), 'onWindowChange' (window loses focus). If set to 'afterDelay', you can configure the delay in 'files.autoSaveDelay'. | |
| "files.autoSave": "onWindowChange", | |
| // Controls the window title based on the active editor. Variables are substituted based on the context: | |
| // ${activeEditorShort}: the file name (e.g. myFile.txt) | |
| // ${activeEditorMedium}: the path of the file relative to the workspace folder (e.g. myFolder/myFile.txt) | |
| // ${activeEditorLong}: the full path of the file (e.g. /Users/Development/myProject/myFolder/myFile.txt) |
| // Node v6.9.0 | |
| // | |
| // TEST FILE (cut down for simplicity) | |
| // To ensure Golang encrypted string can be decrypted in NodeJS. | |
| // | |
| let crypto; | |
| try { | |
| crypto = require('crypto'); |
| [root@pal bin]# ./test_ghostdriver_useragent.sh | |
| === TEST #1 === | |
| phantomjs.page.settings.userAgent: iphone | |
| === START SESSION === | |
| /session : | |
| Response: |
| #!/bin/bash | |
| # pkill -KILL phantomjs | |
| # phantomjs --disk-cache=no --webdriver=4444 & | |
| # ------------------------------------------------------------------ | |
| # Config | |
| host="http://localhost" |
| [root@pal bin]# ./test_ghostdriver.sh | |
| /session : | |
| % Total % Received % Xferd Average Speed Time Time Time Current | |
| Dload Upload Total Spent Left Speed | |
| 100 536 100 536 0 0 8638 0 --:--:-- --:--:-- --:--:-- 0 | |
| Response: | |
| HTTP/1.1 200 OK | |
| Cache: no-cache | |
| Content-Length: 536 | |
| Content-Type: application/json;charset=UTF-8 |
| #!/bin/bash | |
| # ------------------------------------------------------------------ | |
| # Start Session | |
| echo "/session :" | |
| request="curl --include --data "{\"desiredCapabilities\":[{\"phantomjs.page.settings.userAgent\":\"iphone\"},{\"browserName\":\"phantomjs\"}]}" http://localhost:4444/wd/hub/session" | |
| # Example response: {"sessionId":"67b0bfd0-8f4c-11e3-94f9-11808a4b2852","status":0,"value":{"browserName":"phantomjs","version":"1.9.2","driverName":"ghostdriver","driverVersion":"1.0.4","platform":"linux-unknown-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"},"phantomjs.page.settings.userAgent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 BBC-GNL-BDD"}} | |
| response=$($request) | |
| echo "Response:" |