diff --git a/.zk/notebook.db b/.zk/notebook.db index c522d3b..9672195 100644 Binary files a/.zk/notebook.db and b/.zk/notebook.db differ diff --git a/zk/NodeJS_scripts.md b/zk/NodeJS_scripts.md new file mode 100644 index 0000000..d2e7dd2 --- /dev/null +++ b/zk/NodeJS_scripts.md @@ -0,0 +1,32 @@ +--- +id: 5043 +title: NodeJS_scripts +tags: [node-js] +created: Friday, April 26, 2024 +--- + +# NodeJS_scripts + +If we want to use NodeJS as a scripting language without going to the trouble of +setting up an NPM-based development environment, we can use the following +architecture + +```js +#!/usr/bin/env node + +const process = require("process"); + +const actualScript = (firstParam, secondParam) => { + // Do something +}; + +if (require.main === module) { + const [, param1, param2] = process.argv; + actualScript(param1, param2).catch(console.error); +} +``` + +This obviously requires NodeJS to be in your path and executable privileges. + +The key part is the module check at the bottom which makes the script file +invocable. diff --git a/zk/Single_file_Python_scripts.md b/zk/Single_file_Python_scripts.md new file mode 100644 index 0000000..a45fd41 --- /dev/null +++ b/zk/Single_file_Python_scripts.md @@ -0,0 +1,12 @@ +--- +id: atzw +title: Single_file_Python_scripts +tags: [] +created: Friday, April 26, 2024 +--- +# Single_file_Python_scripts + + +## Related notes + +