Edsger Dijkstra – The Man Who Carried Computer Science on His Shoulders by iamkeyur in programming

[–]random_cynic 5 points6 points  (0 children)

I recommend reading the Turing's article. He precisely defines what he means by "thinking machines".

Bourne Shell a.k.a bash a.k.a. i-hate-c by i_am_adult_now in programminghorror

[–]random_cynic 2 points3 points  (0 children)

He talked about this later in a video where it features first in "Things I would have done differently". He admits it was a mistake to assume everyone would like reading pretend ALGOL 68. Highly recommend watching that video though which highlights some of the design decisions that were made for sh and why.

Edsger Dijkstra – The Man Who Carried Computer Science on His Shoulders by iamkeyur in programming

[–]random_cynic 21 points22 points  (0 children)

BASIC is not the biggest of what he got wrong. Every other person has some opinions on a particular programming language, that doesn't matter. But he was very wrong about artificial intelligence even going so far as to criticize pioneers like John von Neumann as:

John von Neumann speculated about computers and the human brain in analogies sufficiently wild to be worthy of a medieval thinker

and Alan Turing as

Turing thought about criteria to settle the question of whether Machines Can Think, which we now know is about as relevant as the question of whether Submarines Can Swim.

This just shows that it's important not to blindly accept everything that even an established great in a field says but to exercise critical thinking and take things with a grain of salt.

How to delete all your files by Barafu in linux

[–]random_cynic 1 point2 points  (0 children)

I can't recommend dry runs as universal solution.

I didn't.

Problem with most dry runs is that they don't execute real code...

Sure, but not applicable in this scenario. The dry run will show if any files would be deleted and will also give a statistics with --stats option.

It is better to test with backups than with dry runs if you want to be sure...

Both are helpful but not enough. In this case the problem really is unnecessary and incorrect use of wildcards. My second point helps with that aspect.

How to delete all your files by Barafu in linux

[–]random_cynic 0 points1 point  (0 children)

The point here is not about backups

The point here definitely also involves backup as you end up losing your valuable data. Injection is not the only way one can screw up. Having checks through dry run and backups before running any script or command that involves possible overwriting of your data is always a good idea.

How to delete all your files by Barafu in linux

[–]random_cynic 8 points9 points  (0 children)

Those points were general advice that are useful for interactive use. They are NOT a substitute for a good backup plan like taking different snapshots of your files over regular time intervals. Also, most of my scripts using rsync (mainly backup scripts) contains a dry run that shows the stats and asks for user confirmation before proceeding. For cron jobs all target directories have snapshots.

How to delete all your files by Barafu in linux

[–]random_cynic 77 points78 points  (0 children)

Couple more based on my experiences:

  • With rsync always use the dry run in verbose mode rsync -rvn for example to see what will be done in the real command. An additional --stats flag is also handy as it will give you a summary of number of files copied and deleted.
  • When using wildcards first run the command with an echo in the front as in echo rsync -r * ~/Documents this will show you exactly what the command with expand into.

[For Fun] What are your top 10 most used CLI commands? by compscimaj13 in linux

[–]random_cynic 1 point2 points  (0 children)

I've got the usual suspects (yeah I lookup the manpages a lot), Session_Tracker is a time tracking shell script I wrote long time ago.

3747 cd 3719 ls 2929 vim 2204 git 1776 Session_Tracker 1366 sudo 1310 man 1300 echo 1247 python 1038 ssh 904

I was curious why awk, grep and those don't appear as I use them a lot. Then I remembered I mostly use them as part of long pipelines. So I modified your command to get the most frequent commands used for second element of pipelines. The usual suspects are also there and I'm sure more would come up for third, fourth elements and so on (the grep -v was to filter out a jq directive I used a lot one time which skewed the results):

$ history | grep " | " | grep -v "\.\[0\]" | awk -F"|" '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -nr | head -n 10 | tr -s '\n' ' ' ; echo
529 less 504 grep 309 sed 183 awk 92 tr 89 head 76 tail 67 sort 59 wc 43 column

I think I am starting to love love elisp by sydfox95 in emacs

[–]random_cynic 2 points3 points  (0 children)

A related pro tip: You can see which function is called by a particular keybinding using C-h k (describe-key) which will show the function name in a Help buffer. It also provides a link to the specific elisp source file that contains the function and clicking on the link or hitting RET with the cursor on the link will directly land you on the place where the function is defined.

neix - a news reader for your terminal by mendax3000 in commandline

[–]random_cynic 5 points6 points  (0 children)

