Live data from Hacker News

Viewing profile — rgrau

rgrau

HN member
Joined
Mon, Jun 11, 2012, 1:15 PM UTC
HN karma
524
Public activity
126 items

About rgrau

- https://github.com/kidd/Me

- https://puntoblogspot.blogspot.com

Recent public activity

  1. comment
    Comment #49061145

    So true. I think most of us who learned "advanced" bash is after being tired of feeling like an idiot looking at long bash scripts. Usually, those scripts are written by people who…

  2. comment
    Comment #49056388

    Nice one! I love those weird bash tricks. Some of the examples here are interesting, but they show parameter substitution more than colon itself: https://tldp.org/LDP/abs/html/para…

  3. comment
    Comment #47534690

    aha! I see what you mean, it's indeed a nice option, yep. Using brackets like this is something I never thought of, and it's probably why it's hard for me to process it, but I can …

  4. comment
    Comment #47533334

    That's very cool! To take advantage of the "leading space" one, I have this, to mark some commands that I never want to record: unhist () { alias $1=" $1" } unhist unhist unhist fz…

  5. comment
    Comment #47533257

    for multiline pipes, it's WAY better to format like foo | bar | baz You don't have to use backquotes, AND, it allows you to comment line by line, because there's no backslash messi…

  6. comment
    Comment #47528565

    A similar trick: #!/bin/sh $* that's my `~/bin/noglob` file, so when I call a zsh script from bash that uses `noglob`, it doesn't blow up.

  7. comment
    Comment #44314454

    I use a variant with ssh and some compression: docker save $image | bzip2 | ssh "$host" 'bunzip2 | docker load'

  8. comment
    Comment #37610213

    You can also nest those, so this way you can get a value from an argument, or an env var, and if none is set, error. echo "${1:-${env_var:?I need a value for that!}}"

  9. comment
    Comment #37240952

    Here's a solution in k, that uses a similar array oriented approach: &2=+/~x!/:\:x:!100 I wrote a little explanation of it, in case anyone is curious about how it works: https://gi…

  10. comment
    Comment #36411636

    I couldn't find a way to have more than one callback per signal, and created a system to have an array of callbacks: https://github.com/kidd/scripting-field-guide/blob/master/bo...…

  11. comment
    Comment #36338530

    Yep, good point. They are useful when you want to change the whole text inside the delimiters (and IME, it's most of the times), but they do different things than cf( because they …

  12. comment
    Comment #36337619

    I have 2 use cases for cf), but I don't use it a lot in the end: One is when inside a parenthesis, and wanting to really delete till the closing parenthesis. But that would leave a…

  13. comment
    Comment #36125345

    Another advantage of pipes at the end is that you can comment lines and the full pipeline still works. Some time ago I wrote a bunch of tips to make more ergonomic bash scripts: ht…

  14. comment
    Comment #35651635

    Here's where he explains how he did it: https://www.youtube.com/watch?v=ORjyXcLDd9M

  15. comment
    Comment #33355344

    Oh, I hadn't noticed that links are not highlighted as such (unless already visited). Fixed, thanks!

  16. comment
    Comment #33355246

    Fixed, thanks!

  17. comment
    Comment #33354744

    > If appropriate, change to the script’s directory close to the start of the script. > And it’s usually always appropriate. I wouldn't think so. You don't know where your script wi…

  18. comment
    Comment #28303363

    Oh! I didn't know that one could build an arbitrary string like that inside a map. Thanks a lot for that, I agree it looks better!

  19. comment
    Comment #28299196

    A very useful function in jq is "join", which I use a lot to cook the final shape of the data (many times used with fzf/dmenu) Here's a simple way to list and browse github issues …

  20. comment
    Comment #28006777

    Even funnier when you realize bash and zsh do different things (by default) there. foo="ls -las" $foo "$foo" for zsh to split words, `setopt SH_SPLIT_WORDS`.

  21. comment
    Comment #27739600

    Yep, sorry about that, I meant in general. This particular case is fine, and I am grateful for that.

  22. comment
    Comment #27739319

    yes! that looks super useful indeed. Thanks!

  23. comment
    Comment #27739112

    What I miss most about those collections is that they are browser based, and when I'm programming, if I need the music to stop, or I get a call, or something, I have to go find the…

  24. comment
    Comment #27730239

    thanks so much! I'll fix all those right away :+1:

  25. comment
    Comment #27729506

    wow, that's a great one!