Compare commits
18 Commits
1f96e4ef15
...
nushell
| Author | SHA1 | Date | |
|---|---|---|---|
| de4aafdd80 | |||
| 482c639b30 | |||
| 1a651bb023 | |||
| e2fe842098 | |||
| 65ec0c8bf8 | |||
| 6793e4e0ae | |||
| ac8fc8529b | |||
| e6b082f38c | |||
| 614a57652f | |||
| 80a119972f | |||
| 05d3aaa8dd | |||
| 9afb3328ba | |||
| e866e94303 | |||
| 283b4f0e56 | |||
| 01035f61bd | |||
| 1f697ecc23 | |||
| 4703c6c492 | |||
| a9aa507b4c |
46
autoload/assono-backup-nexttape.nu
Normal file
46
autoload/assono-backup-nexttape.nu
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
export def lumen-assono-backup-nexttape [dateinput: datetime]: nothing -> nothing {
|
||||||
|
print 'Next Required Tape:'
|
||||||
|
print $'($dateinput | get-backup-string 0)'
|
||||||
|
print ''
|
||||||
|
print 'Tapes after that:'
|
||||||
|
|
||||||
|
1..11 | each {|i|
|
||||||
|
print ($dateinput | get-backup-string $i)
|
||||||
|
} | ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
def get-backup-string [index]: datetime -> string {
|
||||||
|
let firstDayMonth = $'01-((($in | format date '%m' | into int) + $index) mod 12 + 1)($in | format date '-%y')' | into datetime --format '%d-%m-%y'
|
||||||
|
let firstDayMonth = if ($firstDayMonth < $in) {
|
||||||
|
$'($firstDayMonth | format date '%d-%m-')(($firstDayMonth | format date '%y' | into int) + 1)' | into datetime --format '%d-%m-%y'
|
||||||
|
} else {
|
||||||
|
$firstDayMonth
|
||||||
|
}
|
||||||
|
let backupDay = $firstDayMonth - ($firstDayMonth | format date '%w' | into duration -u day) + 6day
|
||||||
|
let monthOfQuarter = $backupDay | get-month-of-quarter
|
||||||
|
let quarter = $backupDay | get-quarter
|
||||||
|
let year = $backupDay | get-year
|
||||||
|
|
||||||
|
if ($monthOfQuarter == 1) {
|
||||||
|
if ($quarter == 1) {
|
||||||
|
$"($backupDay): TapeLTO5-Y(($year - 1| into string | str substring 3..))"
|
||||||
|
} else {
|
||||||
|
$"($backupDay): TapeLTO5-Q($quarter - 1)"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$"($backupDay): TapeLTO5-M($monthOfQuarter - 1)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def get-month-of-quarter []: datetime -> int {
|
||||||
|
let month = ($in | format date '%m' | into int) + 3
|
||||||
|
($month..($month - 3)..1) | last
|
||||||
|
}
|
||||||
|
|
||||||
|
def get-quarter []: datetime -> int {
|
||||||
|
(($in | format date '%m') | into int) / 3 | math ceil
|
||||||
|
}
|
||||||
|
|
||||||
|
def get-year []: datetime -> int {
|
||||||
|
$in | format date '%Y' | into int
|
||||||
|
}
|
||||||
3
autoload/assono-overtime-calc.nu
Normal file
3
autoload/assono-overtime-calc.nu
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export def lumen-assono-overtime-calc [startdate: datetime]: nothing -> string {
|
||||||
|
pwsh -command $'Invoke-assOrgaOvertimeCalculator ($startdate | format date '%d/%m/%Y')'
|
||||||
|
}
|
||||||
41
autoload/assono-worktime-calc.nu
Normal file
41
autoload/assono-worktime-calc.nu
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
export def lumen-assono-worktime-calc [datestr: string]: nothing -> string {
|
||||||
|
let $datestr = $datestr | str replace ' +' ' '
|
||||||
|
mut $dateArray = []
|
||||||
|
let $rawDateArray = $datestr | split row ' '
|
||||||
|
if (($rawDateArray | length) mod 2 == 1) {
|
||||||
|
mut $spliceCounter = true
|
||||||
|
for $i in $rawDateArray {
|
||||||
|
if ($spliceCounter) {
|
||||||
|
$dateArray = $dateArray | append $i
|
||||||
|
}
|
||||||
|
$spliceCounter = not $spliceCounter
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$dateArray = $rawDateArray
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($dateArray | length) mod 2 == 1) {
|
||||||
|
error make {msg: 'Uneven Times given!'}
|
||||||
|
}
|
||||||
|
|
||||||
|
mut $dateArrayOutput = []
|
||||||
|
mut $dateArrayOutputBuilderCounter = true
|
||||||
|
for $i in $dateArray {
|
||||||
|
$dateArrayOutput = $dateArrayOutput | append ($i | date from-human | format date '%H:%M')
|
||||||
|
if ($dateArrayOutputBuilderCounter) {
|
||||||
|
$dateArrayOutput = $dateArrayOutput | append '-'
|
||||||
|
} else {
|
||||||
|
$dateArrayOutput = $dateArrayOutput | append '|'
|
||||||
|
}
|
||||||
|
$dateArrayOutputBuilderCounter = not $dateArrayOutputBuilderCounter
|
||||||
|
}
|
||||||
|
let $dateArrayOutput = ($dateArrayOutput | drop 1) | str join ' '
|
||||||
|
|
||||||
|
# $dateArray[0]
|
||||||
|
mut $hours = 0min
|
||||||
|
while (($dateArray | length) > 0) {
|
||||||
|
$hours += ($dateArray | get 1 | into datetime) - ($dateArray | get 0 | into datetime)
|
||||||
|
$dateArray = $dateArray | skip 2
|
||||||
|
}
|
||||||
|
$"($dateArrayOutput)\n($hours | into string)"
|
||||||
|
}
|
||||||
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-4
|
||||||
|
}
|
||||||
11
autoload/kwin-get-class.nu
Normal file
11
autoload/kwin-get-class.nu
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
export def lumen-kwin-get-class [waittimesec: int]: nothing -> string {
|
||||||
|
if ($waittimesec == 0) {
|
||||||
|
qdbus6 org.kde.KWin /KWin queryWindowInfo
|
||||||
|
} else {
|
||||||
|
for $i in $waittimesec..1 {
|
||||||
|
$i | print
|
||||||
|
sleep 1sec
|
||||||
|
}
|
||||||
|
qdbus6 org.kde.KWin /KWin queryWindowInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
15
autoload/search-content.nu
Normal file
15
autoload/search-content.nu
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
export def lumen-search-content [searchstr: string]: any -> table {
|
||||||
|
let $tmp = (if ($in != null) {
|
||||||
|
$in
|
||||||
|
} else {
|
||||||
|
pwd
|
||||||
|
})
|
||||||
|
cd $tmp
|
||||||
|
ls -a **/* | par-each {|i|
|
||||||
|
{file: $i.name,
|
||||||
|
content: (if (($i | get type) == file ) {
|
||||||
|
try {open $i.name --raw | find $searchstr} catch {{}}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} | compact content -e
|
||||||
|
}
|
||||||
13
config.nu
13
config.nu
@@ -18,13 +18,8 @@
|
|||||||
# them for future reference.
|
# them for future reference.
|
||||||
|
|
||||||
$env.config.show_banner = false
|
$env.config.show_banner = false
|
||||||
|
$env.EDITOR = 'nvim'
|
||||||
export def lumen-search-content [searchstr = string]: any -> table {
|
$env.VISUAL = 'nvim'
|
||||||
ls -a **/* | par-each {|i|
|
if ((sys host).name !~ '.*Windows.*') {
|
||||||
{file: $i.name,
|
$env.SSH_AUTH_SOCK = '/home/lumen/.bitwarden-ssh-agent.sock'
|
||||||
content: (if (($i | get type) == file ) {
|
|
||||||
try {open $i.name --raw | find $searchstr} catch {|err| {}}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} | compact content -e
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user