I had a need to get the last Friday of each month of 2025.
- This can be changed to get any other last day by changing the wday variable.
- su, mo, tu, we, th, fr, sa
let wday = 'fr'
let year = 2025
cal -m -t --week-start $wday --full-year $year |I had a need to add a percentage, in this case 35%, to a list of numbers. This nushell code allows this to be done in three lines of code.
[50 55 60 65 70 75 80 85 90 95] | each { |it|
let multiplied = ($it * 1.35);
{ amount: $it, multiplied: $multiplied, addamt: ($multiplied - $it) }
}In Windows, I have programs that have the updates managed a number of ways. I don't like to have programs auto update.
For this last 15 years I have always had a calculator open and running in my Windows PC.
I used the calculate to quicky calculate percentages, multiply rates.
I also use the calculatr for just a quick note (I know not really the purpose for a calculator).1
This was from Nushell's Discord channel, on 2025/08/10, in the help chat.
@Bahex @timtimtim
I have some file sizes in a table like this [ {size: 12B} {size: 34B} {size: 56B} ]. How can I add a column to this table of the "accumulated" size as we iterate through the records? In this instance, it'd be additional fields (say accumulated) with values [ {accumulated: 12B} {accumulated: 46B} {accumulated: 102B} ], where 46 = 12 + 34, and 102 = 12 + 34 + 56. I'm trying to do this without a global counter variable if possible. (If the only reasonable solution is a counter variable, then I'd know how to do that)
Using the unixdict.txt file, get the vowels, consonants, and word length of each word.
open unixdict.txt
| lines
| filter {|w| ($w | str length) > 3 }
| filter {|w| not ($w in [
a e i o u i a an and are as at be
by for from how in is it of on orGet a list of US states that have have more vowels than consonants
[
"Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut",
"Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa",
"Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan",I have a table of Software purchased and / or donated to free software. I found I had a record that should have a type of Free instead of Paid.
open software.tsv |
update Type { |row| if $row.Company =~ "Eric" { "Free" } else { $row.Type } }|
save -f software.tmp.tsv; mv -f software.tmp.tsv software.tsv