Skip to content

Latest commit

ย 

History

History
267 lines (213 loc) ยท 12.8 KB

README.md

File metadata and controls

267 lines (213 loc) ยท 12.8 KB

Modules

Run a function after the given program (by PID)

api_wrappers

Demo of various API wrappers:

background_task

make nushell "support" background task feature. see README

base16

Base16 theme generator (for Linux, might work for other OS) see README

coloring

These scripts are used to demonstrate the ansi command using ansi coloring. This is mainly a demo area where we have taken typical bash scripts and ported them to nushell scripts. It would be nice if all scripts here showed the "other" version of script and the ported nushell version. We can show "other" flavors of scripts by including them as comments in the nushell scripts or by naming the nushell script and the other script the same basename.

data_extraction

  • Ultimate Extractor - Extract any compressed archive, UE will call the proper program under the hood ๐Ÿ˜Ž

An extensive example of a wrapper for docker operations, with nushell completions.

filesystem

  • bm - A Simple bookmarking module. It uses XGD_DATA_HOME to save bookmarks.
  • expand - expansion module that implements bashes brace expansion. The expansion uses a list inside of braces separated by , to expand into a list of multiple string variations like:
 expand a/{b,c}/d{e,f,g}.nu{,on}

parses into:

โ•ญโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚  0 โ”‚ a/b/de.nu   โ”‚
โ”‚  1 โ”‚ a/c/de.nu   โ”‚
โ”‚  2 โ”‚ a/b/df.nu   โ”‚
โ”‚  3 โ”‚ a/c/df.nu   โ”‚
โ”‚  4 โ”‚ a/b/dg.nu   โ”‚
โ”‚  5 โ”‚ a/c/dg.nu   โ”‚
โ”‚  6 โ”‚ a/b/de.nuon โ”‚
โ”‚  7 โ”‚ a/c/de.nuon โ”‚
โ”‚  8 โ”‚ a/b/df.nuon โ”‚
โ”‚  9 โ”‚ a/c/df.nuon โ”‚
โ”‚ 10 โ”‚ a/b/dg.nuon โ”‚
โ”‚ 11 โ”‚ a/c/dg.nuon โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

formats

Examples of input/output formatters:

fun

  • spark - send an array into spark and get a sparkline out:
    > let v = [2, 250, 670, 890, 2, 430, 11, 908, 123, 57]
    > spark $v
    โ–โ–‚โ–†โ–‡โ–โ–„โ–โ–ˆโ–โ–
  • website-builder - converts markdown into their equivalent html pages
  • wordle - A Terminal Wordle game. The code is based on this gist, but slightly personalized.

github

  • branch-protections - Do you have hundreds or thousands of GitHub repositories in your organization? Are you tired of manually managing their branch protection rules? Don't! Let nushell do it for you! see README
  • merged-branches - Do your developers often forget to delete their branches after merging PRs? Are you tired of manually going into every repository and deleting them? Don't! Let nushell do it for you! see README

Search files on your GitLab server

Converts the output of many common external commands into nushell data structures.

Example:

: jc ping -4 -c 2 google.com
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ destination_ip       โ”‚ 216.58.209.46                                                                            โ”‚
โ”‚ data_bytes           โ”‚ 56                                                                                       โ”‚
โ”‚ pattern              โ”‚                                                                                          โ”‚
โ”‚ destination          โ”‚ google.com                                                                               โ”‚
โ”‚ duplicates           โ”‚ 0                                                                                        โ”‚
โ”‚ packets_transmitted  โ”‚ 2                                                                                        โ”‚
โ”‚ packets_received     โ”‚ 2                                                                                        โ”‚
โ”‚ packet_loss_percent  โ”‚ 0.00                                                                                     โ”‚
โ”‚ time_ms              โ”‚ 1001.00                                                                                  โ”‚
โ”‚ round_trip_ms_min    โ”‚ 3.87                                                                                     โ”‚
โ”‚ round_trip_ms_avg    โ”‚ 4.04                                                                                     โ”‚
โ”‚ round_trip_ms_max    โ”‚ 4.21                                                                                     โ”‚
โ”‚ round_trip_ms_stddev โ”‚ 0.17                                                                                     โ”‚
โ”‚                      โ”‚ โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚
โ”‚ responses            โ”‚ โ”‚ # โ”‚ type  โ”‚ timestamp โ”‚ bytes โ”‚  response_ip  โ”‚ icmp_seq โ”‚ ttl โ”‚ time_ms โ”‚ duplicate โ”‚ โ”‚
โ”‚                      โ”‚ โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚
โ”‚                      โ”‚ โ”‚ 0 โ”‚ reply โ”‚           โ”‚    64 โ”‚ 216.58.209.46 โ”‚        1 โ”‚ 120 โ”‚    4.21 โ”‚ false     โ”‚ โ”‚
โ”‚                      โ”‚ โ”‚ 1 โ”‚ reply โ”‚           โ”‚    64 โ”‚ 216.58.209.46 โ”‚        2 โ”‚ 120 โ”‚    3.87 โ”‚ false     โ”‚ โ”‚
โ”‚                      โ”‚ โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
: (jc ping -4 -c 2 google.com).round_trip_ms_avg
6.054

