Skip to content

Instantly share code, notes, and snippets.

@paul-d-ray
paul-d-ray / Nushell_Loop_Folder_from_Variable.md
Created January 23, 2026 22:06
Nushell Loop thru folders in a variable

$nu variable

From the Help file about $NU

This is from Nushell 0.110.0 $nu The $nu constant is a record containing several useful values:

  • default-config-dir: The directory where the configuration files are stored and read.
  • config-path: The path of the main Nushell config file, normally config.nu in the config directory.
  • env-path: The optional environment config file, normally env.nu in the config directory.
  • history-path: The text or SQLite file storing the command history.
  • loginshell-path: The optional config file which runs for login shells, normally login.nu in the config directory.
@paul-d-ray
paul-d-ray / Polars_Xan_Sum_Filter.md
Last active January 12, 2026 18:57
Using Nushell and Polars vs Xan to filter, sum

Determine how much was spent on Groceries

I exported the data from MS Money, for all years (2010 + 2025) the details on Grocies.

I wanted to see how to sum the data by year for one grocey store.

I had done this in Visidata, and I knew both Nushell with the Polars plugin and Xan could do it, so I decided how to get the syntax correct in both.

This is a very small dataset, only 1054 records.

@paul-d-ray
paul-d-ray / Cable_Modems_Routers.md
Last active January 4, 2026 14:58
Cable Modems and Routers

Cable Modems

Motorola SB6120

This was in use from 2011/02 to 2019/10,

@paul-d-ray
paul-d-ray / Nushell_Sine_Wave.md
Last active December 30, 2025 20:38
Nushell Sine Wave

Sine Wave using Nushell

Sine Wave

# Sine wave ASCII plot in NuShell with color using match (correct syntax for guards)
# written by Grok with some manual syntax corrections and changing the colors to use nushell colors

 const PI = 3.14159265359
 const WIDTH = 180
 const HEIGHT = 30
@paul-d-ray
paul-d-ray / Nushell_Last_Command.md
Last active December 17, 2025 01:42
Nushell Last vs Last 1

Nushell's Last vs Last 1 Command

In Nushell, there is a difference between "last" and "last 1"

  • the "last" command returns a string

  • the "last 1" command returns a list of strings

  • the same is true for "first" and "first 1" except the "first 1" is a list of strings (stream)

Nushell Examples

@paul-d-ray
paul-d-ray / Nushell_Get_SHA256_Hash.md
Created December 3, 2025 00:31
Nushell Get SHA256 Hash for a list of files

Purpose

Get the SHA256 Hast for a list of files. This can be used to compare to the hast of a downloaded file.

Nushell Code

nuls -f d:/work/tools | where name =~ '^nu'| sort-by modified | select fullname |
each {|file| {fullname: $file.fullname, hash: (open $file.fullname --raw | hash sha256)} } | collect
@paul-d-ray
paul-d-ray / Nushell_Rossetta_Merge_and_Aggregate_Datasets.md
Last active November 23, 2025 00:41
Nushell Merge and Aggregate Datasets

Merge and aggregate datasets

From Roseeta Code Merge and aggregate datasets Task

  • Merge and aggregate two datasets as provided in .csv files into a new resulting dataset.

  • Use the appropriate methods and data structures depending on the programming language.

  • Use the most common libraries only when built-in functionality is not sufficient.

    • Note Either load the data from the .csv files or create the required data structures hard-coded.
@paul-d-ray
paul-d-ray / Nushell_config.nu
Last active November 23, 2025 00:46
Nushell Config.nu
# config.nu
#
# Installed by:
# version = "0.102.0"
#
# This file is used to override default Nushell settings, define
# (or import) custom commands, or run any other startup tasks.
# See https://www.nushell.sh/book/configuration.html
#
# This file is loaded after env.nu and before login.nu
@paul-d-ray
paul-d-ray / Visidata_Nushell_Join_Data_Sets.md
Created October 11, 2025 22:36
Visidata Nushell Join two data sets
@paul-d-ray
paul-d-ray / Visidata_DateTime_Column.md
Created October 11, 2025 22:33
Visidata DateTime column Filter or Split

Filter on a Date Column

to filer on a date field do the following steps

  • make sure the import datetime is in the .visidatarc file.
  • format the date column with @ to let visidata know it is a date column.
  • be in the column, and do a filter z|
  • key in the command
    DATE_FIELD_NAME > datetime.date(YYYY,M,D)
    INCIDENT_DATE > datetime.date(2016,1,1)