❯ let before = (sys).mem.used
❯ $before
9,382,694,912
❯ mut csv = open ~\OneDrive\vdi\DBScripts\Output\violations-20220731-20230801.csv
❯ $csv | length
1046339
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ```nushell | |
| # Reinterpret a 32-bit hexadecimal integer as an IEEE-754 single-precision | |
| # (f32) floating-point value. | |
| # | |
| # An IEEE-754 f32 is laid out as: | |
| # | |
| # [ sign: 1 bit ][ exponent: 8 bits ][ fraction: 23 bits ] | |
| # | |
| # For example: | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 { |
default_config.nuanddefault_env.nurefer to the files that are compiled inside of the nushell executable and are also located in our repo.personal env.nu/config.nu/login.nurefer to the files that are in the$nu.default-config-dirthat you have personally edited.specified config.nu/env.nurefer to files that are specified on the command line with the--configand--env-configcommand line parameters.
- ✅ Always reads the nushell standard library
- ✅ Always reads
personal plugin.msgpackzfile if it exists
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
OSC 6 ; 1 ; bg ; red ; brightness ; [N] ST
OSC 6 ; 1 ; bg ; green ; brightness ; [N] ST
OSC 6 ; 1 ; bg ; blue ; brightness ; [N] ST
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def utc [now?: datetime] { | |
| if $now == null { | |
| date now | date to-timezone utc | format date "%Y-%m-%dT%H:%M:%SZ" | |
| } else { | |
| $now | date to-timezone utc | format date "%Y-%m-%dT%H:%M:%SZ" | |
| } | |
| } | |
| def iso-8601 [now?: datetime] { | |
| if $now == null { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # emulate the python rich print | |
| # https://github.com/Textualize/rich | |
| # https://github.com/Textualize/rich/blob/master/rich/console.py#L1624 | |
| # 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Build All Plugins | |
| def build_all_external_plugins [] { | |
| let plugins = ls nu_plugin_* | where name != nu_plugin_template | |
| for plug in $plugins { | |
| print $"(ansi green_bold)Doing some git work on (ansi purple_bold)($plug.name)(ansi reset)(char nl)" | |
| cd ($plug.name | path expand) | |
| git restore Cargo.lock | |
| git restore Cargo.toml | |
| git pull |
Most of this is taken from fzf.fish. A really nice fzf integration with fish-shell.
There's quite a bit of usage of a fish command called commandline. It would be super helpful for porting things like this script if we had such a utility to modify the readline command line buffer.
Set the default fzf options
let-env FZF_DEFAULT_OPTS = '--cycle --layout=reverse --border --height=90% --preview-window=wrap --marker="*"'
NewerOlder