Updated for nushell v0.83 and some changes in doom emacs config

Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
This commit is contained in:
TuDatTr
2023-07-29 16:16:29 +02:00
parent 48eace8cee
commit 5fa0681986
13 changed files with 98 additions and 194 deletions

View File

@@ -2,6 +2,6 @@
let filename = (date now | date format "%s")
while 1 == 1 {
(sudo tlp-stat -b | grep Charge | split column '=' | str trim ) | insert a (date now | date format "%s") | reject column1 | rename Charge Timestamp | to csv -n | str replace " \\[%\\]" "" |save -a $"$filename".csv;
(sudo tlp-stat -b | grep Charge | split column '=' | str trim ) | insert a (date now | date format "%s") | reject column1 | rename Charge Timestamp | to csv -n | str replace " \\[%\\]" "" | save -a $"($filename).csv";
sleep 50ms;
}

View File

@@ -0,0 +1,17 @@
# clean-nushell-db
#!/usr/bin/env nu
let db = "~/dotfiles/nushell/.config/nushell/history.sqlite3"
def get_current_row [] {
let current_row = (^sqlite3 $db "SELECT COUNT(*) FROM history h")
echo $"current rows: ($current_row)"
}
get_current_row
# Remove failed commands
sqlite3 $db "DELETE FROM history WHERE exit_status != 0"
# Remove duplicates. But keep one.
# https://stackoverflow.com/a/53693544/6000005
sqlite3 $db "DELETE FROM history WHERE id NOT IN (SELECT MIN(id) FROM history h GROUP BY command_line);"
get_current_row