Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View devyn's full-sized avatar
👨‍💻
Nushell is really cool

Devyn Cairns devyn

👨‍💻
Nushell is really cool
View GitHub Profile
@devyn
devyn / nushell-todos.md
Last active April 23, 2024 07:45
Nushell TODOs

@devyn's nushell TODOs

Commands

  • Improve error record in try/catch and document with an example
    • Adding the code would be helpful
  • Add closure argument to append for adding another stream to the end
  • run for running nushell scripts as if they were blocks
  • Make http commands accept and stream from pipeline input
  • nice for low thread priority? (would be nice on windows for sure)
@devyn
devyn / demos.nu
Last active February 29, 2024 02:59
demos from presentation at nushell core team meeting
# stream plugin
stream_example seq 1 10
stream_example seq 1 10 | describe
seq 1 10 | stream_example sum
stream_example seq 1 10000 | stream_example sum
[foo bar baz] | stream_example collect
[foo bar baz] | stream_example collect | describe
# engine calls (wip)
seq 1 5 | stream_example for-each { $in * 2 }
@devyn
devyn / env.nu
Created February 28, 2024 08:22
Envfile utils
# Replace environment variables in a string. Accepts $VAR and ${VAR} syntax. Handles $PATH.
export def "str replace-env" [
--overlay: record = {} # Use this record as an overlay over the environment
] {
# Replace PATH first, from overlay if it exists
let in_string = $in | str replace --all --regex '\$PATH|\$\{PATH\}' (
$overlay.PATH? | default $env.PATH | str join (char esep)
)
# Parse env variables and look them up in $env
($in_string |
@devyn
devyn / nushell-plugin-protocol-draft.md
Last active February 24, 2024 18:19
Nushell plugin protocol draft

Plugin protocol draft

How Nushell runs plugins

Nushell plugins must be an executable file with a filename starting with nu_plugin_. All interaction with the plugin is handled over standard input (stdin) and output (stdout). Standard error (stderr) is not redirected, and can be used by the plugin to print messages directly.

Plugins are always passed --stdio as a command line argument. Other command line arguments are reserved for options that might be added in the future, including other communication methods.

error: failed to run custom build command for `ring v0.16.20`
Caused by:
process didn't exit successfully: `/tmp/sccache/target/release/build/ring-4ff7b7bafeb544fd/build-script-build` (exit status: 101)
--- stderr
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/riscv/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/build.rs:358:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

See gist about kernel options

Compiling kernel:

export ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
make -j32
make -j32 INSTALL_MOD_PATH=system_out modules_install
options zfs zfs_arc_max=8589934592
options zfs zfs_vdev_aggregation_limit=2097152
options zfs zfs_vdev_aggregation_limit_non_rotating=2097152
options zfs zfs_vdev_sync_read_max_active=256
options zfs zfs_vdev_sync_write_max_active=256
options zfs zfs_vdev_sync_read_min_active=8
options zfs zfs_vdev_sync_write_min_active=8
options zfs zfs_vdev_async_read_max_active=16
options zfs zfs_vdev_async_read_min_active=2

Config diff

 CFS_BANDWIDTH n -> y
 SCHED_WALT y -> n
 MEMCG_SWAP n -> y
+MEMCG_SWAP_ENABLED y

Note

@devyn
devyn / keyed.rs
Created September 16, 2019 01:14
use std::cmp::Ordering;
trait Keyed<'a> {
type Key: 'a + Eq + Ord;
fn key(&'a self) -> Self::Key;
}
#[derive(Debug, Clone)]
struct TypeA {
#!/bin/bash
# https://coldfix.eu/2017/01/29/vpn-box/
up() {
# ensure alternate resolv.conf exists
# otherwise system resolv.conf will be overwritten
[[ -d /etc/netns/vpn ]] || mkdir -p /etc/netns/vpn
[[ -e /etc/netns/vpn/resolv.conf ]] || touch /etc/netns/vpn/resolv.conf
# create network namespace