Last active
June 28, 2023 09:00
-
-
Save lawrencegripper/28fa370211dae966cc28efc369c902b5 to your computer and use it in GitHub Desktop.
Atuin Codespace Sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db_path = "~/.config/atuin/history.db" | |
dialect = "uk" | |
style = "compact" | |
inline_height = 25 | |
invert = true | |
update_check = false | |
sync_frequency = "5m" | |
{{- if eq (env "CODESPACES") "true" }} | |
auto_sync = true | |
sync_address = "http://localhost:3123" | |
session_path = "/workspaces/atuin_session" | |
key_path = "/workspaces/atuin_key" | |
{{- else }} | |
auto_sync = true | |
sync_address = "http://my-local-atuin-server" | |
{{- end }} | |
show_preview = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
function get_recent_workspaces() | |
{ | |
gh codespace list --json name,gitStatus,lastUsedAt,repository \ | |
--template "{{range .}}{{.repository}} {{.gitStatus.ref}} last used: {{ slice .lastUsedAt 8 }} _ {{.name}};{{end}}" \ | |
| tr ';' '\n' | |
} | |
WORKSPACE=$( (echo empty; get_recent_workspaces) | rofi -dmenu -p "Select Codespace:") | |
if [ x"empty" = x"${WORKSPACE}" ] | |
then | |
code | |
elif [ -n "${WORKSPACE}" ] | |
then | |
NAME=$(echo $WORKSPACE | cut --delimiter="_" --fields=2) | |
echo "Opening codespace $NAME" | |
gh cs code --codespace $NAME --insiders | |
# Copy auth details for atuin | |
gh cs cp --codespace $NAME -e ~/.local/share/atuin/session 'remote:/workspaces/atuin_session' | |
gh cs cp --codespace $NAME -e ~/.local/share/atuin/key 'remote:/workspaces/atuin_key' | |
# atuin server languagetool grammer/spellcheck | |
kitty bash -c "gh codespace ssh --codespace $NAME -- -R 3123:my-local-atuin-server:80 -R 8081:my-language-tools-server:8081" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{- if eq (env "CODESPACES") "true" }} | |
# Configures hostname and user for synced commands | |
ATUIN_HOST_NAME="codespace/$GITHUB_REPOSITORY" | |
ATUIN_HOST_USER=$GITHUB_USER | |
{{- else }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment