Skip to content

Instantly share code, notes, and snippets.

@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)
@paul-d-ray
paul-d-ray / Visidata_Visidatarc.md
Last active October 14, 2025 18:07
Visidata .visidatarc file

Visidata Config File

In Windows, the config file goes in the user home folder

  • Create the C:\Users\USERNAM\.visidatarc file
    • note the dot in front of the file name
  • add the following to the file
# for VisiData
import datetime

options.color_key_col = "green"
@paul-d-ray
paul-d-ray / Nushell_FD_LS.md
Last active November 9, 2025 21:13
Nushell Combine FD and LS

Purpose

Use FD to find a file and pipe it to Nushell's ls command to list information on the file.

Nushell Code

fd -H -I -i  -E 'Windows' -E 'Python' -E 'Steel*' -E '*ffice*' -E '*ire*' -E '*VS Code*' -E 'WindowsPowerShell' --glob  '*posh*.exe' 'c:\'  | lines | each {|file|  nuls -f  ($file |path dirname) | where name =~ ($file | path basename )  } | flatten

Nushell Code Explained

fd -H -I -i -E 'Windows' -E 'Python' -E 'Steel*' -E '*ffice*' -E '*ire*' -E '*VS Code*' -E 'WindowsPowerShell' --glob '*posh*.exe' 'c:\'

@paul-d-ray
paul-d-ray / Nushell_CLI_Weather_Forecast.md
Last active September 28, 2025 03:04
Nushell CLI Weather Forecast

Using Nushell to get Local Weather

I saw on Hacker News for another programming lanuage. I wanted to get the forecast for my area using Nushell.

  • I used Grok to get the code for my location.

Nushell Code

http get https://api.weather.gov/gridpoints/FFC/32,107/forecast | from json |
  get properties.periods |