3 ms·
I often need to login to colleagues' machines at work, but I find that their settings are not what I am familiar with. So I wrote an SSH wrapper in POSIX shell
by sdovan1 9mo ago
I often need to login to colleagues' machines at work, but I find that their settings are not what I am familiar with.
So I wrote an SSH wrapper in POSIX shell which tars dotfiles into a base64 string, passes it to SSH, and decodes / setups on the remote temp directory. Automatically remove when session ends.
Supported: .profile, .vimrc, .bashrc, .tmux.conf, etc.
This idea comes from kyrat[1]; passing files via a base64 string is a really cool approach.
[1]: https://github.com/fsquillace/kyrat/ https://github.com/fsquillace/kyrat/
- amelius 9mo agoOk, but what if your colleague does not have Vim installed? Wouldn't it make more sense to have a tool that brings files over to the local computer, starts Vim on them, and then copies them back?
- Joker_vD 9mo agoThat starts to sound like using VS Code in remote mode.
- exe34 9mo agoEmacs in tramp mode.
- QuinnyPig 9mo agoI can’t recall encountering a system in the last 15 years that didn’t have vim (or at least vi for esoteric things) on it.
- deleted 9mo ago[deleted]
- SoftTalker 9mo agoWould not be uncommon in a container or purpose-built VM.
- godelski 9mo agoHave you run into that? I can't recall ever facing that issue. Seems very weird to strip down that much and then use a different editor. Do you remember if ed was missing in those machines?
- SoftTalker 9mo agoYes I've run into containers where every utility that wasn't needed to run the service was stripped out. Even tools such as "less."
- godelski 9mo agoSo what was the editor?
- bartvk 9mo ago> Do you remember if ed was missing in those machines I had to laugh out loud. I couldn't imagine such a system, that wouldn't be POSIX compliant. So I looked it up, and indeed, it's entirely possible. Debian doesn't necessarily include it. https://unix.stackexchange.com/a/609067 https://unix.stackexchange.com/a/609067
- godelski 9mo agoWhile not mandatory, vi is part of the POSIX commands. I mean you could use ed or even hack your way with awk, sed, and/or grep but no one wants to deal with that bullshit. And if you're installing vi you might as well install vim, right? I've been on a lot of systems and can't remember a single instance of not having vi (though I do vim). So pretty rare, like you said https://en.wikipedia.org/wiki/List_of_POSIX_commands https://en.wikipedia.org/wiki/List_of_POSIX_commands
- sdovan1 9mo agoWe usually work on the VM with daily-built ISO. For example, I would compile and upload Java program to the frontend team member's VM, and type "srt" for "systemctl restart tomcat."
- Joker_vD 9mo agoscp my-precious-dotfiles remote:~ trap 'ssh remote rm my-precious-dotfiles' EXIT ssh remote Or you can even bake the trap into the remote bash's invocation, although that'd be a bit harder.
- stephenlf 9mo agoThat overwrites the remote dotfiles. Any workarounds?
- rzzzt 9mo agoGNU Stow? https://systemcrafters.net/managing-your-dotfiles/using-gnu-stow/ https://systemcrafters.net/managing-your-dotfiles/using-gnu-... Keep the alternate sets in different subdirectories.
- Joker_vD 9mo agoIt's kinda amusing how much of interesting software there is beyond coreutils and GCC that came from GNU, and how little adoption it has actually seen.
- zeech 9mo agoI've found lnk [0] to be a nice tool for this. Similar to GNU Stow as another comment mentioned, but plays a bit nicer with git (and, in my opinion, is nicer to use). Edit: just remembered there was a good comparison of lnk and stow on the HN discussion of lnk from a few months back [1]. [0] https://github.com/yarlson/lnk https://github.com/yarlson/lnk [1] https://news.ycombinator.com/item?id=44080514 https://news.ycombinator.com/item?id=44080514
- godelski 9mo ago:h netrw You can also just place config files anywhere if you know what you then load. That's what I do in my dotfiles, but not exactly like the parent. I also purposefully keep the repo size tiny so it's also just easy to clone. I'd recommend setting a env var so you can always just set that Also don't forget you can have local vim files. I have a function at the end of my vimrc that looks for '.exrc', '.vim.local', '.nvim.local' in the current directory. Helpful for setting project settings.
- alsetmusic 9mo agoI came across something similar a few months ago. I pieced together a working hybrid by patching in parts from an older release with the latest version. I didn't ever work out if the latest version failed because of something in my environment or not, but I'm on a Mac fwiw. https://github.com/cdown/sshrc https://github.com/cdown/sshrc
- deleted 9mo ago[deleted]
- xuhu 9mo agoHow much time does it add when running e.g. "shittp user@lan-host uname" ?
- fragmede 9mo ago> I often need to login to colleagues' machines at work, but I find that their settings are not what I am familiar with I'd hate to jump to conclusions, but what username are you looking into what machines with for that to be an issue?