Skip to content

Commit

Permalink
Added FZF notes
Browse files Browse the repository at this point in the history
  • Loading branch information
mhvelplund committed Aug 7, 2024
1 parent 0f7c829 commit b1ca14e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 24 deletions.
12 changes: 10 additions & 2 deletions docs/DevOps/BashScripting.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 19 additions & 18 deletions docs/Programming/Node.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
# Node.js

## TS & ZX

Using `zx` with TypeScript, ESM and top-level `await`: <https://www.codejam.info/2023/04/zx-typescript-esm.html>

## 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].

<!--
https://github.com/teomrd/scripter
https://www.sitepoint.com/google-zx-write-node-shell-scripts/
https://github.com/simonplend/node-shell-scripting-with-zx>
https://blog.logrocket.com/building-typescript-cli-node-js-commander/
-->

## Installing node.js

Expand Down Expand Up @@ -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])

<!-- Links -->
[@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]: <https://web.archive.org/web/20201031135018/https://scotch.io/@nwayve/how-to-build-a-lambda-function-in-typescript>
[Set up a new TypeScript project]: <https://www.digitalocean.com/community/tutorials/typescript-new-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
10 changes: 6 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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) &amp; [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)._)

<!--
Expired :)
Expand Down

0 comments on commit b1ca14e

Please sign in to comment.