Compare commits
12 Commits
65ec0c8bf8
...
nushell
| Author | SHA1 | Date | |
|---|---|---|---|
| 46fed03268 | |||
| 8571495a53 | |||
| 814305c82d | |||
| 6f3131bedc | |||
| 65fed10281 | |||
| 38555114b1 | |||
| 0d27c52f6e | |||
| 2f43f25649 | |||
| de4aafdd80 | |||
| 482c639b30 | |||
| 1a651bb023 | |||
| e2fe842098 |
@@ -1,50 +1,46 @@
|
|||||||
export def lumen-assono-backup-nexttape [dateinput: datetime]: nothing -> nothing {
|
export def lumen-assono-backup-nexttape [dateinput: datetime]: nothing -> nothing {
|
||||||
print 'Next Required Tape:'
|
print 'Next Required Tape:'
|
||||||
print $'($dateinput | get-backup-string)'
|
print $'($dateinput | get-backup-string 0)'
|
||||||
print ''
|
print ''
|
||||||
print 'Tapes after that:'
|
print 'Tapes after that:'
|
||||||
|
|
||||||
1..9 | each {|i|
|
1..11 | each {|i|
|
||||||
print $'($i): (($dateinput + ((7 * $i) | into duration -u day)) | get-backup-string)'
|
print ($dateinput | get-backup-string $i)
|
||||||
} | ignore
|
} | ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
def get-backup-string []: datetime -> string {
|
def get-backup-string [index]: datetime -> string {
|
||||||
let backupDay = $in - ($in | format date '%w' | into duration -u day) + 6day
|
let firstDayMonth = $'01-((($in | format date '%m' | into int) + $index) mod 12 + 1)($in | format date '-%y')' | into datetime --format '%d-%m-%y'
|
||||||
let saturdayOfMonth = $backupDay | get-week-of-month
|
let firstDayMonth = if ($firstDayMonth < $in) {
|
||||||
let monthOfQuarter = $backupDay | get-month-of-quarter
|
$'($firstDayMonth | format date '%d-%m-')(($firstDayMonth | format date '%y' | into int) + 1)' | into datetime --format '%d-%m-%y'
|
||||||
let quarter = $backupDay | get-quarter
|
} else {
|
||||||
let year = $backupDay | get-year
|
$firstDayMonth
|
||||||
if ($saturdayOfMonth == 1) {
|
}
|
||||||
if ($monthOfQuarter == 1) {
|
let backupDay = $firstDayMonth - ($firstDayMonth | format date '%w' | into duration -u day) + 6day
|
||||||
if ($quarter == 1) {
|
let monthOfQuarter = $backupDay | get-month-of-quarter
|
||||||
$'TapeLTO5-Y(($year | into string | str substring 3..))'
|
let quarter = $backupDay | get-quarter
|
||||||
} else {
|
let year = $backupDay | get-year
|
||||||
$'TapeLTO5-Q($quarter)'
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$'TapeLTO5-M($monthOfQuarter)'
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$'TapeLTO5-W($saturdayOfMonth)'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def get-week-of-month []: datetime -> int {
|
if ($monthOfQuarter == 1) {
|
||||||
let firstDay = ($in - ($in | format date '%d' | into duration -u day) + 1day)
|
if ($quarter == 1) {
|
||||||
let $firstSpecificDay = $firstDay + (((($in | format date '%w' | into int) + 7 - ($firstDay | format date '%w' | into int)) mod 7) | into duration -u day)
|
$"($backupDay): TapeLTO5-Y(($year - 1| into string | str substring 3..))"
|
||||||
((($in - $firstSpecificDay) | into int | into datetime | format date '%d' | into int) / 7 | math floor) + 1
|
} else {
|
||||||
}
|
$"($backupDay): TapeLTO5-Q($quarter - 1)"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$"($backupDay): TapeLTO5-M($monthOfQuarter - 1)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def get-month-of-quarter []: datetime -> int {
|
def get-month-of-quarter []: datetime -> int {
|
||||||
let month = ($in | format date '%m' | into int) + 3
|
let month = ($in | format date '%m' | into int) + 3
|
||||||
($month..($month - 3)..1) | last
|
($month..($month - 3)..1) | last
|
||||||
}
|
}
|
||||||
|
|
||||||
def get-quarter []: datetime -> int {
|
def get-quarter []: datetime -> int {
|
||||||
(($in | format date '%m') | into int) / 3 | math ceil
|
(($in | format date '%m') | into int) / 3 | math ceil
|
||||||
}
|
}
|
||||||
|
|
||||||
def get-year []: datetime -> int {
|
def get-year []: datetime -> int {
|
||||||
$in | format date '%Y'
|
$in | format date '%Y' | into int
|
||||||
}
|
}
|
||||||
|
|||||||
3
autoload/jlab-usb-power-toggle.nu
Normal file
3
autoload/jlab-usb-power-toggle.nu
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export def lumen-jlab-usb-power-toggle []: nothing -> nothing {
|
||||||
|
sudo uhubctl -a toggle -p 1 -l 3-5
|
||||||
|
}
|
||||||
18
config.nu
18
config.nu
@@ -17,9 +17,21 @@
|
|||||||
# You can remove these comments if you want or leave
|
# You can remove these comments if you want or leave
|
||||||
# them for future reference.
|
# them for future reference.
|
||||||
|
|
||||||
|
$env.EDITOR = 'nvim'
|
||||||
|
$env.VISUAL = 'nvim'
|
||||||
|
|
||||||
$env.config.show_banner = false
|
$env.config.show_banner = false
|
||||||
$env.EDITOR = 'hx'
|
$env.config.table.trim.methodology = 'truncating'
|
||||||
$env.VISUAL = 'hx'
|
$env.config.table.trim.truncating_suffix = ' >>'
|
||||||
|
$env.config.table.mode = 'frameless'
|
||||||
|
|
||||||
if ((sys host).name !~ '.*Windows.*') {
|
if ((sys host).name !~ '.*Windows.*') {
|
||||||
$env.SSH_AUTH_SOCK = '/home/lumen/.bitwarden-ssh-agent.sock'
|
$env.SSH_AUTH_SOCK = $'($env.HOME)/.bitwarden-ssh-agent.sock'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
carapace _carapace nushell | let carapace_nu
|
||||||
|
mkdir $'($nu.cache-dir)'
|
||||||
|
$carapace_nu | save --force $'($nu.cache-dir)/carapace.nu'
|
||||||
|
} catch {}
|
||||||
|
source (if ($'($nu.cache-dir)/carapace.nu' | path exists) {($'($nu.cache-dir)/carapace.nu')} else { null })
|
||||||
|
|||||||
Reference in New Issue
Block a user