HNHacker News
TopNewBestAskShowJobs

kaushalmodi

353 karma · joined July 12, 2016

Loves Emacs and command-line utilities. You can find me by the same username on GitHub, Gitlab, reddit and Twitter.

Blog: https://scripter.co

* Few projects:

- Org-mode + Hugo: https://ox-hugo.scripter.co

- Eless (A Better less): https://eless.scripter.co

submissionscomments
kaushalmodi··on Let’s celebrate Hugo’s 5th birthday
> but I feel it's really held back by its templating language.

That's very subjective. It's templating language is one of the reasons why I use Hugo. It reminds me very much of Lisp ({{ or $foo $bar }}).. parens replaced with double curly braces.

Now, everyone doesn't like Lisp :)

kaushalmodi··on Let’s celebrate Hugo’s 5th birthday
Hello kqr! I didn't expect Org mode to be mentioned in this Hugo thread. So I'd like to mention my ox-hugo[1] project here. Here are few real-world examples of people using ox-hugo + Hugo: https://ox-hugo.scripter.co/doc/examples/ (while on that page, also search for "Exported from" :)).

ox-hugo basically lets each tool to do what they are best at: Org mode deals with the rich markup and Emacs/Elisp processing, and Hugo deals with the super-fast Markdown->HTML conversion.

[1] ox-hugo is an Emacs package that exports from Org mode to Markdown format that's compatible with Hugo/Blackfriday + automagically converts natural Org metadata to TOML/YAML front-matter.

kaushalmodi··on Migrating from Jekyll to Hugo
No, I got into developing an Emacs package that exports Org mode to Hugo-friendly Markdown - ox-hugo. Here's the package homepage created using Emacs/Org mode + ox-hugo + Hugo: https://ox-hugo.scripter.co/.
kaushalmodi··on Migrating from Jekyll to Hugo
> rolling your own set up isn't feasible for that because for it to be done right

I do cache-busting > hugo > minification using a simple bash wrapper script. Though, in the coming week, Hugo might natively start supporting the cache busting and minification.

kaushalmodi··on Migrating from Jekyll to Hugo
> md5 tagging at the Hugo level has been talked about since 2014 and it's still no where on the horizon. If SASS support still isn't out yet, who knows how long "later" is.

As someone who follows Hugo development closely, I wouldn't be surprised if both md5 tagging (fingerprinting) and sass support is out in the next week :)

See the Hugo Discourse for more details.

kaushalmodi··on Migrating from Jekyll to Hugo
I thought I would also end up just being one of those (I had a sort of setting-up the blog using Hugo post too). But lately my blogging on many other topics that I'm really passionate about has picked up.

Writing in Org mode has really reduced the writing block for me. I'm so glad I switched from Octopress to Hugo about maybe 2 years back.

kaushalmodi··on Learn new technology through writing a tutorial about it
I agree with the OP. Learning anything new is best done by noting down even small taken-for-granted things, things that you wouldn't care much about once you have mastered that thing.

I have been using this technique to learn the Nim programming language.

I write notes (semi-tutorial) about this language as I learn more about it. I explicitly mark things as "need to understand" or "todo" so that anyone browsing these notes knows that it's not written by a Nim expert but a Nim learner. And also the notes as strictly labelled "Notes" to make that explicit.

The notes: https://scripter.co/notes/nim/ (continuously work in progress)

This is the best experience I've had of learning so many other programming languages in the past.

kaushalmodi··on Ask HN: Next programming language to learn: Nim vs. D?
I have started using Nim fairly recently (past month). I actually wanted to start using it about a year back, but it never happened. But my return to Nim was a good step; this time I might be here for a while as I have started to understand the nitty-gritty details of the language [1].

Couple of reasons why I think Nim is an awesome language:

1. Syntax: It's beautiful. If you like Python syntax, you'll like this. On the other hand, it's much more concise, without losing readability.

