Skip to main content

4 posts tagged with "command line"

View All Tags

· 2 min read

1Password is a password manager. Over the years, I have tried LastPass, BitWarden, and 1Password. Out of the three, 1Password has been my favourite. The Mac app, browser extension, and IOS app are well-polished. One of my favourite parts about 1Password is the ability to access passwords using the 1Password CLI.

Using op inject for secrets

I recently discovered a pattern to use the 1Password CLI to store all of my secrets in my dotfiles:

# ~/.zshrc
op inject --in-file "${HOME}/.dotfiles/secrets.zsh" | while read -r line; do
eval "$line"
done
# ~/.dotfiles/secrets.zsh
export NOTION_API_KEY="op://private/notion.so/api-token"
export TEST_PYPI_TOKEN="op://private/test.pypi.org/token"

· One min read

VS Code has a built in feature that allows you to send code directly from the editor to the terminal. By default, it is not assigned to any shortcut. You can assign it to a shortcut by adding the following to your keybindings.json file.

  • Open the command pallet using cmd + shift + p.
  • Type Preferences: Open Keyboard Shortcuts (JSON)
  • Then edit the keybindings.json file:
[
// Send selected bash code to terminal
{
"key": "shift+enter",
"command": "workbench.action.terminal.runSelectedText",
"when": "editorTextFocus && !findInputFocussed && !replaceInputFocussed && editorLangId == 'shellscript'"
}
]

The when key ensures that this shortcut is only active when you are working on a Shell Script file. Here is an example of the shortcut in action.

Gif of the sending shell script from the editor to the terminal.