1
0
mirror of https://github.com/kmein/niveum synced 2026-03-17 18:41:09 +01:00

6 Commits

14 changed files with 181 additions and 21 deletions

6
.bin/sample-pdf.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
filepath="$(shuf --head-count=1)"
pages="$(pdfinfo "$filepath" | awk '/^Pages:/{print $2}')"
random_page="$(shuf --input-range="1-$pages" --head-count=1)"
zathura --page="$random_page" "$filepath"

View File

@@ -1,9 +1,9 @@
{
"url": "https://github.com/nix-community/home-manager.git",
"rev": "ff2bed9dac84fb202bbb3c49fdcfe30c29d0b12f",
"date": "2021-10-18T10:01:08+02:00",
"path": "/nix/store/3805vd4bp5q28c83ik33c2vangq42lbd-home-manager",
"sha256": "122azyrkbp508a1yrhnq2ja2kj9whdmpb1qwgnmdaz87l02m0m26",
"rev": "bcf03fa16a1f06b8a0abb27bf49afa8d6fffe8f1",
"date": "2021-11-15T23:33:21+00:00",
"path": "/nix/store/6yb649xh4pm8n49azlg769imarkk2xpw-home-manager",
"sha256": "0nznlb2xgkvdav6d4qls2w81m3p3h4hdbwbp2nwqkiszkp7j1bln",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false

View File

@@ -1,9 +1,9 @@
{
"url": "https://github.com/mozilla/nixpkgs-mozilla",
"rev": "4c8fc3d7b625d2d34bfb5aedf03c131aef2f87f8",
"date": "2021-11-15T17:16:09+01:00",
"path": "/nix/store/cln0xias9nmrlqn290x3535hav2z7kl1-nixpkgs-mozilla",
"sha256": "0xp4wwzglgs5pw5fb2ryywqiq1cw3ji0zn701nn6ndxbfjsc2l1p",
"rev": "764ed9c9721f66c945d77d7b09fb8c1879ec67c6",
"date": "2021-11-16T09:46:48-05:00",
"path": "/nix/store/p75z3ihhdy7zxhnfqdj4mhzg9k0rfz7f-nixpkgs-mozilla",
"sha256": "0lkhaz4hciisvfhq8v2wlp019v6gg5vd4sf5vx3cj4d5b2zf0h4v",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false

View File

@@ -1,9 +1,9 @@
{
"url": "https://github.com/NixOS/nixpkgs.git",
"rev": "b0657ddc91101c625d2cba64b6b3d22350062f39",
"date": "2021-11-15T18:36:38+01:00",
"path": "/nix/store/vidd1nazd9m2v9djh8z1m7jc9c3dg91l-nixpkgs",
"sha256": "173klgdxj086iz8477kvq5y95f3hix87ra8v3xs4ddg66sm12nrp",
"rev": "8df865561fbc53922f1e801c3deeb53c12ce8c4f",
"date": "2021-11-18T22:15:39-08:00",
"path": "/nix/store/a4n904v45pl3zi8q59l77dha47v1mwl0-nixpkgs",
"sha256": "092ivyacs2iz2zb572jki2kdi6nylrm10caa0kv2hdfr5yjzs5w7",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false

View File

@@ -1,9 +1,9 @@
{
"url": "https://github.com/nix-community/NUR",
"rev": "ebf5ede213705809cb41ddb0cd4a2568b18c3d23",
"date": "2021-11-15T17:11:02+00:00",
"path": "/nix/store/n08kjjjsx193myprd029rgmwavgqqj2g-NUR",
"sha256": "02h737vr8r32kbqmm0z4fqc7pwkrjdj6q0mg5gzfjqqgyni75g2h",
"rev": "69746e0eb8efba6ed7776dd910c4ebc3bc85f6b6",
"date": "2021-11-19T05:31:00+00:00",
"path": "/nix/store/1lxn1j1dg20q5kh47jnq56a8yd1570xg-NUR",
"sha256": "03scqq7j7lywxzcy2qsyxiynms3jmiadvz825pwfwg5kg5p75m9c",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false

View File

@@ -17,6 +17,17 @@
services.nextcloud-client.enable = true;
};
environment.systemPackages = [
(pkgs.writers.writeDashBin "book" ''
set -efu
book="$({
${pkgs.findutils}/bin/find ${config.users.users.me.home}/cloud/syncthing/library -type f
${pkgs.findutils}/bin/find ${config.users.users.me.home}/cloud/Seafile/Books -type f
} | ${pkgs.fzf}/bin/fzf)"
${pkgs.zathura}/bin/zathura "$book"
'')
];
fileSystems."/media/moodle" = {
device = "zaatar.r:/moodle";
fsType = "nfs";

View File

@@ -157,6 +157,7 @@ in {
scripts.wttr
scripts.sanskrit-dictionary
scripts.unicodmenu
scripts.horoscope
scripts.closest
scripts.trans
scripts.liddel-scott-jones

View File

@@ -92,6 +92,11 @@ in {
units = "metric";
};
}
{
block = "custom";
interval = 60 * 60;
command = let inherit (import <niveum/configs/spacetime.nix>) location; in "${pkgs.scripts.horoscope}/bin/horoscope --latitude=${toString location.latitude} --longitude=${toString location.longitude}";
}
{
block = "custom";
interval = 60 * 60;
@@ -100,6 +105,7 @@ in {
import astral
import astral.moon
import astral.sun
import math
moon_phases = {
0: "🌑",
@@ -115,10 +121,12 @@ in {
current_phase = astral.moon.phase()
closest_phase = min(moon_phases.keys(), key=lambda x: abs(current_phase - x))
moon_percentage = round(100 * math.sin(current_phase / 28 * math.pi), 1)
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]))
print("🌅 {} 🌇 {} {} {}%".format(sun["sunrise"].strftime("%R"), sun["sunset"].strftime("%R"), moon_phases[closest_phase], moon_percentage))
'';
}
{

View File

@@ -138,7 +138,7 @@ in rec {
set -efu
usage() {
echo "usage: $0 mw|mwe|boet|bopp|apte|boro TERM"
echo "usage: [OUTPUT=deva|roman] $0 mw|mwe|boet|bopp|apte|boro TERM"
exit 1
}
@@ -158,7 +158,7 @@ in rec {
input="$*"
${pkgs.curl}/bin/curl -sSL "https://www.sanskrit-lexicon.uni-koeln.de/scans/$id/2020/web/webtc/getword.php?key=$input&filter=roman&accent=yes&transLit=hk" \
${pkgs.curl}/bin/curl -sSL "https://www.sanskrit-lexicon.uni-koeln.de/scans/$id/2020/web/webtc/getword.php?key=$input&filter=''${OUTPUT-roman}&accent=yes&transLit=hk" \
| ${pkgs.pandoc}/bin/pandoc --standalone --variable=title:"$input" --from=html --to=man \
| ${pkgs.gnused}/bin/sed 's/\s\+\([:.,;]\)/\1/g;s/\s\+/ /g' \
| ${pkgs.man}/bin/man --local-file --pager="${pkgs.bat}/bin/bat -p" -
@@ -184,6 +184,8 @@ in rec {
}} "$@"
'';
horoscope = pkgs.callPackage ./horoscope {};
genius = wrapScript {
packages = [ pkgs.curl pkgs.gnused pkgs.pandoc ];
name = "genius";

View File

@@ -0,0 +1,4 @@
{ poetry2nix }:
poetry2nix.mkPoetryApplication {
projectDir = ./.;
}

View File

@@ -0,0 +1,54 @@
from datetime import datetime
import click
from flatlib.datetime import Datetime
from flatlib.geopos import GeoPos
from flatlib.chart import Chart
import flatlib.const
sign_symbols = {
flatlib.const.ARIES: "",
flatlib.const.TAURUS: "",
flatlib.const.GEMINI: "",
flatlib.const.CANCER: "",
flatlib.const.LEO: "",
flatlib.const.VIRGO: "",
flatlib.const.LIBRA: "",
flatlib.const.SCORPIO: "",
flatlib.const.SAGITTARIUS: "",
flatlib.const.CAPRICORN: "",
flatlib.const.AQUARIUS: "",
flatlib.const.PISCES: "",
}
planet_symbols = {
flatlib.const.SUN: "",
flatlib.const.MOON: "",
flatlib.const.MERCURY: "",
flatlib.const.VENUS: "",
flatlib.const.MARS: "",
flatlib.const.JUPITER: "",
flatlib.const.SATURN: "",
}
def convert_into_stupid_flatlib_format(dt):
return Datetime(dt.strftime("%Y/%m/%d"), dt.strftime("%H:%M"))
@click.command()
@click.option("--latitude", type=click.FLOAT, required=True)
@click.option("--longitude", type=click.FLOAT, required=True)
@click.option("--date", type=click.DateTime(), default=datetime.now())
def main(latitude: float, longitude: float, date: datetime):
flatlib_datetime = convert_into_stupid_flatlib_format(date)
position = GeoPos(latitude, longitude)
chart = Chart(flatlib_datetime, position)
for planet in planet_symbols.keys():
planet_position = chart.getObject(planet)
print(
planet_symbols[planet],
sign_symbols[planet_position.sign],
"" if planet_position.movement() == flatlib.const.RETROGRADE else "",
end="",
)
print()

59
packages/scripts/horoscope/poetry.lock generated Normal file
View File

@@ -0,0 +1,59 @@
[[package]]
name = "click"
version = "8.0.3"
description = "Composable command line interface toolkit"
category = "main"
optional = false
python-versions = ">=3.6"
[package.dependencies]
colorama = {version = "*", markers = "platform_system == \"Windows\""}
[[package]]
name = "colorama"
version = "0.4.4"
description = "Cross-platform colored terminal text."
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[[package]]
name = "flatlib"
version = "0.2.3"
description = "Python library for Traditional Astrology"
category = "main"
optional = false
python-versions = "*"
[package.dependencies]
pyswisseph = "2.08.00-1"
[[package]]
name = "pyswisseph"
version = "2.08.00-1"
description = "Python extension to the Swiss Ephemeris"
category = "main"
optional = false
python-versions = "*"
[metadata]
lock-version = "1.1"
python-versions = "^3.8"
content-hash = "2f40aecf583ff9e4f7b2dcc090fee27915e64ff1f8a450fbe5e6f95e8c487d75"
[metadata.files]
click = [
{file = "click-8.0.3-py3-none-any.whl", hash = "sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3"},
{file = "click-8.0.3.tar.gz", hash = "sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b"},
]
colorama = [
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
{file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
]
flatlib = [
{file = "flatlib-0.2.3-py3-none-any.whl", hash = "sha256:c846d83c965db7588581bb65ac9a6668b9a190afcad5027269f7e9c75f467bcd"},
{file = "flatlib-0.2.3.tar.gz", hash = "sha256:46cc956b936aa31a96082cff23448a5c27dd6e5e434a6293bc9265336c00dd5d"},
]
pyswisseph = [
{file = "pyswisseph-2.08.00-1.tar.gz", hash = "sha256:6b4818c0224d309c0b01f3c52df2432900dddcde345364408d99eafc9cdd1e71"},
]

View File

@@ -0,0 +1,17 @@
[tool.poetry]
name = "horoscope"
version = "0.1.0"
description = ""
authors = ["Kierán Meinhardt <kmein@posteo.de>"]
[tool.poetry.dependencies]
python = "^3.8"
flatlib = "^0.2.3"
click = "^8.0.3"
[tool.poetry.scripts]
horoscope = "horoscope:main"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

View File

@@ -1,2 +0,0 @@
{ pkgs, id, name }: pkgs.writeDashBin name ''
''