2. Static type check, with a sprinkle of type inference only when assigning the initial value.

3. Proc/operator overloading: Have procedures (functions) named the same handle different data types differently. And the same with operators.

4. Support: Great support over Gitter, GitHub issues, Nim Forum, etc. Great devs! (though, I incorrectly thought earlier that that wasn't the case :))

5. Makes me feel home: Hacking/coding in Nim comes the closest to coding in Emacs Lisp. In Emacs, if I want to understand what a function does, I look at its source code. I can do the same in Nim.

6. Editor support: The nim-mode Emacs major mode and ob-nim Org Babel package are awesome!

7. Documentation: Check out the Nim the index.html to search anything, and also Devdocs.

8. Whitespace: Tab not allowed, yay!

9. Not as easy as installing go/rust toolchains locally (without admin rights), but not difficult either.

10. The nimble tool (equivalent of pip) works great for building/distributing Nim projects.

.. and much more! Computer science experts can talk about more benefits of Nim from systems programming point of view (GC, etc.).

For my use case, where I use Nim as Python/Bash replacement, CLI utility development, it looks excellent so far.

In plain terms, it's joy coding in Nim :)

[1]: https://scripter.co/notes/nim/

kaushalmodi··on Learning Programming with Nim
I am dabbling in Nim, and plan to replace bash/Python scripts with Nim. So far it looks really promising!

Few projects: nbuild[1], ntangle[2].

I wouldn't say that these are exemplary projects.. but they just show that Nim can replace bash/Python for command line utilities.

[1]: https://github.com/kaushalmodi/nbuild/ [2]: https://github.com/kaushalmodi/ntangle/

kaushalmodi··on Ask HN: What is your blogging platform of choice in 2018?
I write my blog posts and miscellaneous coding notes in Org mode, and export that to Markdown + front-matter for Hugo.

I simply commit the edits in git, push them to Gitlab, and Netlify picks those up and publishes using Hugo to https://scripter.co.

kaushalmodi··on Ask HN: What is your blogging platform of choice in 2018?
You don't even need to self-host. You can host for free.. many options: Netlify, Gitlab Pages, GitHub Pages, ..
kaushalmodi··on Ask HN: What is your blogging platform of choice in 2018?
I use this technique for cache busting with Hugo: https://blog.carlmjohnson.net/post/2017/hugo-asset-pipeline/. I am not a web developer, so have translated that flow to a simple Bash script which I run on Netlify.

Hugo v0.43 has inbuilt cache busting on the roadmap, and Hugo v0.42 will probably be released in about a week.

kaushalmodi··on Emacs 26 Brings Generators and Threads
That doesn't quite ring any bell.. Have you used edebug? I haven't seen that level of code introspection and debbugability in any other tool, even a development environment.

Emacs allows you to look into and debug any function or variable, be it internal that shipped with its core, or one that you wrote.

kaushalmodi··on Emacs 26 Brings Generators and Threads
> Emacs is in a race, not against Vim, but against VS Code and Atom for which editor can be more easily customized. In the long run, it doesn't look good for Emacs.

I use Emacs as my daily driver. Your comment feels very much like from someone who hasn't realized the true powers of Emacs-Lisp. Even if someone doesn't hack in Elisp, once they discover power packages like Org mode or Magit, they will know right away that there's no competition for those out there (vim, Atom, VS Code, etc).

> For years, James Gosling, author of the first version of Emacs that ran on Unix (the ancestor of GNU Emacs), has been begging people to stop using Emacs.

Even if that's the case, what's the point he's trying to make? Why? How does that matter to folks who are using Emacs today, and know it first hand that it's the best hackable text buffer engine out there?

kaushalmodi··on Winds 2.0: It’s Time to Revive RSS
Same thoughts here. I actually designed my own template for ATOM feeds for my Hugo generated blog. My blog serves both RSS and ATOM for the home page sections and even various taxonomies. So people interested in Emacs can subscribe to a feed of Emacs related posts only.
kaushalmodi··on Winds 2.0: It’s Time to Revive RSS
That's exactly what newsblur.com is. That RSS aggregator is awesome!
kaushalmodi··on Noteplan – Markdown Calendar, Todos, and Notes
Another +1 from an Emacs and Org mode user. I keep on wishing that I got introduced to Emacs sooner in my life.

It will help you with the organization using Org mode. But as you use it more, you might find yourself doing many more things more efficiently in Emacs.

Emacs is not something like Notepad where you go through all the settings and be rest assured that you know everything about the tool. Emacs is so extensible that if someone claims to know it 100%, they are naive. The beauty is that you learn to use the stuff that only you need, and learn more things as they come.

I am telling the above because you might get overwhelmed looking at Org mode feature set. But you don't have to know everything in that.. just learn and srart using what you need right now.

kaushalmodi··on Batch editing files with ed
> I believe the book's been out of print for sometime.

Hmm, I did not know that (I have a print copy of that book).

> I wouldn't post a link to a pirated anything.

OK. But just in case, someone still wants a physical book, they can get it used from Amazon (can talk about Amazon in US) for ~$3.

kaushalmodi··on Batch editing files with ed
Hmm, someone downvoted me. Can the downvoter explain what was wrong in what I said?
kaushalmodi··on Batch editing files with ed
Come on, don't promote piracy of the book! It's worth buying! Mods, please take down this link.
kaushalmodi··on Batch editing files with ed
+1 for The AWK Programming language book!

I have been reading through it and running code snippets from there as I find time. It's awesome!

If anyone's interested, I also update my notes from there on my blog.. https://scripter.co/notes/awk. I plan to have that notes post contain the entire book when I am done.

kaushalmodi··on Ask HN: What are your favorite terminal programs?
I understand. But the point I am trying to make applies there too. A script to do what I am doing in the tmuxp config I last pasted would be too unmanageable, and not as readable and reusable.
kaushalmodi··on Ask HN: What are your favorite terminal programs?
As I mentioned earlier, it is possible to do such things within the .tmux.conf, but not practical. Here's one of my real tmuxp configs:

    # How to use this file:
    #   tmuxp load /path/to/this/file/main.yaml
    # - Specifying the .yaml extension is optional
    # - Specifying the path is optional if file is in ~/.tmuxp
    #
    #   tmuxp --help for full help.
    session_name: main
    suppress_history: false
    start_directory: '~'
    shell_command_before:
      - unsetenv SHELL_CONFIG_LOADED
      - source ~/.alias
    windows:
      - window_name: '*scratch*'
        layout: tiled
        focus: true
        panes:
          - cd ~/downloads/git           # Top-left
          - cd ~/downloads/git/emacs     # Top-right
          - focus: true                  # Bottom-left
            shell_command:
              - bob
              - sleep 2
              - tclr                     # Clear tmux status indicators
          - shell_command:               # Bottom-right
              - cd ~/.emacs.d/elisp/org-mode
              - module load gcc/6.1.0    # Needed for ob-fortran tests to pass when doing make test for Org
      - window_name: foo-1
        layout: even-horizontal
        shell_command_before:
          - bob
          - cduh
        panes:
          - null
          - null
          - null
      - window_name: foo-2
        layout: tiled
        shell_command_before:
          - bob
          - cduh
        panes:
          - null
          - null
          - null
          - null
      - window_name: uvm_lib
        layout: tiled
        panes:
          - cd ~/gitlab/bar_uvm_lib
      - window_name: sandbox
        layout: even-horizontal
        panes:
          - null
          - null
          - null
      - window_name: hugo
        layout: tiled
        panes:
          - shell_command:
              - cd '~/downloads/git'
          - shell_command:
              - cd '~/e/elisp/ox-hugo/example-site'
              - ./srv
          - shell_command:
              - cd '~/hugo'
          - focus: true
            shell_command:
              - cd '~/e/elisp/ox-hugo'
      - window_name: nim
        layout: even-horizontal
        panes:
          - cd ~/sandbox/nim
          - cd ~/sandbox/nim
          - focus: true
            shell_command:
              - cd ~/sandbox/nim/chat
      - window_name: tok
        layout: even-horizontal
        shell_command_before:
          - tok
          - cduh
        panes:
          - null
          - null
          - null
      - window_name: zoo
        layout: even-horizontal
        shell_command_before:
          - bob
          - cduh
        panes:
          - null
          - null
          - null
kaushalmodi··on Ask HN: What are your favorite terminal programs?
The benefit of tmuxp is pretty clear from its README[1]. It gives this example:

    session_name: 4-pane-split
    windows:
    - window_name: dev window
      layout: tiled
      shell_command_before:
        - cd ~/                    # run as a first command in all panes
      panes:
        - shell_command:           # pane no. 1
            - cd /var/log          # run multiple commands in this pane
            - ls -al | grep \.log
        - echo second pane         # pane no. 2
        - echo third pane          # pane no. 3
        - echo forth pane          # pane no. 4
The example is very simple (I use tmuxp to heavily configure the session initialization), but it shows how you can have a config file to set a session's name, set the number and names of windows in there, set the layout of panes differently if you want in each window, run commands like "cd", set env vars differently if you want, in each pane.

You can find a lot more examples of tmuxp config on its doc site[2].

tmux doesn't allow one to have such quick, easy-to-read config files. You can of course do most of this in your .tmux.conf, but it will be too complicated to allow reuse and quick modifications.

[1]: https://github.com/tmux-python/tmuxp#load-a-tmux-session

[2]: https://tmuxp.git-pull.com/en/latest/examples.html

kaushalmodi··on Ask HN: What are your favorite terminal programs?
Emacs, tmux, tmuxp, ripgrep, eless[1], ncdu, exa (ls replacement. I often use 'exa --tree'), sed, awk, peco (I use this in aliases to select one or more items from a command outputting multiple values), hugo, dtrx, textract (npm), wget, shellcheck, rsync, htop.

I heavily use git, but via Magit in Emacs.

[1]: My own little utility to use bare bones Emacs as less/pager: https://eless.scripter.co

kaushalmodi··on Ask HN: What are your favorite terminal programs?
As you are using tmux, also check out the awesome tmuxp written in Python. The author is very thorough with the package; testing and documentation. Tmuxp allows you to quickly launch pre-configured tmux sessions.
kaushalmodi··on Show HN: I created a WordPress plugin to publish posts on a Facebook Page
I might be wrong, but I think FB is cutting off its publishing API in next few months or so.
kaushalmodi··on The Kruskal Count Card Trick
Same here.. tried it twice.. did not end up on the target card.

Just clarifying if how I counted was correct..

    5 x x x x 9
Above is a crude illustration.. If I first pick the card with "5", I start counting from 1 from the next card, till 5. And then I would land up on whatever that card is (9 in this example), and then I would repeat.

Did this, but did not work for me.

kaushalmodi··on Show HN: LayerJS – A simple UI composition and navigation library
Also, on a related suggestion, it could also be nice if layerJS could be modular, so that everyone does not need to download the whole thing if they only need the responsive menus, for example.

Of course, I realize that implementing this would be a lot of effort and would require change in your release flow.

But just in case, there's more demand for what I suggest, here's an inspiration from FontAwesome: https://fontawesome.com/get-started/svg-with-js. Note how they provide a fontawesome-all.js having all the icons. But they also provide separate fa-*.js for different icon families for the people who don't care about downloading the whole thing.

kaushalmodi··on Show HN: LayerJS – A simple UI composition and navigation library
Thanks for clarifying that. I think it would be useful to mention the size of dependencies a site would need if they want to use layerJS.
← PreviousPage 3 of 8Next →