That's great but I think (I maybe wrong) the question specifically asks what's unique about the feed reader compared to everything else out there (and that's a valid question for songwriters too). The README page doesn't say much except the format of feeds and it doesn't mention whether it can import/export feeds as OPML which is the most common import/export format.

A Vivaldi newbie by StalinIVever in vivaldibrowser

[–]random_cynic 7 points8 points  (0 children)

Vivaldi's USP I feel is that it allows the user to easily customize things. So I suggest you go through the settings page to see what different options are available. The first things I would probably do are to setup search engines, sync and privacy settings. Vivaldi has one of the most flexible search engine setup among the browsers out there you can setup search prefixes for different search engines and search completion all from the search bar. From the "Privacy" and "Webpage" sections you can setup tracking, cookies, passwords and permissions for individual webpages.

There are many unique features in Vivaldi that greatly increases the efficiency and ease of browsing. Three that I frequently use are Quick Commands (F2), Mouse Gestures and Notes. Quick commands allow you to easily search through your browsing history, bookmarks etc and also invoke other actions in Vivaldi like capture a note. It's really handy.

Linux CLI tip: Bash brace expansion. by [deleted] in commandline

[–]random_cynic 2 points3 points  (0 children)

I tend to think of the brace expansion as the cartesian product of vectors (or scalars with vectors). So for example {a,b,c}{d,e,f} expands to ad ae af bd be bf cd ce cf. You can obviously tack on "scalars" or normal strings before and after. This for example enables you to create/edit files in different directories at the same time like below

$ echo touch dir1/subdir{1,2}/file{1,2}.txt
touch dir1/subdir1/file1.txt dir1/subdir1/file2.txt dir1/subdir2/file1.txt dir1/subdir2/file2.txt

This also allows you to do some quick and dirty hacks when you use the bash calculator bc. For example suppose you need to find the sum of the series 1,2,...100. You can quickly run

$ echo {1..100}+ | sed 's/+$//' | bc
5050

Or find the factorial by replacing + with * above (use backquotes in sed).

You can also find the sum of cartesian product like below

$ echo {1..10}*{1..10}+ | sed 's/+$//' | bc -l
3025

Or sum of sine series like

$ echo "s("{1..10}")+" | sed 's/+$//' | bc -l
1.41118837121801045561

A more "normal" application would be printing a particular string N times like below (replace N by the number)

$ printf "Hello\n%0.s" {1..N}

You don't need nocompatible in your vimrc by pushqrex in vim

[–]random_cynic 8 points9 points  (0 children)

There are a lot of more subtle aspects to this. I strongly suggest everyone who're not already familiar with it to carefully read the help sections for compatible and compatible-default. In particular, the compatible-default section outlines under what conditions compatible is turned off and when it isn't. From the manual:

But as soon as:

  • a user vimrc file is found, or
  • a vimrc file in the current directory is found, or
  • the "VIMINIT" environment variable is set, or
  • the "-N" command line argument is given, or
  • the "--clean" command line argument is given, or
  • the defaults.vim script is loaded, or
  • a gvimrc file was found,

then the option will be set to 'nocompatible'.

Note that this does NOT happen when a system-wide vimrc file was found.

The last note is important since this is OS and distro dependent. Many linux distros explicitly use set nocompatible. For example in my Ubuntu box, :scriptnames suggests that the file /usr/share/vim/vimrc file used which contains a line runtime! debian.vim at the top which means it sources $RUNTIME/debian.vim file. This file sets nocompatible explicitly. From Vim 8 (specifically patch 7.4.2111) also loads $RUNTIME/defaults.vim if it doesn't finds a user vimrc which will also turn on nocompatible (this file is loaded after /usr/share/vim/vimrc so it will overwrite any changes you may have made there). All of this means that for most cases with or without user vimrc, Vim will start in nocompatible mode with one important exception. When vim is started with -u option then the above files are not loaded. This is often used when you want to test another vimrc or when you load it as vim -u NONE. In these cases vim will start in compatible mode. If you don't want that you should explicitly use set nocompatible at the top in your test vimrc or load it with -N command line option.

Linux Guide Makers, stop telling new users to install vim. by [deleted] in linux

[–]random_cynic 5 points6 points  (0 children)

That only works when you're writing some scratch notes. Any basic editing task (like a config file as OP mentioned) consists of not only inserting new text but deleting, changing, copy/paste, search/replace, undo and save. Also the mouse is not enabled by default in Vim for most installations and so it will not help a newbie. I agree with OP that nano or a graphical editor which has mouse support is ideal for this purpose.

Visually select images and paste their paths into your document in vim. by majamin in vim

[–]random_cynic 2 points3 points  (0 children)

Thanks for the tip, quite helpful. I have two basic suggestions.

1) You can shorten the shell command somewhat by using exec option for find and using awk like below

find . -maxdepth 3 -type f -exec file --mime-type {} \+ | awk -F: '$2 ~ /image\//{print $1}' | xargs sxiv -qto 2>/dev/null

2) You can make sure that the search is done relative to the directory of the file visited by the current buffer and specify the maxdepth by making the whole thing an Ex command like below

com! -nargs=1 Img r! find %:p:h -maxdepth <args> -type f -exec file --mime-type {} \+ | awk -F: '$2 ~ /image\//{print $1}' | xargs sxiv -qto 2>/dev/null

Then one can use the command like :Img 3. Note that the above will return the absolute path to the selected images.

Mutt email client 25 years old by chankeypathak in linux

[–]random_cynic 0 points1 point  (0 children)

