kaushalmodi's recent activity
-
Comment on How do you store your bookmarks? in ~tech
-
Comment on Nim: A Programming Language Underdog in ~comp
kaushalmodi (edited )Link ParentSome of my Nim projects are public; you can find them here. nbuild — This is a bash-script port. I am playing with adding TOML config file companion file to this script to streamline my local...Some of my Nim projects are public; you can find them here.
- nbuild — This is a bash-script port. I am playing with adding TOML config file companion file to this script to streamline my local package builds. This is a rough translation of this bash script. At the moment, I have a separate bash script for dozens of apps that I install locally (it's not as simple as
make && make install
for all apps as I am on an old OS RHEL 6.8 without sudo rights). Plan is to have just this onenbuild
binary do building for all the packages, while picking package-specificCFLAGS
/LDFLAGS
, build usingmake
/go
/cargo
etc., whatever from that TOML config file. - noxhugo — Had I not known of Nim, I would have used bash for this one. This is what it does.
- ntodo — I would have written this one in Python if I hadn't known of Nim. This is my latest project in Nim. If someone is using Todoist, and wants to try compiling a Nim project to see how to access their Todoist tasks from CLI, this is a good project :). The project is stable, but WIP i.e. I added API support for all Todoist project actions, and most task actions.
- nbuild — This is a bash-script port. I am playing with adding TOML config file companion file to this script to streamline my local package builds. This is a rough translation of this bash script. At the moment, I have a separate bash script for dozens of apps that I install locally (it's not as simple as
-
Comment on Nim: A Programming Language Underdog in ~comp
kaushalmodi I haven't finished the book. I started reading it a while back and finished only a tiny bit of it (Section I: first 3 chapters). The reading experience was nice. It mainly corroborated what I...I haven't finished the book. I started reading it a while back and finished only a tiny bit of it (Section I: first 3 chapters). The reading experience was nice. It mainly corroborated what I already learned about Lisps in general by using Emacs Lisp.
I think it's a good "Introduction to Lisp" book.. helps people familiarize with everything is a list concept,
car
,cdr
, etc. (from what I read in the first 3 chapters).Now I need to find time to finish that book. At the moment, I am reading this awesome book on the history of some of the not-so-known typographical characters: Shady Characters.
-
Comment on Nim: Deploying static binaries in ~comp
kaushalmodi I appreciate that comment. Thanks. This is the first time I spent some time in figuring out how to deploy binaries and also optimize them. So I write these posts to also serve as reference notes...Great post! I particularly appreciate how you take the time to explain things like your glibc problem, musl, and NimScript in a way that someone with very little knowledge could still follow.
I appreciate that comment. Thanks. This is the first time I spent some time in figuring out how to deploy binaries and also optimize them. So I write these posts to also serve as reference notes for my future self :)
Something I might add is a one-sentence summary of what UPX does.
Done! See the footnotes references added for upx and strip in that section.
PS: Here's Gitlab's CI tool: https://about.gitlab.com/features/gitlab-ci-cd/
I am aware of the Gitlab CI tool, but only for Gitlab Pages deployment and such. It's not clear if and how Release Assets can be auto-uploaded to Gitlab as I do for GitHub for the template project hello_musl.
-
Comment on Nim: A Programming Language Underdog in ~comp
kaushalmodi (edited )LinkWhile replying to a comment by @Jidairo, I'm also making this a top level comment for more visibility. Why I like the Nim language I started using Nim a few months back. I actually wanted to start...While replying to a comment by @Jidairo, I'm also making this a top level comment for more visibility.
Why I like the Nim language
I started using Nim a few months back. I actually wanted to start using it about two years 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, and starting collecting my notes on it.
Here's why I think Nim is an awesome language:
-
Syntax: It's beautiful. If you like Python syntax, you'll like this. In fact, it's much more concise, but not at the cost of readability.
-
Static type check, with a sprinkle of type inference (only when assigning the initial value).
-
Proc/operator overloading: Have procedures (functions) with the exact same identifiers handle different data types in their own way.. and the same with operators.
-
Generics: You can use generics in procs, iterators, etc.
-
Cross Platform: While I don't use Windows or macOS, I have known Nim applications to compile on those OSes too, in addition to GNU/Linux type OSes plus a few more like Raspberry Pi and types.
-
.so
object export: Nim can compile the code to binaries, but they can be compiled to just libraries (.so objects) too. Here's my experiment on how I write code in Nim to talk to Emacs (v25.1+) via the Emacs Module support. That allows me to run Nim-written code from Emacs Lisp (and even executing Emacs Lisp code from Nim). How awesome is that‽ -
Support: Great support over Gitter, GitHub issues, Nim Forum, etc. Great devs! (though, I incorrectly thought earlier that that wasn't the case :))
-
Makes me feel at 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 (look at the source, hack it, tweak it, submit PR).
-
Editor support: The
nim-mode
Emacs major mode andob-nim
Org Babel package are awesome! -
Documentation: Check out the Nim
the index.html
to search anything. There are also Devdocs for Nim. -
Whitespace: Tab not allowed, yay! (I know that many folks don't like that.)
-
Package distribution: 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.).
As for my use case, I use Nim as Python/Bash replacement, CLI utility development, and it looks excellent so far!
In plain terms, coding in Nim is pure joy :)
-
-
Comment on Nim: A Programming Language Underdog in ~comp
kaushalmodi I didn't know Dr. Conrad Barski (of Land of Lisp fame) had this comic book for Emacs Lisp! Thanks for linking it. Skimming through it, I think that it's not designed to serve as Emacs Lisp 101. I...I didn't know Dr. Conrad Barski (of Land of Lisp fame) had this comic book for Emacs Lisp! Thanks for linking it.
Skimming through it, I think that it's not designed to serve as Emacs Lisp 101. I think that the jump from here to here is too big for someone completely new to Emacs Lisp or Lisp in general.
Based on my brief skimming through that site, I think that someone already with mild introduction to a Lisp dialect will surely enjoy it (I plan to through it in entirely this week).
PS: The website is not very responsive (doesn't look good on mobile devices).. I wonder if I can convert that to a responsive version using Org mode + Hugo and ping the author about it..
-
Comment on Nim: A Programming Language Underdog in ~comp
kaushalmodi I couldn't agree more! It looks like the people don't understand or want to understand the real language features, and so gang up on trivial things like tabs and spaces. Just accept that TABs are...I couldn't agree more! It looks like the people don't understand or want to understand the real language features, and so gang up on trivial things like tabs and spaces.
Just accept that TABs are illegal characters in Nim and don't use them, or configure your editor to replace those, and move along.
-
Comment on Nim: A Programming Language Underdog in ~comp
kaushalmodi This is a really good reference to help kickstart learning Elisp, as you don't need to devote too much time to finish it.. may be ½ hour or may be 1 (or something around that). Learn X in Y...This is a really good reference to help kickstart learning Elisp, as you don't need to devote too much time to finish it.. may be ½ hour or may be 1 (or something around that).
Learn X in Y minutes - Emacs Lisp
And then just keep on tinkering with your Emacs config, study published Emacs packages, passively follow Emacs help mailing list, (and/or the /r/Emacs subreddit, emacs.stackexchange.com).
-
Comment on Nim: Deploying static binaries in ~comp
kaushalmodi Deploying Nim applications as static binaries for GNU/Linux type operating systems, built using musl. The deployment happens automatically using Travis CI on GitHub repos. The post goes into...Deploying Nim applications as static binaries for GNU/Linux type operating systems, built using musl. The deployment happens automatically using Travis CI on GitHub repos.
The post goes into complete detail on how to do the build and how to deploy with all the required code and a template git repo.
-
Nim: Deploying static binaries
8 votes -
Comment on Nim: A Programming Language Underdog in ~comp
kaushalmodi (edited )Link ParentThis is Nim; it is a statically typed compiled language. It's hard to imagine that you could arbitrarily move a block to any indentation and still have the code even compile. So much +1 this. I...Many times when working with Python I've had very hard to find bugs that blocked me for hours caused by moving a code into the wrong indentation level
This is Nim; it is a statically typed compiled language. It's hard to imagine that you could arbitrarily move a block to any indentation and still have the code even compile.
My favourite language is Emacs Lisp, and Lisp in general, because they just have the perfect syntax, and having something like Paredit means that you almost never fail when moving bits of code around. Sexps are just easy and good, I don't understand why more languages use them.
So much +1 this. I love Emacs Lisp too, and I never get the "fear of parentheses". But if you put the indentation vs lisp preference aside, this language is worth exploring.
They are better even when just used as syntax like braces and w/o homoiconicity. If not, just have C braces. They make the life easier.
This is another polarizing preference (first one that I referred to another comment is this thread is tabs vs spaces). I like Lisp because all the closing parens pack up the end of the last form.
With C/Perl type parens, the code becomes too ugly (IMO) too quickly as everyone has a different style of where to put the parens and they are not so good. With indentation-based blocks, Python solved this major problem, and I am glad Nim took it up.
Another reason why I love Nim is the composability that I enjoy so much in Emacs Lisp.
Here's an example (in Nim):
let idxString = if withIndex: fmt"{idx:>4}. " else: " "
Looks a bit familiar? (see psuedo equivalent version of this below, in Emacs Lisp) :)
(let ((idxString (if withIndex (fmt"{idx:>4}. ") " "))) ;; use idxString )
-
Comment on Nim: A Programming Language Underdog in ~comp
kaushalmodi I find that amusing.. how would you know that everyone follows an unenforced style guide? :) I agree with @SleepyGary that once you have the compiler through an error, you need to straighten up...For example Crystal (another fairly new language) has a style guide that everyone follows.
I find that amusing.. how would you know that everyone follows an unenforced style guide? :)
I agree with @SleepyGary that once you have the compiler through an error, you need to straighten up your editor config or whatever to prevent that error in future. I have yet to see that Nim compiler error because of tab chars :)
-
Comment on Nim: A Programming Language Underdog in ~comp
kaushalmodi This awesome, though polarizing, decision by the Nim team is one of the cherry on the top Nim features why I love it. Consistency + sanity. I have been through countless files (an example) where...just making spaces the recommended indentation style, they have made it a syntax error to indent with tabs, which is absolutely ridiculous.
This awesome, though polarizing, decision by the Nim team is one of the cherry on the top Nim features why I love it.
While this is a relatively minor issue I can't stand to use a project that thinks their stylistic choice is the only correct option
Consistency + sanity. I have been through countless files (an example) where colleagues using tabs (mostly unknowingly) make reading code a horrible experience.
Spaces are nice.. a space will always a space char wide whether or not the colleagues understand tabs vs spaces.
(We can go back and forth on this forever.. tabs vs spaces is one of the eternal wars.)
don't force people to use spaces. Your stylistic choices are just stylistic choices.
If someone can get past this as an "issue", they might discover the beauty of this language.
-
Nim: A Programming Language Underdog
19 votes -
Comment on Syntax highlighting for the coders, invites for everyone in ~tildes.official
kaushalmodi (edited )Link ParentDon't details and summary work? Testing .. This is summary. Click to expand. Here are more details. Update: Nope, it doesn't, sorry for that useless comment notification. Update 2: There's an...This comment contains CSS known to the State of Tildestia to cause frustration due to being a wall of text. Collapse this comment and consult a physician.
Don't details and summary work?
Testing ..
This is summary. Click to expand.
Here are more details.
Update: Nope, it doesn't, sorry for that useless comment notification.
Update 2: There's an issue tracking support for
details
/summary
. If anyone is interested, please vote it! -
Comment on Syntax highlighting for the coders, invites for everyone in ~tildes.official
kaushalmodi Awesome! That's a Firefox (which is my default browser too) add-on too. I haven't ever used this add-on; will have a look. Thanks!Awesome! That's a Firefox (which is my default browser too) add-on too. I haven't ever used this add-on; will have a look. Thanks!
-
Comment on Syntax highlighting for the coders, invites for everyone in ~tildes.official
kaushalmodi [text](http://url) **bold!** I wonder what happens if... ```md Meta ``` I wrote the above using: ````md [text](http://url) **bold!** I wonder what happens if... ```md Meta ``` ````[text](http://url) **bold!** I wonder what happens if... ```md Meta ```
I wrote the above using:
````md [text](http://url) **bold!** I wonder what happens if... ```md Meta ``` ````
-
Comment on Syntax highlighting for the coders, invites for everyone in ~tildes.official
kaushalmodi (edited )LinkAs an aside, can the font family not be enforced for code blocks? This is the current CSS, which sets the font to not-so-pretty Courier on my machine: code, kbd, pre, samp { font-family: "SF...As an aside, can the font family not be enforced for code blocks?
This is the current CSS, which sets the font to not-so-pretty Courier on my machine:
code, kbd, pre, samp { font-family: "SF Mono", "Segoe UI Mono", "Roboto Mono", Menlo, Courier, monospace; font-size: 1em; }
How about setting just
font-family: monospace;
. Then I can see the code blocks in my browser-default monospace font (Iosevka rocks!). -
Comment on Syntax highlighting for the coders, invites for everyone in ~tildes.official
kaushalmodi (edited )LinkYay! import re proc word_count(str: string, re: Regex): int = ## Count the number of ``re`` regular expression matches in ``str``. echo str.findAll(re) return len(str.findAll(re)) echo...Yay!
import re proc word_count(str: string, re: Regex): int = ## Count the number of ``re`` regular expression matches in ``str``. echo str.findAll(re) return len(str.findAll(re)) echo word_count("Works for Nim too!", re"Nim") # 1 echo word_count("Works for Nim too!", re"o") # 4
Update: Well, it's a bit shabby for Nim, but not too bad.
-
Comment on What are some of your favorite RSS feeds to subscribe to? in ~tech
kaushalmodi I use https://www.newsblur.com/. It works great on web and Android (and I believe, iOS too).I use https://www.newsblur.com/. It works great on web and Android (and I believe, iOS too).
I use a paid service https://pinboard.in/.
I cannot recommend it enough!
By using it, I am not tied to a particular browser. My default browser is Firefox, and there's a good Pinboard Webextension add-on available for Firefox.
It has a great search, ability to add custom searchable notes to bookmarks, and API too (so there are few Emacs packages for Pinboard too :)).
Update: Oops, @calcifer already posted about this. Turns out, I had started writing this about an hour back, something came up, and then I just submitted this comment.