From b1ca14e4bf2d006cfaa6e71b322fa58d9168b9ab Mon Sep 17 00:00:00 2001 From: Mads Hvelplund Date: Wed, 7 Aug 2024 05:47:09 +0000 Subject: [PATCH] Added FZF notes --- docs/DevOps/BashScripting.md | 12 ++++++++++-- docs/Programming/Node.md | 37 ++++++++++++++++++------------------ docs/index.md | 10 ++++++---- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/docs/DevOps/BashScripting.md b/docs/DevOps/BashScripting.md index ccda57c..dc2d111 100644 --- a/docs/DevOps/BashScripting.md +++ b/docs/DevOps/BashScripting.md @@ -14,15 +14,23 @@ * [4 Useful fzf Tricks for Your Terminal](https://pragmaticpineapple.com/four-useful-fzf-tricks-for-your-terminal/) * [Find anything you need with fzf, the Linux fuzzy finder tool](https://www.redhat.com/sysadmin/fzf-linux-fuzzy-finder) -```shell title="Example config" +```shell title="Install components" sudo apt install bat fd-find -export FZF_DEFAULT_OPTS="--preview 'batcat -f {}'" +``` + +```shell title="Add to .bashrc" export FZF_DEFAULT_COMMAND="fdfind --type f" +source /usr/share/doc/fzf/examples/completion.bash ``` +Now `ctrl-r` will use fzf to search through your history, and `ctrl-t` will open a file finder in the shell with +preview. `alt-c` will open a directory browser, but the shortcut might conflict with a short cut in VS Code, which will +need to be deleted. + ## Fancy Fish-like Bash Install [`ble.sh`](https://github.com/akinomyoga/ble.sh): + ```shell git clone --recursive https://github.com/akinomyoga/ble.sh.git make -C ble.sh diff --git a/docs/Programming/Node.md b/docs/Programming/Node.md index e269974..56062fa 100644 --- a/docs/Programming/Node.md +++ b/docs/Programming/Node.md @@ -1,16 +1,22 @@ # Node.js -## TS & ZX - -Using `zx` with TypeScript, ESM and top-level `await`: - -## Bundle JS app - -Compile a Node.js project into a single file. Supports TypeScript, binary addons, dynamic requires: [npmjs.com/@vercel/ncc] - -## Test server for OpenAPI specs +## Misc -A Node package that returns the examples from the API as responses: [@openapi-generator-plus/typescript-express-example-server-generator]. +- [Make a Promise out of a Callback function in JavaScript] +- Use node for shell scripting: [google/zx] +- [Set up a new TypeScript project] +- [How to Build an AWS Lambda Function in Typescript] (src: [scotch.io]) +- [How to fix "__dirname is not defined in ES module scope"] +- [Using `zx` with TypeScript, ESM and top-level `await`] +- Compile a Node.js project into a single file: [npmjs.com/@vercel/ncc] +- Test server for OpenAPI specs: [@openapi-generator-plus/typescript-express-example-server-generator]. + + ## Installing node.js @@ -48,19 +54,14 @@ echo "console.log('Hello World');" > index.ts npm install && tsc && node index.js ``` -## Misc - -- [Make a Promise out of a Callback function in JavaScript] -- Use node for shell scripting: [google/zx] -- [Set up a new TypeScript project] -- [How to Build an AWS Lambda Function in Typescript] (src: [scotch.io]) - [@openapi-generator-plus/typescript-express-example-server-generator]: https://www.npmjs.com/package/@openapi-generator-plus/typescript-express-example-server-generator +[google/zx]: https://github.com/google/zx [How to Build an AWS Lambda Function in Typescript]: ../files/How_to_Build_an_AWS_Lambda_Function_in_Typescript.pdf +[How to fix "__dirname is not defined in ES module scope"]: https://flaviocopes.com/fix-dirname-not-defined-es-module-scope/ [Make a Promise out of a Callback function in JavaScript]: https://www.freecodecamp.org/news/how-to-make-a-promise-out-of-a-callback-function-in-javascript-d8ec35d1f981/ [npmjs.com/@vercel/ncc]: https://www.npmjs.com/package/@vercel/ncc [scotch.io]: [Set up a new TypeScript project]: [Set up your Node.js development environment with WSL 2]: https://docs.microsoft.com/en-us/windows/nodejs/setup-on-wsl2 -[google/zx]: https://github.com/google/zx +[Using `zx` with TypeScript, ESM and top-level `await`]: https://www.codejam.info/2023/04/zx-typescript-esm.html diff --git a/docs/index.md b/docs/index.md index ca9db2c..2f60ed1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,13 +1,15 @@ # What's new -You know how sometimes you hit a wall while developing, and that starts a long quest through forums and documentation to find the right solution? I decided that I should probably start documenting some of those answers, so I don't have to slay the same dragon twice. +You know how sometimes you hit a wall while developing, and that starts a long quest through forums and documentation to +find the right solution? I decided that I should probably start documenting some of those answers, so I don't have to +slay the same dragon twice. ## Notes +- (2024-08-07) [Shell scripting](./DevOps/BashScripting.md) +- (2024-08-07) [Node.js & TypeScript](./Programming/Node.md) - (2024-06-21) [Python](./Programming/Python.md) - (2024-05-31) [OAuth2](./Miscellaneous/OAuth2.md) -- (2024-05-29) [Shell scripting](./DevOps/BashScripting.md) -- (2024-04-18) [Node.js & TypeScript](./Programming/Node.md) - (2024-03-21) [Kubernetes](./Miscellaneous/Kubernetes.md) - (2024-01-25) [OpenSSL/Certificates](./Miscellaneous/Certificates.md) - (2024-01-19) [Docker](./DevOps/Docker.md) @@ -34,7 +36,7 @@ You know how sometimes you hit a wall while developing, and that starts a long q - LinkedIn: [mhvelplund](https://www.linkedin.com/in/mhvelplund) - GitHub: [SwissArmyRonin](https://github.com/SwissArmyRonin) & [mhvelplund](https://github.com/mhvelplund) -- Twitter/X: 🚫 (_Friends don't let friends support Elon Musk._) +- Twitter/X: 🚫 (_Friends don't let friends support [Elon Musk](https://www.google.com/search?q=elon+musk+is+a+clown&udm=2)._)