For supported commands see JC parsers documentation

Installation:

  1. Install the jc command line: https://kellyjonbrazil.github.io/jc/#installation
  2. Import this module in your config.nu: import ~/.local/share/nu_scripts/modules/jc/
Category Command Description Options
File Operations kaf <file> kubectl apply -f
kdf <file> kubectl diff -f
kdelf <file> kubectl delete -f
kak <file> kubectl apply -k (kustomize)
kdk <file> kubectl diff -k (kustomize)
kdelk <file> kubectl delete -k (kustomize)
kk <file> kubectl kustomize (template)
Context & Namespace kcc <context> change context
kn <namespace> change namespace
kccc <name> clone context to ~/.kube/config.d/
Resource Management kg <kind> [resource] get resources -n/--namespace: specify namespace
-p/--jsonpath: use jsonpath
-l/--selector: label selector
-v/--verbose: detailed output
-w/--watch: watch resources
-W/--wide: wide output
-a/--all: all namespaces
kd <kind> <resource> describe resource
kc <kind> <name> create resource
ky <kind> <resource> get yaml output
ke <kind> [resource] edit resource
kdel <kind> <resource> delete resource
Pods kgp get pods
kdp <pod> describe pod
kdelp <pod> delete pod
kep <pod> edit pod
kl <pod> logs from pod -n/--namespace: specify namespace
-c/--container: specify container
-f/--follow: follow logs
-p/--previous: show previous logs
kep <pod> exec into pod
Services kgs get services
kds <svc> describe service
kdels <svc> delete service
kes <svc> edit service
Deployments kgd get deployments
kdel deployment <deploy> delete deployment
ked <deploy> edit deployment
ksd <deploy> <num> scale deployment
ksdr <deploy> <num> scale deployment with reset
krhd <deploy> rollout history deployment
krud <deploy> rollout undo deployment
Config & Utils kube-config get kubeconfig info
kube-refine [namespace] -k [kind] extract structured info from resources

???

  • [math_functions] - module with the following commands:
    • root - root with a custom denominator
    • croot - cube root
    • aroot - root with a custom scaler and denominator
    • delta - calculate the delta of the quadratic function
    • fact - factorial of the given number
    • q_roots - calculare roots of the quadratic function: ax^2+bx+x
    • isprime - check if integer is prime
    • primelist - list primes until given number
    • mtable - multiplication table of n till max
    • isleap - check if year is leap
    • gcd - greatest common divisor between 2 integers
    • lcm - least commoin multiple between 2 integers
    • dec2base - decimal number to custom base representation
    • scale-minmax - scale list to [a,b] interval
    • scale-minmax-table - Scale every column of a table (separately) to [a,b] interval
    • math exp - exp function

network

  • remoting - This module provide convenient way to manage multiple remote clients. see README

  • sockets - The sockets command returns a table containing information on network sockets and the processes they belong to. It is basically a join of the tables produced by the lsof command, and the nushell ps command.

    image
  • ssh wrapper that provides the following commands:

    • ssh
    • scp
    • ssh-list
    • parse-ssh-file
    • str max-length
    • ensure-index

??? (not sure how universal this is) Mix of hooks, defs and alias wrapper around neovim.

??? (make a module out of these scripts?) - Collection of progress bars

??? (not sure how universal this is) This script provides minimal working rbenv setup.

A module to manipulate nu's record

Currently holds the clip command which was previously incorrectly in the standard library of Nushell.

use modules/system *  # will bring `clip` into scope

The scripts in this directory activate virtual environments for Conda environments.

These scripts should be used to demonstrate how get your local weather and/or weather forecasts.

Simple scripts to demonstrate how to scrape websites in nushell. Requires query web plugin