mirror of
https://github.com/kmein/niveum
synced 2026-03-22 21:01:07 +01:00
Compare commits
30 Commits
b07d74c72a
...
bc51c93740
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc51c93740 | ||
| b5232c1d81 | |||
| e1b1458bb0 | |||
| 1c05cccac0 | |||
| 0f80e80d1f | |||
| 06baeb8f1b | |||
| 3b08c19e02 | |||
| 5ad8f2843d | |||
| af3c018cc1 | |||
| 2493206ff9 | |||
| 985ff45e17 | |||
| ee373fcf3d | |||
| 04993972ce | |||
| 972b810d23 | |||
| 34576b51bc | |||
| 5c1f29f2e7 | |||
| bce13c9306 | |||
| b9a3ed40d6 | |||
| 9a11a00e4f | |||
| 5fa7957978 | |||
| 38946d1c20 | |||
| fe07e13848 | |||
| d06a27431c | |||
| e3a6b9ee03 | |||
| 9a2f03beaf | |||
| 5a247d68a0 | |||
| 88a2ace2e0 | |||
| ce17c069e5 | |||
| 4c730f9730 | |||
| 39847fc8fe |
29
.bin/anki-poem.sh
Executable file
29
.bin/anki-poem.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
file="${1?please supply a poetry file}"
|
||||
[ -f "$file" ] || {
|
||||
echo "'$file' is no file"
|
||||
exit 1
|
||||
}
|
||||
|
||||
poem="$(mktemp)"
|
||||
clean () {
|
||||
rm "$poem"
|
||||
}
|
||||
trap clean EXIT
|
||||
sed '/^$/d' "$file" > "$poem"
|
||||
|
||||
htmlize() {
|
||||
awk 'ORS="<br/>"' \
|
||||
| head -c -5 # remove final <br/> characters
|
||||
}
|
||||
|
||||
for line_number in $(seq 1 "$(wc -l "$poem" | cut -d' ' -f1)"); do
|
||||
if [ "$line_number" -gt 3 ] && [ "$line_number" -gt 1 ]; then
|
||||
sed -n "$((line_number - 3)),$((line_number - 1))p" "$poem"
|
||||
else
|
||||
sed -n "1,$((line_number - 1))p" "$poem"
|
||||
fi | htmlize
|
||||
printf '\t'
|
||||
sed -n "${line_number},+1p" "$poem" | htmlize
|
||||
printf '\n'
|
||||
done
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
hora reg 'fillidefilla' -O csv \
|
||||
-b "$(date -d "$(date +%Y-%m)-20 last month" +%Y-%m-%d)" \
|
||||
-e "$(date -d "$(date +%Y-%m)-19" +%Y-%m-%d)" \
|
||||
| sed 's/(fillidefilla:\(.*\))/\1/g' \
|
||||
| xsv select date,amount,total,account,description
|
||||
26
.bin/watson2fdf.sh
Executable file
26
.bin/watson2fdf.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
project=Filli
|
||||
year=2022
|
||||
|
||||
for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
|
||||
from="$(date +%F -d "$month 1, $year")"
|
||||
to="$(date +%F -d "$month 1, $year + 1 month")"
|
||||
watson report --json --from "$from" --to "$to" --project "$project"
|
||||
done | jq --slurp '
|
||||
def in_array($arr):
|
||||
. as $value | any($arr[]; . == $value);
|
||||
|
||||
map(
|
||||
["engadin-app","fysiweb","val-muestair","mia-engiadina","ol"] as $official_projects
|
||||
| (.timespan.from | .[0:7]) as $timespan
|
||||
| .projects | .[0]
|
||||
| .time as $total_time
|
||||
| .tags
|
||||
| select(. != null)
|
||||
| map(select(.name | in_array($official_projects)))
|
||||
| (map(.time)|add) as $official_time
|
||||
| map({key:.name, value:.time}) | from_entries
|
||||
| .other |= ($total_time - $official_time)
|
||||
| map_values(. / (60*60) | ceil)
|
||||
| .month |= $timespan
|
||||
)
|
||||
'
|
||||
@@ -1,5 +1,4 @@
|
||||
{pkgs, ...}: {
|
||||
nixpkgs.config.joypixels.acceptLicense = true;
|
||||
fonts = {
|
||||
enableDefaultFonts = true;
|
||||
fontDir.enable = true;
|
||||
@@ -13,6 +12,7 @@
|
||||
corefonts
|
||||
crimson
|
||||
eb-garamond
|
||||
font-awesome_6
|
||||
etBook
|
||||
ezra-sil
|
||||
fira
|
||||
@@ -21,10 +21,8 @@
|
||||
gentium
|
||||
gfs-fonts
|
||||
gyre-fonts
|
||||
ia-writer-duospace
|
||||
ibm-plex
|
||||
jetbrains-mono
|
||||
joypixels
|
||||
libertinus
|
||||
libre-bodoni
|
||||
lmodern
|
||||
@@ -32,6 +30,8 @@
|
||||
ocr-a
|
||||
roboto
|
||||
roboto-mono
|
||||
noto-fonts
|
||||
noto-fonts-emoji
|
||||
roboto-slab
|
||||
scheherazade-new
|
||||
source-code-pro
|
||||
@@ -43,13 +43,11 @@
|
||||
vollkorn
|
||||
zilla-slab
|
||||
]; # google-fonts league-of-moveable-type
|
||||
fontconfig.defaultFonts = let
|
||||
emojiFont = "JoyPixels";
|
||||
in {
|
||||
monospace = ["JetBrains Mono" emojiFont];
|
||||
serif = ["Merriweather"];
|
||||
sansSerif = ["Cantarell" emojiFont];
|
||||
emoji = [emojiFont];
|
||||
fontconfig.defaultFonts = {
|
||||
monospace = ["Noto Sans Mono"];
|
||||
serif = ["Noto Serif" "Noto Naskh Arabic" "Noto Serif Devanagari"];
|
||||
sansSerif = ["Noto Sans Display" "Noto Kufi Arabic" "Noto Sans Devanagari"];
|
||||
emoji = ["Noto Color Emoji" "Noto Emoji"];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
(pkgs.writers.writeDashBin "hora" ''
|
||||
${pkgs.hledger}/bin/hledger -f "${timeLedger}" "$@"
|
||||
'')
|
||||
(pkgs.writers.writeDashBin "hora-filli" ''
|
||||
${pkgs.hledger}/bin/hledger -f "${timeLedger}" register fillidefilla -O csv \
|
||||
-b "$(date -d "$(date +%Y-%m)-20 last month" +%Y-%m-%d)" \
|
||||
-e "$(date -d "$(date +%Y-%m)-20" +%Y-%m-%d)" \
|
||||
| sed 's/(fillidefilla:\(.*\))/\1/g' \
|
||||
| xsv select date,amount,total,account,description
|
||||
'')
|
||||
];
|
||||
|
||||
niveum.hledger = {
|
||||
|
||||
@@ -152,7 +152,7 @@ in {
|
||||
{
|
||||
workspaceButtons = false;
|
||||
fonts = {
|
||||
names = ["Sans"];
|
||||
names = ["Monospace" "Font Awesome 6 Free"];
|
||||
size = 8.0;
|
||||
};
|
||||
mode = "hide"; # "dock"
|
||||
@@ -250,7 +250,7 @@ in {
|
||||
fi
|
||||
''
|
||||
}";
|
||||
"${modifier}+p" = "exec --no-startup-id ${pkgs.pass}/bin/passmenu -l 5";
|
||||
"${modifier}+p" = "exec --no-startup-id ${pkgs.rofi-pass}/bin/rofi-pass";
|
||||
"${modifier}+u" = "exec ${pkgs.scripts.unicodmenu}/bin/unicodmenu";
|
||||
|
||||
"${modifier}+F6" = "exec ${pkgs.xorg.xkill}/bin/xkill";
|
||||
|
||||
@@ -5,136 +5,22 @@
|
||||
}: let
|
||||
mainMailbox = "posteo";
|
||||
|
||||
accounts.uni = {
|
||||
user = "meinhark";
|
||||
password = lib.strings.fileContents <secrets/eduroam/password>;
|
||||
address = "kieran.felix.meinhardt@hu-berlin.de";
|
||||
imap = "mailbox.cms.hu-berlin.de";
|
||||
smtp = "mailhost.cms.hu-berlin.de";
|
||||
smtpSettings = smtp: "smtp://${smtp}";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
accounts.uni-old = {
|
||||
user = "meinhark";
|
||||
password = lib.strings.fileContents <secrets/eduroam/password>;
|
||||
address = "meinhark@informatik.hu-berlin.de";
|
||||
imap = "mailbox.informatik.hu-berlin.de";
|
||||
smtp = "mailhost.informatik.hu-berlin.de";
|
||||
smtpSettings = smtp: "smtp://${smtp}";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
accounts.work-uni = {
|
||||
user = "meinhaki";
|
||||
password = lib.strings.fileContents <secrets/mail/meinhaki>;
|
||||
address = "kieran.meinhardt@hu-berlin.de";
|
||||
imap = "mailbox.cms.hu-berlin.de";
|
||||
smtp = "mailhost.cms.hu-berlin.de";
|
||||
smtpSettings = smtp: "smtp://${smtp}";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
accounts.work-admin = {
|
||||
user = "dslalewa";
|
||||
password = lib.strings.fileContents <secrets/mail/dslalewa>;
|
||||
address = "admin.alew.vglsprwi@hu-berlin.de";
|
||||
imap = "mailbox.cms.hu-berlin.de";
|
||||
smtp = "mailhost.cms.hu-berlin.de";
|
||||
smtpSettings = smtp: "smtp://${smtp}";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
accounts.work-fysi = rec {
|
||||
user = "kieran@fysi.tech";
|
||||
address = user;
|
||||
password = lib.strings.fileContents <secrets/mail/fastmail>;
|
||||
imap = "imap.fastmail.com";
|
||||
smtp = "smtp.fastmail.com";
|
||||
smtpSettings = smtp: "smtps://${smtp}:465";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
accounts.cock = rec {
|
||||
user = "2210@cock.li";
|
||||
address = user;
|
||||
password = lib.strings.fileContents <secrets/mail/cock>;
|
||||
imap = "mail.cock.li";
|
||||
smtp = imap;
|
||||
smtpSettings = smtp: "smtp://${smtp}:587";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
accounts."${mainMailbox}" = rec {
|
||||
user = "kieran.meinhardt@posteo.net";
|
||||
address = user;
|
||||
password = lib.strings.fileContents <secrets/mail/posteo>;
|
||||
imap = "posteo.de";
|
||||
smtp = imap;
|
||||
smtpSettings = smtp: "smtp://${smtp}";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
accounts.google-amro = rec {
|
||||
user = "amroplay@gmail.com";
|
||||
address = user;
|
||||
password = lib.strings.fileContents <secrets/mail/gmail/amroplay>;
|
||||
imap = "imap.gmail.com";
|
||||
smtp = "smtp.gmail.com";
|
||||
smtpSettings = smtp: "smtps://${smtp}:465";
|
||||
folders = {
|
||||
drafts = "[Gmail]/Drafts";
|
||||
sent = "[Gmail]/Sent Mail";
|
||||
trash = "[Gmail]/Bin";
|
||||
};
|
||||
};
|
||||
|
||||
accounts.google-kieran = rec {
|
||||
user = "kieran.meinhardt@gmail.com";
|
||||
address = user;
|
||||
password = lib.strings.fileContents <secrets/mail/gmail/kieran.meinhardt>;
|
||||
imap = "imap.gmail.com";
|
||||
smtp = "smtp.gmail.com";
|
||||
smtpSettings = smtp: "smtps://${smtp}:465";
|
||||
folders = {
|
||||
drafts = "[Gmail]/Entwürfe";
|
||||
sent = "[Gmail]/Gesendet";
|
||||
trash = "[Gmail]/Papierkorb";
|
||||
};
|
||||
};
|
||||
accounts = import <niveum/lib/email.nix> {inherit lib mainMailbox;};
|
||||
in {
|
||||
environment.systemPackages = [pkgs.neomutt];
|
||||
environment.shellAliases.mua = "${pkgs.neomutt}/bin/neomutt -f ${mainMailbox}←";
|
||||
|
||||
home-manager.users.me.xdg.configFile."neomutt/neomuttrc".text = ''
|
||||
home-manager.users.me.xdg.configFile."neomutt/neomuttrc".text = let
|
||||
as-pdf = pkgs.writers.writeDash "as-pdf" ''
|
||||
d=$(mktemp -d)
|
||||
trap clean EXIT
|
||||
clean() {
|
||||
rm -rf "$d"
|
||||
}
|
||||
${pkgs.libreoffice}/bin/libreoffice --headless --convert-to pdf "$1" --outdir "$d"
|
||||
${pkgs.zathura}/bin/zathura "$d"/*.pdf
|
||||
'';
|
||||
in ''
|
||||
set mailcap_path = ${
|
||||
pkgs.writeText "mailcap" ''
|
||||
text/plain; $EDITOR %s ;
|
||||
@@ -145,6 +31,8 @@ in {
|
||||
application/pdf; ${pkgs.zathura}/bin/zathura %s ;
|
||||
application/pgp-encrypted; ${pkgs.gnupg}/bin/gpg -d '%s'; copiousoutput;
|
||||
application/pgp-keys; ${pkgs.gnupg}/bin/gpg --import '%s'; copiousoutput;
|
||||
application/vnd.openxmlformats-officedocument.wordprocessingml.document; ${as-pdf} %s;
|
||||
application/vnd.oasis.opendocument.text; ${as-pdf} %s;
|
||||
application/vnd.openxmlformats*; ${pkgs.libreoffice}/bin/soffice '%s';
|
||||
''
|
||||
}:$mailcap_path
|
||||
@@ -227,11 +115,11 @@ in {
|
||||
color index red default '.*'
|
||||
color index_flags lightcyan default '.*'
|
||||
color index_author yellow default '.*'
|
||||
color index_subject lightblack default '.*'
|
||||
color index_subject white default '.*'
|
||||
|
||||
# New mail is boldened:
|
||||
color index_author lightyellow black "~N"
|
||||
color index_subject lightwhite black "~N"
|
||||
color index_author lightyellow default "~N"
|
||||
color index_subject lightwhite default "~N"
|
||||
|
||||
# Flagged mail is highlighted:
|
||||
color index_flags lightmagenta default '~F'
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
save-path ${newsboat-home}/saved/
|
||||
|
||||
highlight all "---.*---" yellow default
|
||||
highlight feedlist ".*(0/0))" black default
|
||||
# highlight feedlist ".*(0/0))" default default
|
||||
highlight article "^Title:.*" yellow default bold
|
||||
highlight article "^Author:.*" yellow default
|
||||
highlight article "^Flags:.*" red default
|
||||
@@ -58,14 +58,12 @@
|
||||
highlight article "\\[image [0-9][0-9]*\\]" color109 default bold
|
||||
highlight article "\\[embedded flash: [0-9][0-9]*\\]" color66 default bold
|
||||
|
||||
color background white default
|
||||
color listnormal white default
|
||||
color listnormal_unread white default bold
|
||||
color listfocus blue default
|
||||
color listfocus_unread blue default bold
|
||||
color info red default bold
|
||||
color article white default
|
||||
'';
|
||||
|
||||
newsboat-sql = "${pkgs.sqlite}/bin/sqlite3 ${newsboat-home}/cache.db";
|
||||
in {
|
||||
nixpkgs.config.packageOverrides = pkgs: {
|
||||
newsboat = pkgs.writers.writeDashBin "newsboat" ''
|
||||
@@ -76,15 +74,22 @@ in {
|
||||
environment.systemPackages = [
|
||||
pkgs.newsboat
|
||||
(pkgs.writers.writeDashBin "newsboat-unread-count" ''
|
||||
printf "🆕"
|
||||
if [ -f ${newsboat-home}/cache.db.lock ]; then
|
||||
echo ↻
|
||||
${pkgs.jq}/bin/jq -n '{state: "Info", text: "↻", icon: "update"}'
|
||||
else
|
||||
${pkgs.sqlite}/bin/sqlite3 ${newsboat-home}/cache.db "SELECT COUNT(DISTINCT id) FROM rss_item WHERE unread=1"
|
||||
|
||||
${pkgs.jq}/bin/jq -n \
|
||||
--argjson unread "$(${newsboat-sql} "SELECT COUNT(DISTINCT id) FROM rss_item WHERE unread=1")" \
|
||||
--argjson watchLater "$(${newsboat-sql} "SELECT COUNT(DISTINCT id) FROM rss_item WHERE flags='e' AND deleted=0")" \
|
||||
'{
|
||||
state: (if $unread > 0 then "Good" else "Idle" end),
|
||||
text: (if $unread > 0 then "\($unread)" else "[\($watchLater)]" end),
|
||||
icon: "rss"
|
||||
}'
|
||||
fi
|
||||
'')
|
||||
(pkgs.writers.writeDashBin "mpv-watch-later" ''
|
||||
${pkgs.sqlite}/bin/sqlite3 ${newsboat-home}/cache.db "SELECT url FROM rss_item WHERE flags='e' AND deleted=0 ORDER BY pubDate DESC" \
|
||||
${newsboat-sql} "SELECT url FROM rss_item WHERE flags='e' AND deleted=0 ORDER BY pubDate DESC" \
|
||||
| ${pkgs.findutils}/bin/xargs ${pkgs.mpv}/bin/mpv
|
||||
'')
|
||||
];
|
||||
|
||||
@@ -95,6 +95,7 @@ in {
|
||||
dos2unix
|
||||
genpass # generate passwords
|
||||
ncdu # ncurses disk usage
|
||||
rmlint # remove duplicate files
|
||||
python3Packages.jsonschema # json validation
|
||||
jq # json toolkit
|
||||
pup # html toolkit
|
||||
@@ -151,6 +152,7 @@ in {
|
||||
scripts.showkeys-toggle
|
||||
scripts.kirciuoklis
|
||||
scripts.favicon
|
||||
scripts.heuretes
|
||||
scripts.ipa # XSAMPA to IPA converter
|
||||
scripts.playlist
|
||||
scripts.mpv-tv
|
||||
|
||||
38
flake.lock
generated
38
flake.lock
generated
@@ -23,11 +23,11 @@
|
||||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660330190,
|
||||
"narHash": "sha256-RgQUtZGmdb9fRkdBcI8x1KYuykbQCBaeY6ejFls7hFM=",
|
||||
"lastModified": 1660574517,
|
||||
"narHash": "sha256-Lp5D2pAPrM3iAc1eeR0iGwz5rM+SYOWzVxI3p17nlrU=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "8675cfa549e1240c9d2abb1c878bc427eefcf926",
|
||||
"rev": "688e5c85b7537f308b82167c8eb4ecfb70a49861",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -110,11 +110,11 @@
|
||||
},
|
||||
"nixos-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1660318005,
|
||||
"narHash": "sha256-g9WCa9lVUmOV6dYRbEPjv/TLOR5hamjeCcKExVGS3OQ=",
|
||||
"lastModified": 1660926553,
|
||||
"narHash": "sha256-19Ib1b7Ny+yGhnxwnH1KhhB2hvALuNuqevA6XzqkQmo=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5c211b47aeadcc178c5320afd4e74c7eed5c389f",
|
||||
"rev": "00e376e3f3c22d991052dfeaf154c42b09deeb29",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -126,11 +126,11 @@
|
||||
},
|
||||
"nixos-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1660305968,
|
||||
"narHash": "sha256-r0X1pZCSEA6mzt5OuTA7nHuLmvnbkwgpFAh1iLIx4GU=",
|
||||
"lastModified": 1660908602,
|
||||
"narHash": "sha256-SwZ85IPWvC4NxxFhWhRMTJpApSHbY1u4YK2UFWEBWvY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c4a0efdd5a728e20791b8d8d2f26f90ac228ee8d",
|
||||
"rev": "495b19d5b3e62b4ec7e846bdfb6ef3d9c3b83492",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -159,11 +159,11 @@
|
||||
"retiolum": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1660160907,
|
||||
"narHash": "sha256-1L1VGeal30XJv8EJnVHKAJmaQkaTeZwIO54rq/5gxnk=",
|
||||
"lastModified": 1660680907,
|
||||
"narHash": "sha256-D6XkykgU1BiDAnnFG9NwSqBRKCZAHK+2+Ri2/m9rzo8=",
|
||||
"owner": "krebs",
|
||||
"repo": "retiolum",
|
||||
"rev": "93b1b32211ca41d23487e8cf7c30ed903ab9d186",
|
||||
"rev": "c4d6b07be29b3b9267027ed25792a2cb350459d5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -195,11 +195,11 @@
|
||||
"scripts": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1658436738,
|
||||
"narHash": "sha256-y075C4CE543ZdKPl1Byz8EPn67jbA59Z0bIsixNFsso=",
|
||||
"lastModified": 1660677220,
|
||||
"narHash": "sha256-cCmyI4CigWbeQ0wEiE9HSI2Hmd3Wi5P7jhdHX6bJkXU=",
|
||||
"owner": "kmein",
|
||||
"repo": "scripts",
|
||||
"rev": "d5a38cf84e3f528641b1b10d9f33cf8bfcd5a52a",
|
||||
"rev": "688e141047e831a7e5f58dd24e00de51a3cb2345",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -211,11 +211,11 @@
|
||||
"stockholm": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1660135264,
|
||||
"narHash": "sha256-F2L0osJCjmqkXddDVSBdBanq06XUBQoKXPf4iRJUKYA=",
|
||||
"lastModified": 1660682075,
|
||||
"narHash": "sha256-2Q0j7FiYao0VDRKnW1jSLJu3Cn/ORz/pPsyW+wwWoEU=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "7ce87f5fdb602de7638b2df237e891e6038907ac",
|
||||
"revCount": 10727,
|
||||
"rev": "9ae4a08ccc07964decc51fb1e92bc35d49e4691c",
|
||||
"revCount": 10732,
|
||||
"type": "git",
|
||||
"url": "https://cgit.lassul.us/stockholm"
|
||||
},
|
||||
|
||||
131
lib/email.nix
Normal file
131
lib/email.nix
Normal file
@@ -0,0 +1,131 @@
|
||||
{
|
||||
lib,
|
||||
mainMailbox ? "posteo",
|
||||
...
|
||||
}: {
|
||||
uni = {
|
||||
user = "meinhark";
|
||||
password = lib.strings.fileContents <secrets/eduroam/password>;
|
||||
address = "kieran.felix.meinhardt@hu-berlin.de";
|
||||
imap = "mailbox.cms.hu-berlin.de";
|
||||
smtp = "mailhost.cms.hu-berlin.de";
|
||||
smtpSettings = smtp: "smtp://${smtp}";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
uni-old = {
|
||||
user = "meinhark";
|
||||
password = lib.strings.fileContents <secrets/eduroam/password>;
|
||||
address = "meinhark@informatik.hu-berlin.de";
|
||||
imap = "mailbox.informatik.hu-berlin.de";
|
||||
smtp = "mailhost.informatik.hu-berlin.de";
|
||||
smtpSettings = smtp: "smtp://${smtp}";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
work-uni = {
|
||||
user = "meinhaki";
|
||||
password = lib.strings.fileContents <secrets/mail/meinhaki>;
|
||||
address = "kieran.meinhardt@hu-berlin.de";
|
||||
imap = "mailbox.cms.hu-berlin.de";
|
||||
smtp = "mailhost.cms.hu-berlin.de";
|
||||
smtpSettings = smtp: "smtp://${smtp}";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
work-admin = {
|
||||
user = "dslalewa";
|
||||
password = lib.strings.fileContents <secrets/mail/dslalewa>;
|
||||
address = "admin.alew.vglsprwi@hu-berlin.de";
|
||||
imap = "mailbox.cms.hu-berlin.de";
|
||||
smtp = "mailhost.cms.hu-berlin.de";
|
||||
smtpSettings = smtp: "smtp://${smtp}";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
work-fysi = rec {
|
||||
user = "kieran@fysi.tech";
|
||||
address = user;
|
||||
password = lib.strings.fileContents <secrets/mail/fastmail>;
|
||||
imap = "imap.fastmail.com";
|
||||
smtp = "smtp.fastmail.com";
|
||||
smtpSettings = smtp: "smtps://${smtp}:465";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
cock = rec {
|
||||
user = "2210@cock.li";
|
||||
address = user;
|
||||
password = lib.strings.fileContents <secrets/mail/cock>;
|
||||
imap = "mail.cock.li";
|
||||
smtp = imap;
|
||||
smtpSettings = smtp: "smtp://${smtp}:587";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
"${mainMailbox}" = rec {
|
||||
user = "kieran.meinhardt@posteo.net";
|
||||
address = user;
|
||||
password = lib.strings.fileContents <secrets/mail/posteo>;
|
||||
imap = "posteo.de";
|
||||
smtp = imap;
|
||||
smtpSettings = smtp: "smtp://${smtp}";
|
||||
folders = {
|
||||
drafts = "Drafts";
|
||||
sent = "Sent";
|
||||
trash = "Trash";
|
||||
};
|
||||
};
|
||||
|
||||
google-amro = rec {
|
||||
user = "amroplay@gmail.com";
|
||||
address = user;
|
||||
password = lib.strings.fileContents <secrets/mail/gmail/amroplay>;
|
||||
imap = "imap.gmail.com";
|
||||
smtp = "smtp.gmail.com";
|
||||
smtpSettings = smtp: "smtps://${smtp}:465";
|
||||
folders = {
|
||||
drafts = "[Gmail]/Drafts";
|
||||
sent = "[Gmail]/Sent Mail";
|
||||
trash = "[Gmail]/Bin";
|
||||
};
|
||||
};
|
||||
|
||||
google-kieran = rec {
|
||||
user = "kieran.meinhardt@gmail.com";
|
||||
address = user;
|
||||
password = lib.strings.fileContents <secrets/mail/gmail/kieran.meinhardt>;
|
||||
imap = "imap.gmail.com";
|
||||
smtp = "smtp.gmail.com";
|
||||
smtpSettings = smtp: "smtps://${smtp}:465";
|
||||
folders = {
|
||||
drafts = "[Gmail]/Entwürfe";
|
||||
sent = "[Gmail]/Gesendet";
|
||||
trash = "[Gmail]/Papierkorb";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -10,17 +10,8 @@
|
||||
pkgs.writers.writeDash "setsid-command" ''
|
||||
${pkgs.utillinux}/bin/setsid ${script}
|
||||
'';
|
||||
coronaBlock = {
|
||||
block = "custom";
|
||||
interval = 60 * 2; # every two minutes
|
||||
command = pkgs.writers.writeDash "corona" ''
|
||||
${pkgs.curl}/bin/curl https://corona-stats.online/germany \
|
||||
| ${pkgs.gnugrep}/bin/grep Germany \
|
||||
| ${pkgs.gnused}/bin/sed 's/\s*//g' \
|
||||
| ${pkgs.ansifilter}/bin/ansifilter \
|
||||
| ${pkgs.gawk}/bin/awk -F'│' '{print "🤒 " $8 " 💀 " $5}'
|
||||
'';
|
||||
};
|
||||
|
||||
accounts = import <niveum/lib/email.nix> {inherit lib;};
|
||||
in {
|
||||
theme = {
|
||||
name = "plain";
|
||||
@@ -28,7 +19,7 @@ in {
|
||||
critical_fg = colours.red.bright;
|
||||
good_fg = colours.green.bright;
|
||||
idle_fg = colours.foreground;
|
||||
info_fg = colours.foreground;
|
||||
info_fg = colours.cyan.bright;
|
||||
warning_fg = colours.yellow.bright;
|
||||
warning_bg = colours.background;
|
||||
alternating_tint_bg = colours.background;
|
||||
@@ -37,59 +28,14 @@ in {
|
||||
good_bg = colours.background;
|
||||
idle_bg = colours.background;
|
||||
info_bg = colours.background;
|
||||
separator = "/ ";
|
||||
separator = "";
|
||||
separator_bg = "auto";
|
||||
separator_fg = colours.black.bright;
|
||||
};
|
||||
};
|
||||
icons = {
|
||||
name = "none";
|
||||
overrides = {
|
||||
bat = "🔋";
|
||||
bat_charging = "🔌";
|
||||
bat_discharging = "🔋";
|
||||
bat_empty = " ";
|
||||
bat_full = " ";
|
||||
bat_half = " ";
|
||||
bat_quarter = " ";
|
||||
bat_three_quarters = " ";
|
||||
cogs = "🚦 ";
|
||||
cpu = "🖥 ";
|
||||
disk_drive = "💽";
|
||||
mail = "📧 ";
|
||||
memory_mem = "🧠 ";
|
||||
music = "🎵";
|
||||
music_next = "⏭";
|
||||
music_pause = "";
|
||||
music_play = "▶";
|
||||
music_prev = "⏮";
|
||||
net_down = "❎";
|
||||
net_up = "🌐";
|
||||
net_vpn = "🛡 ";
|
||||
net_wired = "🌐";
|
||||
net_wireless = "📶";
|
||||
pomodoro = "🍅 ";
|
||||
time = "📅 ";
|
||||
toggle_off = "👎";
|
||||
toggle_on = "👍";
|
||||
volume_empty = "🔈 ";
|
||||
volume_full = "🔊 ";
|
||||
volume_half = "🔉 ";
|
||||
volume_muted = "🔇";
|
||||
weather_clouds = "🌥";
|
||||
weather_default = "🌡";
|
||||
weather_rain = "🌧";
|
||||
weather_snow = "🌨";
|
||||
weather_sun = "🌣";
|
||||
weather_thunder = "🌩";
|
||||
};
|
||||
};
|
||||
icons.name = "awesome6";
|
||||
icons.overrides.rss = "";
|
||||
block = [
|
||||
{
|
||||
block = "custom";
|
||||
interval = 5;
|
||||
command = "newsboat-unread-count";
|
||||
}
|
||||
{
|
||||
block = "weather";
|
||||
autolocate = true;
|
||||
@@ -116,34 +62,84 @@ in {
|
||||
import astral.moon
|
||||
import astral.sun
|
||||
|
||||
moon_phases = {
|
||||
0: "🌑",
|
||||
3.5: "🌒",
|
||||
7: "🌓",
|
||||
10.5: "🌔",
|
||||
14: "🌕",
|
||||
17.5: "🌖",
|
||||
21: "🌗",
|
||||
24.5: "🌘",
|
||||
28: "🌑",
|
||||
}
|
||||
current_phase = astral.moon.phase()
|
||||
closest_phase = min(moon_phases.keys(), key=lambda x: abs(current_phase - x))
|
||||
|
||||
city = astral.LocationInfo("Berlin", "Germany", "${spacetime.time.timeZone}", ${toString spacetime.location.latitude}, ${toString spacetime.location.longitude})
|
||||
sun = astral.sun.sun(city.observer, date=astral.today(), tzinfo=city.timezone)
|
||||
|
||||
print("🌅 {} 🌇 {} {} {}".format(sun["sunrise"].strftime("%R"), sun["sunset"].strftime("%R"), moon_phases[closest_phase], round(current_phase, 1)))
|
||||
print("↑{} ↓{} {}{}".format(sun["sunrise"].strftime("%R"), sun["sunset"].strftime("%R"), "☽" if current_phase < 14 else "☾", round(current_phase, 1)))
|
||||
'';
|
||||
}
|
||||
{
|
||||
block = "custom";
|
||||
interval = 10;
|
||||
command = "newsboat-unread-count";
|
||||
json = true;
|
||||
}
|
||||
{
|
||||
block = "custom";
|
||||
interval = 10;
|
||||
command = pkgs.writers.writeDash "todo" ''
|
||||
${pkgs.todoman}/bin/todo --porcelain | ${pkgs.jq}/bin/jq -r '
|
||||
map(select(.due != null))
|
||||
| (map(select(.due < now)) | length) as $overdue
|
||||
| (map(select(.due >= now and .due < now + (60 * 60 * 24))) | length) as $dueToday
|
||||
| {
|
||||
icon: "tasks",
|
||||
text: ($overdue + $dueToday) | tostring,
|
||||
state: (
|
||||
if $overdue > 0 then
|
||||
"Critical"
|
||||
elif $dueToday > 0 then
|
||||
"Warning"
|
||||
else
|
||||
"Idle"
|
||||
end
|
||||
)
|
||||
}
|
||||
'
|
||||
'';
|
||||
json = true;
|
||||
}
|
||||
{
|
||||
block = "custom";
|
||||
interval = 60 * 5;
|
||||
command = let
|
||||
query-account = account:
|
||||
pkgs.writers.writeDash "query-imap" ''
|
||||
${pkgs.curl}/bin/curl -sSL -u ${lib.escapeShellArg "${account.user}:${account.password}"} imaps://${account.imap} -X 'STATUS INBOX (UNSEEN)' \
|
||||
| ${pkgs.gnugrep}/bin/grep -Eo '[0-9]+'
|
||||
'';
|
||||
in
|
||||
pkgs.writers.writeDash "unread-mail" ''
|
||||
{
|
||||
${lib.concatMapStringsSep "\n" query-account (builtins.attrValues accounts)}
|
||||
} | jq -s '
|
||||
(. | add) as $sum
|
||||
| {
|
||||
text: $sum | tostring,
|
||||
icon: "mail",
|
||||
state: (
|
||||
if $sum > 5 then
|
||||
"Warning"
|
||||
elif $sum > 0 then
|
||||
"Info"
|
||||
else
|
||||
"Idle"
|
||||
end
|
||||
)
|
||||
}'
|
||||
'';
|
||||
json = true;
|
||||
}
|
||||
{
|
||||
block = "custom";
|
||||
interval = 5;
|
||||
command = pkgs.writers.writeDash "hu-berlin-vpn" ''
|
||||
PATH=${lib.makeBinPath [pkgs.systemd]}
|
||||
(systemctl is-active --quiet openvpn-hu-berlin.service && echo "🎓👍 (OpenVPN)") \
|
||||
|| (systemctl is-active --quiet hu-vpn.service && echo "🎓👍 (PPP+SSL)") \
|
||||
|| echo "🎓👎"
|
||||
(systemctl is-active --quiet openvpn-hu-berlin.service && echo "OVPN") \
|
||||
|| (systemctl is-active --quiet hu-vpn.service && echo "PPP-VPN") \
|
||||
|| :
|
||||
'';
|
||||
}
|
||||
{
|
||||
@@ -171,9 +167,35 @@ in {
|
||||
}
|
||||
{block = "load";}
|
||||
{
|
||||
block = "time";
|
||||
interval = 1;
|
||||
format = "%Y-%m-%d (%W %a) %H:%M";
|
||||
block = "custom";
|
||||
interval = 10;
|
||||
json = true;
|
||||
command = pkgs.writers.writeDash "time" ''
|
||||
${pkgs.jq}/bin/jq -n \
|
||||
--arg now "$(${pkgs.coreutils}/bin/date +'%Y-%m-%d (%W %a) %H:%M')" \
|
||||
--argjson nextEvent "$(
|
||||
${pkgs.khal}/bin/khal list --format "{start}" --day-format "" $(${pkgs.coreutils}/bin/date +'%Y-%m-%d %H:%M') 2>/dev/null \
|
||||
| ${pkgs.gnugrep}/bin/grep -E '[0-9]{2}:[0-9]{2}' \
|
||||
| ${pkgs.coreutils}/bin/head -1 \
|
||||
| ${pkgs.coreutils}/bin/date --date="$(cat)" +%s
|
||||
)" \
|
||||
'{
|
||||
text: $now,
|
||||
icon: "time",
|
||||
state: (
|
||||
($nextEvent - now) as $deltaT
|
||||
| if $deltaT < (5 * 60) then
|
||||
"Critical"
|
||||
elif $deltaT < (15 * 60) then
|
||||
"Warning"
|
||||
elif $deltaT < (60 * 60) then
|
||||
"Info"
|
||||
else
|
||||
"Idle"
|
||||
end
|
||||
)
|
||||
}'
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
const { createInterface } = require("readline");
|
||||
const Sanscript = require("@sanskrit-coders/sanscript");
|
||||
const Sanscript = require("@indic-transliteration/sanscript");
|
||||
|
||||
const rl = createInterface({
|
||||
input: process.stdin,
|
||||
@@ -9,5 +9,9 @@ const rl = createInterface({
|
||||
});
|
||||
|
||||
rl.on("line", (line) => {
|
||||
console.log(Sanscript.t(line, "hk", "devanagari"));
|
||||
console.log(
|
||||
Sanscript.t(line, "hk", "devanagari")
|
||||
.replace(/\.\./g, "॥")
|
||||
.replace(/[,.]/g, "।")
|
||||
);
|
||||
});
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
"bin": "devanagari.js",
|
||||
"author": "kmein",
|
||||
"devDependencies": {
|
||||
"@sanskrit-coders/sanscript": "^1.1.5"
|
||||
"@indic-transliteration/sanscript": "^1.2.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,20 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@sanskrit-coders/sanscript@^1.1.5":
|
||||
version "1.1.5"
|
||||
resolved "https://registry.yarnpkg.com/@sanskrit-coders/sanscript/-/sanscript-1.1.5.tgz#a22222cf7a5d55f7b19e210242c59f6f819fd643"
|
||||
integrity sha512-YA7MchP2CD2JnAOkj+ORDUFrISiPqx3muvhKvRO3KFOx9UfvpIdEUORoKWJ88lr1uH9T32jDxjns/MSclmDczA==
|
||||
"@indic-transliteration/common_maps@^1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@indic-transliteration/common_maps/-/common_maps-1.0.0.tgz#c1f1c893ae49e01fe498ef1877bdd0153bc90b42"
|
||||
integrity sha512-NUza2GKxc6/0YiWWew3qsFenEgksnFSZWvNGqyyKYnII9wZS/U+w1jY/yYN9aR+foA/rPymvckM2/hKv9Ow2dQ==
|
||||
|
||||
"@indic-transliteration/sanscript@^1.2.7":
|
||||
version "1.2.7"
|
||||
resolved "https://registry.yarnpkg.com/@indic-transliteration/sanscript/-/sanscript-1.2.7.tgz#c07aaa979f6d60fb0bbf35cdbd1d3bb1c487d931"
|
||||
integrity sha512-Jm5z+wWxMUlw6dGHK7BHQUBjRnVHmfidmB7NiTbkdKPP89BDOB16zIKvXZY5XTsvkXmcyqF+DbJqiB9zzUhDKA==
|
||||
dependencies:
|
||||
"@indic-transliteration/common_maps" "^1.0.0"
|
||||
toml "^2.3.6"
|
||||
|
||||
toml@^2.3.6:
|
||||
version "2.3.6"
|
||||
resolved "https://registry.yarnpkg.com/toml/-/toml-2.3.6.tgz#25b0866483a9722474895559088b436fd11f861b"
|
||||
integrity sha512-gVweAectJU3ebq//Ferr2JUY4WKSDe5N+z0FvjDncLGyHmIDoxgY/2Ie4qfEIDm4IS7OA6Rmdm7pdEEdMcV/xQ==
|
||||
|
||||
@@ -445,6 +445,16 @@ in
|
||||
ln -f $filename files
|
||||
'';
|
||||
|
||||
heuretes = let
|
||||
database = pkgs.fetchurl {
|
||||
url = "http://c.krebsco.de/greek.csv";
|
||||
hash = "sha256-SYL10kerNI0HzExG6JXh765+CBBCHLO95B6OKErQ/sU=";
|
||||
};
|
||||
in
|
||||
pkgs.writers.writeDashBin "heuretes" ''
|
||||
${pkgs.xsv}/bin/xsv search -s simple "^$*$" ${database} | ${pkgs.xsv}/bin/xsv table
|
||||
'';
|
||||
|
||||
# https://nitter.net/igor_chubin/status/1557793569104183298
|
||||
stackoverflow = pkgs.writers.writeDashBin "so" ''
|
||||
IFS=+
|
||||
|
||||
@@ -76,8 +76,14 @@ in
|
||||
# ref https://github.com/LukeSmithxyz/voidrice/blob/9fe6802122f6e0392c7fe20eefd30437771d7f8e/.local/bin/dmenuunicode
|
||||
writers.writeDashBin "unicodmenu" ''
|
||||
history_file=$HOME/.cache/unicodmenu
|
||||
PATH=${lib.makeBinPath [coreutils dmenu gnused libnotify xclip xdotool]}
|
||||
chosen=$(cat "$history_file" ${kaomoji-file} ${unicode-file} | dmenu -p unicode -i -l 10 | tee --append "$history_file" | sed "s/ .*//")
|
||||
PATH=${lib.makeBinPath [coreutils dmenu gawk gnused libnotify xclip xdotool]}
|
||||
|
||||
all_characters() {
|
||||
tac "$history_file"
|
||||
cat ${kaomoji-file} ${unicode-file}
|
||||
}
|
||||
|
||||
chosen=$(all_characters | awk '!seen[$0]++' | dmenu -p unicode -i -l 10 | tee --append "$history_file" | sed "s/ .*//")
|
||||
|
||||
[ "$chosen" != "" ] || exit
|
||||
|
||||
|
||||
Reference in New Issue
Block a user