1
0

9 Commits

8 changed files with 144 additions and 4 deletions
+2
View File
@@ -0,0 +1,2 @@
env.nu
history.txt
-4
View File
@@ -1,4 +0,0 @@
# Luminiferous Dotfiles
All dotfiles are in their respective Branches.
Pull with `git clone -b <branch> --single-branch https://git.luminiferous.eu/Luminiferous/dotfiles.git`
+52
View File
@@ -0,0 +1,52 @@
export def lumen-assono-backup-nexttape [dateinput: datetime]: nothing -> nothing {
$dateinput | get-backup-string
print 'Next Required Tape:'
print $'($dateinput | get-backup-string)'
print ''
print 'Tapes after that:'
..9 | each {|i|
print $'($i): (($dateinput + ((7 * $i) | into duration -u day)) | get-backup-string)'
}
}
def get-backup-string []: datetime -> string {
print $in
let saturdayOfMonth = $in | get-week-of-month 6
let monthOfQuarter = $in | get-month-of-quarter
let quarter = $in | get-quarter
let year = $in | get-year
if ($saturdayOfMonth == 1) {
if ($monthOfQuarter == 1) {
if ($quarter == 1) {
$'TapeLTO5-Y($year)'
} else {
$'TapeLTO5-Q($quarter)'
}
} else {
$'TapeLTO5-M($monthOfQuarter)'
}
} else {
$'TapeLTO5-W($saturdayOfMonth)'
}
}
def get-week-of-month [weekdayindex: int]: datetime -> int {
($in + ($weekdayindex | into duration -u day) - (($in | format date '%w' ) | into duration -u day)) | format date %w
}
def get-month-of-quarter []: datetime -> int {
mut month = $in | format date '%m' | into int
while ($month > 3) {
$month -= 3
}
$month
}
def get-quarter []: datetime -> int {
(($in | format date '%m') | into int) / 3 | math ceil
}
def get-year []: datetime -> int {
$in | format date '%Y'
}
+3
View 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
View 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)"
}
+9
View File
@@ -0,0 +1,9 @@
export def lumen-kwin-get-class [waittimesec: int]: nothing -> string {
mut timer = $waittimesec
while ($timer > 0) {
$timer | print
$timer -= 1
sleep 1sec
}
qdbus6 org.kde.KWin /KWin queryWindowInfo
}
+15
View File
@@ -0,0 +1,15 @@
export def lumen-search-content [searchstr: string]: any -> table {
let $tmp = $in
mut $path = pwd
if ($tmp != null) {
$path = $tmp
}
cd $path
ls -a **/* | par-each {|i|
{file: $i.name,
content: (if (($i | get type) == file ) {
try {open $i.name --raw | find $searchstr} catch {|err| {}}
})
}
} | compact content -e
}
+22
View File
@@ -0,0 +1,22 @@
# config.nu
#
# Installed by:
# version = "0.104.1"
#
# This file is used to override default Nushell settings, define
# (or import) custom commands, or run any other startup tasks.
# See https://www.nushell.sh/book/configuration.html
#
# This file is loaded after env.nu and before login.nu
#
# You can open this file in your default editor using:
# config nu
#
# See `help config nu` for more options
#
# You can remove these comments if you want or leave
# them for future reference.
$env.config.show_banner = false
$env.EDITOR = 'hx'
$env.VISUAL = 'hx'