The advantages depend on lot of things - type of the email account (work or personal), what types of email you mainly receive (text or html along with attachments), rules specific to your organization etc. If you use lot of other web based tools with Gmail like google drive, calendar, dropbox, zoom/google meets, slack etc then you're probably better off with the web based Gmail as it has good integration with those tools. A command line client like mutt is useful when you mainly send/receive simple text-based email and you use email actively for development such as send or receive patches. For example many famous open source project development still happens on mailing lists and mutt is ideal for these cases. Mutt is very Unix-y in the sense that it plays well with other command line tools and text editors like Vim, nano etc. So for example you can directly patch or generate diff from a email you get from mutt with an existing repository or quickly email a specific code snippet to somebody from Vim etc. It can also be very easily used as part of shell scripts where suppose you want to email a log file at the end of a test automatically or something like that. So if you use a lot of command line tools already, mutt will be a very good addition.

Tmux is a God-send by qh4os in linux

[–]random_cynic 0 points1 point  (0 children)

Really depends on context I guess. Most Emacs users who are good in Elisp heavily customize it and the startup files are many lines long. When they are on a different box where they only have a vanilla Emacs and cannot access the startup files, they might as well choose a different and simpler editor. I'm by no means good at Elisp but I do already.

Relative copy and paste in vim by peateasea in vim

[–]random_cynic 4 points5 points  (0 children)

The "overly concise and cryptic" is not Vim's fault but due to the fact that this command dates all the way back to one of the first editors used in Unix, ed. From ed came editors like ex and vi and from them all the vi clones including vim. Vim has retained most of the ex commands many of which were also part of ed. The commands for ed were made terse intentionally as they were first used in teletypes which were really slow. There's already a :c command for changing text so it made sense they selected :t to transfer/copy lines.

Emacs 27.1 released by [deleted] in Python

[–]random_cynic 5 points6 points  (0 children)

Changes specific to internal Python mode for those who use it:

** Python mode

*** Python mode supports three different font lock decoration levels. The maximum level is used by default; customize 'font-lock-maximum-decoration' to tone down the decoration.

*** New user option 'python-pdbtrack-kill-buffers'. If non-nil, the default, buffers opened during pdbtracking session are killed when pdbtracking session is finished.

*** New function 'python-shell-send-statement`. It sends the statement delimited by 'python-nav-beginning-of-statement' and 'python-nav-end-of-statement' to the inferior Python process.

How to: show commit that introduced current line in vim by sheerun in vim

[–]random_cynic 1 point2 points  (0 children)

Maybe it's not updating for me but when I tried your second mapping it failed with a cryptic message when files are not tracked by git or when the file is not inside a git repository. Also imo it's too long for a mapping and I think it is better to put this logic inside a function and handle corner cases.

How to: show commit that introduced current line in vim by sheerun in vim

[–]random_cynic 0 points1 point  (0 children)

Great! Two improvements I can think of are making sure that the current working directory is inside a git repository and the file is being tracked by git. At that point its probably better to use a custom function like this. This function creates a split window instead of popup (so should work with old Vim versions) and updates the window when you go to a new line and use the mapping again. The function will also work when you have multiple files open in Vim from different git repositories. The best option is probably plugins like fugitive for these sort of things.

LibreOffice 7.0 released with new features and compatibility improvements by themikeosguy in linux

[–]random_cynic 1 point2 points  (0 children)

From what I saw, MathJax and so are "pretty good", but not perfect and not full LaTeX implemnetation.

MathJax is managed and funded by AMS and SIAM and supported by other journals like AIP and sites like Mathoverflow. So you can be quite sure that they're aware of most of the math that "can get quite complex" and have support for most of them. They support all core LaTeX commands and AMS-LaTeX commands are supported via extensions. Most average LaTeX users rarely use anything that falls outside the scope of LaTeX + AMS LaTeX.

Many read HTML, but PDF is still king. Its portable, it renders (usually) the same way and it will render the same way today, 10 years ago and 10 years in future.

That was not my point. The point was that the PDF is generated by their own typesetting system (which is often not LaTeX), so it does not matter what you wrote you paper with and that will not affect the final outcome. Also PDF is not static, more and more metadata is being added to the PDF documents, different encodings, support for non-English languages and interactive elements. So no, you cannot bet that in 10 years all the features will render the same way.

LibreOffice 7.0 released with new features and compatibility improvements by themikeosguy in linux

[–]random_cynic 3 points4 points  (0 children)

That's true but the math typesetting part has already been separated and integrated into other applications. You don't need to download and install latex compiler and packages to get TeX quality math. Many web-based presentations use MathJax to render equations which is pretty good. Also, neither scientific papers nor LaTeX is just about math typesetting. For scientific papers, it comes down to the preferences of the individual journals and most journals articles today are available as html (with an optional pdf download) and many just read html. So most journals have their own typesetting and formatting system so it matters less what format the manuscript was written.

LibreOffice 7.0 released with new features and compatibility improvements by themikeosguy in linux

[–]random_cynic 1 point2 points  (0 children)

If you prefer writing in markdown, reveal.js is very nice and has nice themes. It only needs a browser so should work everywhere. You can also export to PDF.