mirror of
https://github.com/Cian-H/dotfiles.git
synced 2026-01-29 05:32:28 +00:00
Changed . token to _dot
This change allows the dotfiles to work with chezmoi (e.g: on windows) and improves grepability with neovim/telescope
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
|
||||
def "nu core-team" [] {
|
||||
[
|
||||
[ 'name', 'tz'];
|
||||
[ 'andres', 'America/Guayaquil']
|
||||
[ 'fdncred', 'US/Central']
|
||||
[ 'gedge', 'US/Eastern']
|
||||
[ 'jt', 'NZ']
|
||||
[ 'wycats', 'US/Pacific']
|
||||
[ 'kubouch', 'Europe/Helsinki']
|
||||
['elferherrera', 'Europe/London']
|
||||
]
|
||||
}
|
||||
|
||||
def "date local" [now] {
|
||||
insert time {|value|
|
||||
let converted = ($now | date to-timezone $value.tz);
|
||||
|
||||
$converted | format date '%c'
|
||||
}
|
||||
}
|
||||
|
||||
let next_call = ("2021-08-31 15:00:21.290597200 -05:00" | into datetime);
|
||||
let people = (nu core-team | date local $next_call);
|
||||
|
||||
def say [closure] {
|
||||
$in | each {|person|
|
||||
do $closure (
|
||||
$person | update name {|row| $row.name | str capitalize}
|
||||
)
|
||||
} | str join (char newline)
|
||||
}
|
||||
|
||||
print ($people | say {|person| $"($person.name)'s timezone is ($person.tz)"})
|
||||
|
||||
print ($"
|
||||
|
||||
for the next call happening on ($next_call | format date '%c').. in their timezones they would be:
|
||||
|
||||
")
|
||||
|
||||
print ($people | say {|person| $"($person.name)'s: ($person.time)"})
|
||||
25
dot_config/nushell/nu_scripts/sourced/examples/netstat.nu
Normal file
25
dot_config/nushell/nu_scripts/sourced/examples/netstat.nu
Normal file
@@ -0,0 +1,25 @@
|
||||
let ns = (netstat | lines | skip 1)
|
||||
|
||||
let first_batch = ($ns | take until {|it| $it =~ Active } | str join (char nl) | from ssv -m 1)
|
||||
let second_batch = ($ns |
|
||||
skip until {|it| $it =~ Active } |
|
||||
skip 1 |
|
||||
str join (char nl) |
|
||||
str replace '\[ \]' "[]" --all |
|
||||
from ssv -m 1 |
|
||||
default I-Node "" |
|
||||
default Path ""
|
||||
| each {|row| if $row.Type == DGRAM {
|
||||
$row | update Path { get I-Node } | update I-Node { get State } | update State ""
|
||||
} else {
|
||||
$row
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
print $first_batch
|
||||
print $second_batch
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user