Hacker Newsnew | past | comments | ask | show | jobs | submit | PhilipRoman's commentslogin

zr?

vim folds are fully programmable. For me a bigger issue was git calling vimdiff for each file, which I fixed with my own difftool: https://gist.github.com/PhilipRoman/60066716b5fa09fcabfa6c95...


I ran in to a couple problems when trying that script (details below), but I'm really happy that you shared it, because I had not seen ':windo diffthis' before, and that method of scripting diffs. I'll definitely be customising it!

(I found that my mac machine doesn't support the '-printf' option, and also I was attempting to run 'git bvd main' on a branch but it seems it does a recursive directory diff, so I'll use 'git diff --name-only' as the input to the awk command).

Edit: worked nicely! I haven't used tabs much in vim so is a slightly new workflow but otherwise very handy


> For me a bigger issue was git calling vimdiff for each file,

If you configure vimdiff as the difftool in your git config, just doing a `git diff` would show you the diff for each file sequentially.


I think that's an oversimplification. Voting does not have the same dynamics as soccer goals. Maybe a better analogy would be that the team is already winning 5-1 and in the last minute someone makes it 5-2. Good job of course, but can't really be said to influence the outcome.

IMO there is actually a very low hanging fruit here, even without P2P or DHTs we could have an URI scheme that consists of a domain and document hash. It is then up to the user to add alternate mirrors for domains. Aside from privacy, it doesn't really matter who answers these requests since the documents are self-signing.

>>Nobody verifies host keys,

>The known_hosts file is verification of host keys

I think the point was that those devices typically generate host keys dynamically and therefore the host key verification is usually turned off, leaving you just with encryption (which is still better than telnet - at least you're safe against passive adversaries). At least that's what I've seen in practice.


Host key verification is a client feature and is on by default. Have you really never gotten the giant warning after a reinstall? That's what that is. SSH is telling you that the server has changed and isn't what you think.


I'm saying that 90% of these setups look like this (or do the equivalent thing manually):

   ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@192.168...
They have ssh, but no proper key management


Well, sure. You can turn off host key checking in ssh! But that isn't responsive to a point that (1) host key validation exists in ssh and (2) host key validation is on by default in ssh.


Their original comment was referring to people ignoring the warning banner and connecting anyway when the host changes. Not that it doesn't exist.


Exactly. But 'passive encryption' isn't helpful; if you can see the traffic, you can MITM it. Just RST the connection, wait for the reconnect, intercept.


The array indexing thing is a special case in [[...]] which is otherwise more-or-less secure (no expansion occurs under typical unquoted variable access). https://news.ycombinator.com/item?id=46631811



Your process can crash or be killed at any moment anyway. Depending on in-band cleanup is not reliable.


Sure, but there are many cases where you don't have to halt because you can cleanup and carry on.


I haven't given this more than 5 seconds of thought, but wouldn't it make sense to only enable the timing attack prevention for pseudo-terminal sessions (-t)?


It can be about as fast if you set key repeat delay to minimum and repeat speed to maximum. I used it for a while and got quite precise with it. Works well until someone else needs to use your computer for a moment...


Hm, I doubt the precision can match and avoid under/overshootings, especially at high enough repeat speed to match, and it's a global change that can affect even regular typing, so you're suggesting specialized training (to minimizeerrors) for a less effective workflow


The main issue with precise jumps (for me) is that they require you to

- already exactly know where you want to go

- figure out the relative distance either by looking to the side at relative line numbers or calculating

- move your hands to the numbers row to input numbers and back (I don't have small hands, but that still translates into a small amount of arm movement for me).

Whereas just using repeat input on jklhwe... only requires you to have a rough idea initially and leaves you plenty of time to figure out where exactly you want to stop while you're already getting there.

Besides: I don't like to think about random numbers while I'm coding. Doesn't exactly make the cursor feel like an extension of my body (imagine you had to tell your hand "move 10 centimeters left")

Another quite intuitive way I navigate is using "/something" and cycling through hits - usually you know some text that appears near the area you want to go. That was pretty much instant muscle memory.


> - already exactly know where you want to go

Same as with moving down by 1x10? How are you even choosing cursor direction if you don't know where to go to?

> - figure out the relative distance either by looking to the side

Ok, how is that an issue? You also have to figure out the distance by looking down when moving down with the arrows, so eyes still move?

> move your hands to the numbers row to input numbers and back

No, you could maintain your hands on the home row and use a numpad layer containing it

> imagine you had to tell your hand "move 10 centimeters left"

Imagine you had to tell your hand "move 1 centimeter left 10 times"? The mouse is that extension where you don't "move by 1 pixel X times" and move in an analog way


Oh. Now I get why we're talking past each other. There's a thing most computers are configured to do out of the box, but yours might be different for some reason.

I'm going to assume you're using Windows. In that case go to Settings > Accessibility > Keyboard and configure "Character Repeat". What this will do is repeat a key you're holding as if you're pressing it multiple times! Configure it until it feels natural.

This is what people were referring to when we said we're holding a key. We're not pressing it 10 times, just holding it down and having the computer automatically repeat it until we're happy with the result (such as having moved where we wanted to). It's a bit like moving a mouse cursor, where you're also not calculating the offset you want to move your mouse in advance.


> It's slower to "stop precisely"on key hold/release

For longer distances, unless your repeat speed is very slow, you're often either holding a key repeat and stop before a few lines and then tap or overshooting and tap to go back. So ok, it's not 1x10, but 7+1x3 or 12-1x2

(but yes, the initial leg of the journey is more mouse-like "natural", but still not that because you can't vary speed on most keyboards unlike with they mouse/hand)

For smaller distances you could just tap a few times.


No one is doing 1x10 key presses. That's now how humans process information. You repeatedly press a key one time until what you see on screen is what you want. The further away you are the faster you do it.


> press a key one time

That's "1"

> You repeatedly press

That's x10


[[...]] is non-portable and has an extremely quirky corner case with variable expansion in arithmetic contexts, what's not to love?


I'm intrigued - any info on that?

I personally use ((...)) for arithmetic tests and [[...]] for all other tests as I just target new versions of BASH and don't care much about POSIX compatibility.


This is completely safe: [ "${payload}" -eq 42 ]

This can evaluate arbitrary code: [[ "${payload}" -eq 42 ]]

Here is one example of a malicious payload:

  payload='a[$(touch /tmp/pwned)]'


Thanks.

Now I need to figure out whether (( payload == 42 )) is safe.


It appears not.


It also does wildcards though, with POSIX you'll need a case statement for that.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: