Skip to content

Commit

Permalink
Codex fiddling
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoverbear committed Apr 2, 2024
1 parent 6a43b51 commit 8dc7111
Show file tree
Hide file tree
Showing 28 changed files with 113 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install Zola
run: |
mkdir -p bin/
curl -Lo zola.tar.gz https://github.com/getzola/zola/releases/download/v0.14.1/zola-v0.14.1-x86_64-unknown-linux-gnu.tar.gz
curl -Lo zola.tar.gz https://github.com/getzola/zola/releases/download/v0.18.0/zola-v0.18.0-x86_64-unknown-linux-gnu.tar.gz
tar xvf zola.tar.gz -C bin
echo "$(pwd)/bin" >> $GITHUB_PATH
rm zola.tar.gz
Expand Down
4 changes: 3 additions & 1 deletion content/codex/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ photographer = "Darwin Vegher"
source = "https://unsplash.com/photos/wQlES3Khoi8"
+++

> **The pages within should be considered unstable and often not complete concepts. They are working notes and ideas.** You are not necessarily meant for this place, but I care not if you happen to want to wander within it.
> The pages within should be considered unstable, impermanent, and often not complete concepts. They are working notes, passing thoughts, and ideas.
>
> **You are not meant for this place, but I care not if you happen to wander within it.**
15 changes: 15 additions & 0 deletions content/codex/development/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
+++
title = "Development"
description = "Some time ago, we taught sand to think. Now, it teaches us new ways to think."
sort_by = "weight"
template = "blog/list.html"

[extra]
in_menu = true

# [extra.image]
# path = "cover.jpg"
# colocated = true
# photographer = "Brandon Jaramillo"
# source = "https://unsplash.com/photos/white-rose-in-close-up-photography-NzMzETo-XJE"
+++
File renamed without changes.
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ photographer = "Roseanna Smith"
source = "https://unsplash.com/photos/-qzLjuJEmsE"
+++

<!-- more -->

# Use PowerShell

To get to a PowerShell from a command prompt:
Expand All @@ -36,11 +38,4 @@ I prefer to configure my IDEs to also use PowerShell. In Visual Studio Code (VSC

# Use a Package Manager

There are several options such as [`scoop`](https://scoop.sh/) for Windows.

```powershell
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
scoop install sudo
sudo echo "Bloop"
```
Use `winget` if you can!
File renamed without changes
91 changes: 91 additions & 0 deletions content/codex/development/nu/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
+++
title = "A Nu Shell"
description = "Finding some consistency on interacting with the machine."
sort_by = "weight"
template = "blog/list.html"

[extra]
in_menu = true

[extra.image]
path = "cover.jpg"
colocated = true
photographer = "Brandon Jaramillo"
source = "https://unsplash.com/photos/white-rose-in-close-up-photography-NzMzETo-XJE"
+++


<!-- more -->

# Installing

Developing across multiple operating systems can be pretty annoying! Mac `bash` is different than Arch `bash`, which is different than Windows `powershell`. 😵‍💫

We can use `nu` to bring some consistency.

With a Rust toolchain:

```sh
cargo install nu
```

Without a Rust toolchain:

```sh
# Windows
winget install nu
# Mac
brew install nu
# Arch Linux
pacman -S nu
```

# Motivations

## Consistent Builtins

Things like `cp`, `rm`, and `ls` work consistently on `nu`. (Here's looking at `rm -rf` on Powershell...)

##

# Working with it

[Coming from Bash](https://www.nushell.sh/book/coming_from_bash.html) is quite helpful.

`nu` works slightly differently than other shells in that it separates parsing and evaluation. More in [How Nushell Code Gets Run](https://www.nushell.sh/book/how_nushell_code_gets_run.html).

## Piping to Files

`nu` doesn't have a `>` pipe. Instead:

```nu
cat floof | save boop
```

For `>>`:

```nu
cat floof | save -a boop
```

## Parameter Expansion

Different shells approach [parameter expansion](https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html) differently.

In `bash` we can do like:

```bash
./x.py --stage 2 dist $(ferrocene/ci/split-tasks.py dist)
```

While `fish` it looks like:

```fish
./x.py --stage 2 dist $(ferrocene/ci/split-tasks.py dist | string split " ")
```

On `nu` we do this:

```nu
./x.py --stage 2 dist ...(python ferrocene/ci/split-tasks.py dist | split row " ")
```
Binary file added content/codex/development/nu/cover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes

0 comments on commit 8dc7111

Please sign in to comment.