Threads for MatheusRich

  1. 3

    To each their own. I personally hated having songs with no artist/album/etc when I did this before moving to a steaming platform a couple of years ago.

    1. 1

      I’ve been wanting a script to just Shazam (or similar) a bunch of metadata-less music files and write in appropriate metadata. Might be tricky.

      1. 13

        MusicBrainz Picard works pretty well in my experience. It can work with acoustic fingerprints, but almost always it is smart enough to find the right data just by looking at folders, filenames, grouping of files, etc.

        1. 1

          Winamp used to have this feature. Winamp is dead now. Shazam has a public API though, might be achievable.

      1. 3

        I often struggle to understand why people don’t let others like what they want to.

        1. 1

          I’ve been putting off learning Rust macros because they feel too hard. Compare that to Crystal macros for example.

          1. 1

            Rust’s declarative macros (macro_rules) seem pretty similar. They’re a bit more verbose, sure, and a little harder to read maybe. But fundamentally similar in that they’re declarative.

            Procedural macros, where you write arbitrary code to produce an AST from an AST, are definitely more difficult—but also more powerful.

            1. 1

              proc macros are token -> token conversions instead of AST -> AST conversions, it’s one of the reasons you need quote/syn for most macro crates. The rfc explains the reasoning here, the big one being so changes to the AST don’t break procedural macros.

          1. 7

            Welcome to lobsters! Generally we suggest that new people submit articles by other people, and comment on other people’s posts, so as not to be mistaken for spammers.

            1. 3

              Got it! Thanks for letting me know.

            1. 23

              I love those kinds of programs! I create aliases and small shell functions all the time in this style. One of my favorites is a puts function that basically evals in Ruby what I type. I often use it to do maths and date calculations. I know you can do this in shell, but I do so much Ruby that it is like a second language (third, after English?) for me.

              function puts() {
                ruby -r date -e "puts($*)"
              }
              
              $ puts Date.today + 10 # What day is ten days from now?
              2022-03-19
              
              $ puts "10 ** 3 / 9.0"
              111.11111111111111
              
              1. 3

                Very cool ! I always do this by opening a Python shell, but never thought about making a shortcut: thanks :D

                1. 2

                  I just open devtools in the browser, or maybe aa node repl instead, to each their own :)

                  One of my first utilities that I wrote was a dice, we wanted to play GURPS but didn’t have dice so I wrote one quickly. Back in the nineties there were no cellphones. I’ve written such things before and after but this one i always remember.

                2. 2

                  Why did you call it puts?

                  1. 7

                    To follow the name of Ruby’s method to print to output. You can even see me calling it in the code puts($*).

                    Also, it not only evals the code, but prints its result.

                  2. 1

                    I have a similar one:

                    $ datedate
                    Thursday 2022-03-10 13:09:58 Europe/Stockholm 2022
                    2022-03-10T13:09:58+01:00
                    1646914198
                    
                    $ datedate +22 days -1month
                    Friday 2022-03-04 13:10:02 Europe/Stockholm 2022
                    2022-03-04T13:10:02+01:00
                    1646395802
                    
                    $ datedate 1646395802 
                    Friday 2022-03-04 13:10:02 Europe/Stockholm 2022
                    2022-03-04T13:10:02+01:00
                    

                    but since I haven’t found anything as good as php’s strtotime(), it remains the only script that forces me to install php :( Source here: https://github.com/chelmertz/dotfiles/blob/master/bin/datedate

                    1. 3

                      A coworker of mine created something like this in Rust:

                      $ date-math 'dec 30, 2021 + 2 weeks + 1 day'
                      2022-01-14
                      
                      1. 10

                        Note that GNU date can do this built-in:

                        % date -d 'dec 30, 2021 + 2 weeks + 1 day'
                        Fri Jan 14 00:00:00 CET 2022
                        
                        1. 1

                          This has made my Friday.

                      2. 1

                        Maybe https://github.com/hroptatyr/dateutils do the same job without PHP?

                      3. 1

                        My aliases

                        alias rm="rm -i"
                        alias cdtemp="cd $(mktemp -d)"
                        alias pb="curl -F\"file=@-;\" https://envs.sh"
                        

                        Favorite one is cdtemp, great for quickly testing out stuff.

                      1. 1

                        I think I’m missing something. Is English your native language, or Portuguese? Some things in the post aren’t connecting up for me.

                        1. 1

                          Portuguese is my first language.

                          1. 3

                            Sorry, I guess I’m still confused then. For you to work in your native language requires empathy… on your part? Someone else’s?

                            The best I could figure is that you were looking to ask people to be empathetic to people who are speaking their non-native language, but that’s not what the title said, so I’m a bit lost.

                            1. 1

                              The article is directed towards native-English speakers, so My native language == your non-native. I understand the confusion, tho.

                              Regarding empathy, I think both sides have to be empathic. Working in a second language can be exhausting, and people often feel like they’re less valued, less intelligent or treated differently for speaking “bad English”, so I’m making a case to say that you (non-native speaker) are not alone, and it’s okay to make mistakes. For native speakers, on the other hand, I ask for empathy because you’re an expert on your language, so your very presence can be intimidating to others. Using simpler language, for example, is a way to help foreigners.

                              1. 4

                                I’m all for using simpler language, not just for helping people who are less fluent in a language, but also to reduce the cognitive overhead required to understand what is being said. I’m not a native English speaker either (I’m Dutch), but oftentimes I get annoyed by the horrible ways people use English (even native speakers).

                                For me, I approach it a bit like a programming language. It’s always good to have empathy towards your fellow developer (they might be tired, overworked or just new to the language), and if people are continually making mistakes it doesn’t make sense to chew them out, because it’s clear they’re at a language level below full mastery. But I still kind of expect a professional who has been in this business for several years to have mastered both English and the programming language at hand.

                                1. 4

                                  I’m all for using simpler language, not just for helping people who are less fluent in a language, but also to reduce the cognitive overhead required to understand what is being said

                                  Simpler doesn’t always help. A lot of the complicated words in English are lifted directly from French or Italian and so might be more familiar to a native speaker of another romance language than the more common English terms (I recall a French friend had a habit of just putting French words in his PhD thesis and anglicising the word ending. It worked 90% of the time and was very confusing the few times when it didn’t).

                                  I once tried playing Balderdash with a group of Italian friends and it was no fun at all. You’re presented with an obscure English word and you’re all supposed to make up plausible definitions. You get one point for every person who believes that your definition is the right one. If you write the correct definition then yours is excluded from the ones people guess and you just get two points. Every round, all of them would write the correct definition because the obscure English words were everyday Italian ones.

                                  Even for native speakers, there are a lot of weird dialect variations, especially where one has dropped a word from a common phrase. For example, American dropped the ‘to’ from phrases such as ‘one through to five’ and just says ‘one through five’, which sounds to an English speaker like a sequence that starts at one, continues through five, and then probably stops somewhere later, but to an American means something that stops at five. In contrast, after people in England stoped wearing pantaloons, they stopped using the abbreviation ‘pants’ and so dropped the ‘under’ prefix from ‘underpants’. Americans kept the word ‘pants’ as a synonym for ‘trousers’ and so cause hilarity to English speakers (we’re easily entertained) whenever they refer to their pants. Pants is definitely a simpler word than ‘trousers’, but saying it increases the cognitive load for folks outside of the US, who first have to (by law in the UK) smirk, and then mentally translate.

                                  1. 3

                                    My experience as an English person is that native English speakers are often worse at speaking our own language than non-native speakers. Working with non-native speakers for my entire career has actually helped me realise where native speakers get lazy in their use of language, or use idioms that don’t translate well (or at all) - sometimes even across different variations of “native English” such as English vs Scottish vs American.

                                    1. 4

                                      I’m very used to Scandinavians going “sorry, I’m not a native speaker” and delivering perfect English. (Well, it’s perfect until it isn’t - sometimes you can get very interesting mispronunciations.

                                  2. 2

                                    The article is directed towards native-English speakers, so My native language == your non-native. I understand the confusion, tho.

                                    Ahhh, I think I see now. Thanks.

                            1. 12

                              Ruby changed my mind about so many things - importance of type safety, importance of aesthetics, OO & controlled mutation.

                              Its something I recommend anyone give a serious go. Don’t read a bunch of books, just make a small fun project. Don’t try to make it FP, you will feel when you pulling against the language instead of embracing it. Its the first language I used that doesn’t feel like it has an agenda (in a good way) other than to just be a pleasure to use.

                              EDIT: Important aside that I find people making common issue with, ruby is much more than rails. Try a project that is just plain ruby. I personally really fell in love with ruby when I started writing my language in it.

                              1. 5

                                +1 to that! I love using Ruby outside web development. Creating small scripts and CLIs with Ruby is :chef-kiss:

                                1. 3

                                  Don’t try to make it FP, you will feel when you pulling against the language instead of embracing it

                                  Hard disagree, what I love about Ruby is that it blends OOP and FP approaches together.

                                  1. 1

                                    upvoted… my ruby is very FP and that’s how i likes it

                                    the ruby style guide that a big portion of linters is based on and more or less considered a standard across most of the industry encourages you to write in a functional style

                                    when i’m writing ruby i make it my mission to do it, it rarely is a problem unless i come across a method or gem someone wrote that was meant to be non functional

                                  2. 1

                                    I came at it from a different angle…

                                    I had extensively used Perl and a SmallTalk derivative..

                                    Meeting Ruby felt like coming home to something better than both.

                                    Although I’ll admit my Ruby code has changed over the years becoming far far more FP like and less perl like.

                                    1. 1

                                      Yes, indeed, “just plain Ruby” is both a joy and a pleasure! But with great power comes great responsibility yada yada…

                                    1. 1

                                      Pretty similar to what Rubocop does in Ruby.