Blog: 2024-09-17: Difference between revisions
No edit summary |
No edit summary |
(No difference)
|
Latest revision as of 23:41, 17 September 2024
More editor ideas: either don't clear scrollback, or if you do clear scrollback, output the changes as a diff
$ edit ronin diff --git a/ronin b/ronin index 2805e3b..5cdfd6d 100755 --- a/ronin +++ b/ronin @@ -50,8 +50,8 @@ ronin_launch() { -hda "$RONIN_DISK" \ -m 4096 \ -nic hostfwd=tcp::2022-:22 \ - -daemonize \
or
$ edit ronin #!/bin/sh # Create a virtual machine and log in set -e test ! -z "$RONIN_DEBUG" && set -x RONIN_HOME="$HOME/.ronin" RONIN_CACHE="$HOME/.cache/ronin" RONIN_DISK="$RONIN_HOME/ronin-disk.qcow2" <... etc>
Working on my editor, trying to pull up ipython, I got an error about my python profile. Ok so I removed my startup script and now ipython has a broken symlink. unsymlink failed silently: I forgot the ; before and:
is-symlink $file and rm $file
should have been
is-symlink $file; and rm $file
Turns out `move` had the same error. But even after fixing it, the original `mv` didn't do what it said in the readme:
Also warns you if you are trying to move a directory symlink which is ending in slash: ``` $ mkdir mydir $ ln -s mydir mylink $ mv mylink/ renamed mv: cannot move 'mylink/' to 'renamed': Not a directory ``` `move` gives a more descriptive error: ``` $ move mylink/ renamed move: `from` argument "mylink/" is a symlink with a trailing slash. move: to rename a symlink, remove the trailing slash from the argument. ``` This arises because tab completion adds the slash. Completion for `move` could avoid the slash, but then again you might want to move a file within the symlinked directory.
In reality:
hack $ mkdir-cd fish-stuff3 fish-stuff3 $ mkdir mydir fish-stuff3 $ ln -s mydir/ mylink fish-stuff3 $ unsymlink ./mylink fish-stuff3 $ ln -s mydir mylink fish-stuff3 $ command mv mylink/ renamed fish-stuff3 $ fish-stuff3 $ # uhh no error
So I figured this might be a macos discrepancy (I'd call it an issue but it's not an issue, it works, which is unexpected, so it is an issue?)
ok so in order to get a vm on mac (cause ronin is broken anyways :( ) I saw this forum post: https://forums.macrumors.com/threads/is-there-something-like-windows-subsystem-for-linux-wsl-on-mac.2381667/
which led me to https://github.com/canonical/multipass
which is kinda like ronin but only for ubuntu? Anyways it works~
fish-stuff2 $ multipass shell Launched: primary Mounted '/Users/razzi' into 'primary:Home' Welcome to Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-44-generic x86_64) ...
Turns out it is an ubuntu problem:
hack $ move renamed/ mylink mv: cannot move 'renamed/' to 'mylink': Not a directory
but I'm going to keep my `move` argument checking to be safe across platforms. I guess on mac the behavior is to move the symlink target if you use the low-level `mv`, which is funky ...
fish-stuff4 $ ls fish-stuff4 $ mkdir mydir fish-stuff4 $ ln -s mydir mylink fish-stuff4 $ move mylink/ renamed move: `from` argument "mylink/" is a symlink with a trailing slash. move: to rename a symlink, remove the trailing slash from the argument. fish-stuff4 $ move mylink renamed fish-stuff4 $ command mv renamed/ hi fish-stuff4 $ ls hi/ renamed@
---
Alright after much hackery I have something working
editor-stuff $ cat testit.py keystrokes = ['i', 'hello', '<esc>', ':wq', '<return>'] import os import time import subprocess # subprocess.run('tmux') p = subprocess.Popen(['tmux']) print('tmux run') # os.system('tmux') time.sleep(1) p.terminate() print('all done') # os.system('exit')
Which is taken from https://stackoverflow.com/questions/636561/how-can-i-run-an-external-command-asynchronously-from-python
basically
alright enough of this I'm going to bed.