Skip to content

Instantly share code, notes, and snippets.

View fdncred's full-sized avatar

Darren Schroeder fdncred

View GitHub Profile
@fdncred
fdncred / agg_command.md
Last active November 12, 2024 14:46
agg command

Introduce a nushell aggregation command

Similar to group-by but meant to perform grouping and aggregation based on parameters provided.

Ideas

  • group by one or more column names
  • have either sub commands or parameters for
@fdncred
fdncred / pr.nu
Created July 18, 2024 15:33
rich_in_nu
# emulate the python rich print
# test case 1: pr "hello world"
# test case 2: pr "hello world" --style bold
# test case 3: pr "hello world" --style 'bold underline'
# test case 4: pr "hello world" --style 'dim italic red'
def pr [
msg,
--style: string,
] {
let style = if $style == null {
@fdncred
fdncred / memory-perf.md
Last active May 7, 2024 12:49
memory perf

Nushell Memory Utilization

2023-08-29 07:13:21.667983800 -05:00

 let before = (sys).mem.used
 $before
9,382,694,912
 mut csv = open ~\OneDrive\vdi\DBScripts\Output\violations-20220731-20230801.csv
 $csv | length
1046339
@fdncred
fdncred / editor_motions.md
Last active April 20, 2024 12:50
editor motions

Key combinations

Hover / Tooltip

Vscode

Just put your cursor over the text, use mouse to scroll text

Neovim

@fdncred
fdncred / nushell_bashisms.md
Last active April 15, 2024 14:22
nushell bashisms

Bashisms

What is a bashism

A bashism is a command, operator, or syntax in the repl that most people associate with bash.

What bashisms does Nushell support?

Bang Bang syntax

@fdncred
fdncred / nushell-stdin.md
Last active February 16, 2024 08:16
nushell stdin redesign

Nushell stdin redesign

From Ian on Discord

run interactive repl
  nu

execute commands before interactive repl:
 nu -e "commands"
@fdncred
fdncred / config_loading.md
Last active October 23, 2024 22:35
nushell config file loading

Config file loading rules

  1. default_config.nu and default_env.nu refer to the files that are compiled inside of the nushell executable and are also located in our repo.
  2. personal env.nu/config.nu/login.nu refer to the files that are in the $nu.default-config-dir that you have personally edited.
  3. specified config.nu/env.nu refer to files that are specified on the command line with the --config and --env-config command line parameters.

nu

  • ✅ Always reads the nushell standard library
  • ✅ Always reads personal plugin.msgpackz file if it exists
@fdncred
fdncred / escape_sequences.md
Created December 20, 2023 15:38
escape sequences

OSC4 - set foreground/background colors

OSC 4 ; -2; ? ST //bg
OSC 4 ; -1 ; ? ST //fg
OSC 4 ; -2 ; rgb : [red] / [green] / [blue] ST
OSC 4 ; -1 ; rgb : [red] / [green] / [blue] ST

OSC6 - set window title and tab color

OSC 6 ; 1 ; bg ; red ; brightness ; [N] ST
OSC 6 ; 1 ; bg ; green ; brightness ; [N] ST

OSC 6 ; 1 ; bg ; blue ; brightness ; [N] ST

@fdncred
fdncred / languages.toml
Created November 8, 2023 20:56
helix languages
# Language support configuration.
# See the languages documentation: https://docs.helix-editor.com/master/languages.html
[language-server]
awk-language-server = { command = "awk-language-server" }
bash-language-server = { command = "bash-language-server", args = ["start"] }
bass = { command = "bass", args = ["--lsp"] }
bicep-langserver = { command = "bicep-langserver" }
bufls = { command = "bufls", args = ["serve"] }
@fdncred
fdncred / store_commands.md
Last active November 3, 2023 17:15
stor family of commands

Stor family of commands

Introduction

Originally when I wrote the $db PR, I went in knowing that other commands would be needed. The concept is to have an in-memory sqlite database available to you at any time to store anything you want. I just chose $db because it was very nushell-y and easily accessible.

An alternative that I came up with was to have a command named stor with subcommands. stor without and e because you don't get groceries from it. :) We can name it whatever, but for now, it's stor. The idea behind the stor family of commands is that they provide a way to interact with the in-memory database.

Commands