diff options
| author | Lukasz Kasprzak <lukasz.kasprzak@pm.me> | 2026-02-17 16:20:40 +0100 |
|---|---|---|
| committer | Lukasz Kasprzak <lukasz.kasprzak@pm.me> | 2026-02-17 16:20:40 +0100 |
| commit | c74163f1ecbd809c83bb465ee89fa04369a89972 (patch) | |
| tree | c1a52692a47566652d7f2a9a8eceb9f1839991b7 | |
| parent | 70e6d80c2d367480478eacf46363ee88a0e994ff (diff) | |
| download | bin-c74163f1ecbd809c83bb465ee89fa04369a89972.tar.gz bin-c74163f1ecbd809c83bb465ee89fa04369a89972.zip | |
cleaned up names and dir
| -rwxr-xr-x | archive/create-lab (renamed from create-lab) | 0 | ||||
| -rwxr-xr-x | archive/kvm-lab-create.bak | 132 | ||||
| -rwxr-xr-x | archive/kvm-lab-destroy.bak (renamed from kvm-lab-destroy.bak) | 0 | ||||
| -rw-r--r-- | archive/nextcloud (renamed from nextcloud) | 0 | ||||
| -rwxr-xr-x | borg-away-from-home-backup (renamed from borg-internet.sh) | 0 | ||||
| -rwxr-xr-x | borg-backup (renamed from borg-backup.sh) | 0 | ||||
| -rwxr-xr-x | dmenu-scripts | 38 | ||||
| -rw-r--r-- | docs/officium_readme.md (renamed from officium_readme.md) | 0 | ||||
| -rwxr-xr-x | kvm-lab-create.bak | 160 | ||||
| -rwxr-xr-x | market-monitor.sh | 499 | ||||
| -rwxr-xr-x | passmenu-otp | 24 | ||||
| -rwxr-xr-x | rofi-task-names | 26 | ||||
| -rwxr-xr-x | shield-backup (renamed from backup_shield.sh) | 0 | ||||
| -rwxr-xr-x | shield-mount (renamed from luks-shield) | 0 | ||||
| -rwxr-xr-x | simplex | 4 | ||||
| -rwxr-xr-x | usb-backup (renamed from backup_usb.sh) | 0 | ||||
| -rwxr-xr-x | usb-mount (renamed from usb-safe) | 0 | ||||
| -rwxr-xr-x | usb-tether (renamed from usb-tether.sh) | 0 |
18 files changed, 634 insertions, 249 deletions
diff --git a/create-lab b/archive/create-lab index 8640ed6..8640ed6 100755 --- a/create-lab +++ b/archive/create-lab diff --git a/archive/kvm-lab-create.bak b/archive/kvm-lab-create.bak index d0d5865..43d2926 100755 --- a/archive/kvm-lab-create.bak +++ b/archive/kvm-lab-create.bak @@ -1,51 +1,106 @@ #!/usr/bin/env bash set -euo pipefail -# Libvirt context (system) URI="qemu:///system" -# Base/template (immutable parent qcow2) -BASE="/var/lib/libvirt/images/base/debian13-template.qcow2" -TEMPLATE_DOMAIN="debian13-template" +IMGROOT="/var/lib/libvirt/images" +BASEDIR="$IMGROOT/base" +LABDIR="$IMGROOT/lab" -# Lab overlays directory (dedicated) -LABDIR="/var/lib/libvirt/images/lab" +TEMPLATE_DOMAIN="debian13-template" +TEMPLATE_BASE="$BASEDIR/debian13-template.qcow2" usage() { - echo "Usage: kvm-lab-create <lab-name> [--start]" - echo "Example: kvm-lab-create lab02 --start" + echo "Usage: kvm-lab-create <lab-name> [--base template|work01|/abs/path.qcow2] [--start]" + echo "Examples:" + echo " kvm-lab-create lab10 --base template --start" + echo " kvm-lab-create lab11 --base work01 --start" + echo " kvm-lab-create lab12 --base /var/lib/libvirt/images/base/custom.qcow2 --start" } +# --- Parse args --- NAME="${1:-}" -START="${2:-}" +shift || true -if [[ -z "$NAME" ]]; then - usage - exit 1 -fi +BASESEL="template" +START="no" + +while [[ $# -gt 0 ]]; do + case "$1" in + --base) + BASESEL="${2:-}" + shift 2 + ;; + --start) + START="yes" + shift + ;; + -h|--help) + usage + exit 0 + ;; + *) + echo "ERROR: Unknown argument: $1" + usage + exit 1 + ;; + esac +done -if [[ "${START:-}" != "" && "${START:-}" != "--start" ]]; then +if [[ -z "$NAME" ]]; then usage exit 1 fi DISK="${LABDIR}/${NAME}.qcow2" XML_TMP="$(mktemp "/tmp/${NAME}.xml.XXXXXX")" - cleanup() { rm -f "$XML_TMP"; } trap cleanup EXIT -# ---- Preconditions (read-only checks) ---- -if ! sudo test -r "$BASE"; then - echo "ERROR: Base image not readable: $BASE" - exit 1 -fi +# --- Resolve base selection --- +resolve_base() { + local sel="$1" + if [[ "$sel" == "template" ]]; then + echo "$TEMPLATE_BASE" + return 0 + fi + + if [[ "$sel" == "work01" ]]; then + # Pick newest promoted work01 base (must exist first) + local latest + latest="$(ls -1t "$BASEDIR"/work01-base-*.qcow2 2>/dev/null | head -n 1 || true)" + if [[ -z "$latest" ]]; then + echo "ERROR: No work01 base found in $BASEDIR (expected work01-base-*.qcow2)." + echo "Action: run your promote script to create one." + return 1 + fi + echo "$latest" + return 0 + fi + # Absolute path base + if [[ "$sel" == /* ]]; then + echo "$sel" + return 0 + fi + + echo "ERROR: Invalid --base '$sel' (use template|work01|/abs/path.qcow2)" + return 1 +} + +BASE="$(resolve_base "$BASESEL")" + +# --- Preconditions (read-only checks) --- if [[ ! -d "$LABDIR" ]]; then echo "ERROR: Lab directory missing: $LABDIR" exit 1 fi +if ! sudo test -r "$BASE"; then + echo "ERROR: Base image not readable (via sudo): $BASE" + exit 1 +fi + if [[ -e "$DISK" ]]; then echo "ERROR: Disk already exists: $DISK" exit 1 @@ -61,50 +116,45 @@ if ! virsh -c "$URI" dominfo "$TEMPLATE_DOMAIN" &>/dev/null; then exit 1 fi -# ---- Create overlay disk ---- +# --- Create overlay disk --- +echo "Using base: $BASE" echo "Creating overlay disk: $DISK" sudo qemu-img create -f qcow2 -F qcow2 -b "$BASE" "$DISK" >/dev/null - -# Ensure qemu/libvirt can open it sudo chown libvirt-qemu:libvirt "$DISK" sudo chmod 0660 "$DISK" -# Quick sanity: confirm backing file is correct echo "Validating backing file..." -sudo qemu-img info "$DISK" | grep -E "backing file:|file format:|virtual size:" || true +sudo qemu-img info "$DISK" | grep -E "file format:|virtual size:|backing file:" || true -# ---- Clone domain XML ---- +# --- Clone domain XML --- echo "Cloning domain XML from: $TEMPLATE_DOMAIN" virsh -c "$URI" dumpxml "$TEMPLATE_DOMAIN" > "$XML_TMP" -# Replace <name> and the disk path, and force NAT-only network "default" -# Notes: -# - disk path substitution assumes template points at /var/lib/libvirt/images/base/debian13-template.qcow2 -# - network replacement assumes a standard <interface type='network'> exists +# Set name, disk path, and force NAT-only network "default" sed -i \ -e "s|<name>${TEMPLATE_DOMAIN}</name>|<name>${NAME}</name>|" \ - -e "s|${BASE}|${DISK}|g" \ + -e "s|${TEMPLATE_BASE}|${DISK}|g" \ -e "s|<source network='[^']*'|<source network='default'|g" \ "$XML_TMP" -# Extra safety: remove any hostfs passthrough (if any) to prevent host access via mounts -# (If none exist, this does nothing.) -perl -0777 -i -pe 's/<filesystem[\s\S]*?<\/filesystem>\n?//g' "$XML_TMP" -# # Remove UUID to avoid collision with template sed -i -E '/<uuid>[^<]*<\/uuid>/d' "$XML_TMP" -# ---- Define domain ---- + +# Remove any host filesystem passthrough (if present) +perl -0777 -i -pe 's/<filesystem[\s\S]*?<\/filesystem>\n?//g' "$XML_TMP" + +# --- Define domain --- echo "Defining domain: $NAME" virsh -c "$URI" define "$XML_TMP" >/dev/null -# ---- Optional start ---- -if [[ "$START" == "--start" ]]; then +# --- Optional start --- +if [[ "$START" == "yes" ]]; then echo "Starting domain: $NAME" virsh -c "$URI" start "$NAME" >/dev/null fi -echo "OK: Lab '${NAME}' created (disk: ${DISK})." -if [[ "$START" != "--start" ]]; then - echo "To start: virsh -c $URI start ${NAME}" +echo "OK: Lab '$NAME' created (disk: $DISK)." +if [[ "$START" != "yes" ]]; then + echo "To start: virsh -c $URI start $NAME" fi diff --git a/kvm-lab-destroy.bak b/archive/kvm-lab-destroy.bak index 3548ef9..3548ef9 100755 --- a/kvm-lab-destroy.bak +++ b/archive/kvm-lab-destroy.bak diff --git a/nextcloud b/archive/nextcloud index fae9bdb..fae9bdb 100644 --- a/nextcloud +++ b/archive/nextcloud diff --git a/borg-internet.sh b/borg-away-from-home-backup index 84247d1..84247d1 100755 --- a/borg-internet.sh +++ b/borg-away-from-home-backup diff --git a/borg-backup.sh b/borg-backup index b9572f6..b9572f6 100755 --- a/borg-backup.sh +++ b/borg-backup diff --git a/dmenu-scripts b/dmenu-scripts deleted file mode 100755 index 6d9c9db..0000000 --- a/dmenu-scripts +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -script_path="${HOME}/.local/bin" - -# Optional dmenu theming -# shellcheck disable=SC1090 -[[ -r "${HOME}/.local/bin/dmenu-theming" ]] && . "${HOME}/.local/bin/dmenu-theming" - -DMENU_CMD="${DMENU_CMD:-dmenu}" -PROMPT="${PROMPT:-Run: }" - -# List only executable non-binary files in ~/.local/bin -choices="$( - find "${script_path}" -maxdepth 1 -type f -executable -print0 \ - | xargs -0 -I{} sh -c 'grep -Iq . "$1" && printf "%s\n" "$(basename "$1")"' _ {} \ - | sort -u -)" - -picked="$( - printf "%s\n" "$choices" \ - | ${DMENU_CMD} -i -l 20 -p "${PROMPT}" ${lines:-} ${colors:-} ${font:-} \ - || true -)" - -[[ -n "${picked}" ]] || exit 0 - -# Safety: only allow basenames (no slashes) -case "$picked" in - */*|"") exit 0 ;; -esac - -target="${script_path}/${picked}" - -[[ -x "$target" ]] || { printf "ERROR: not executable: %s\n" "$target" >&2; exit 1; } - -exec "$target" - diff --git a/officium_readme.md b/docs/officium_readme.md index b4e00a5..b4e00a5 100644 --- a/officium_readme.md +++ b/docs/officium_readme.md diff --git a/kvm-lab-create.bak b/kvm-lab-create.bak deleted file mode 100755 index 43d2926..0000000 --- a/kvm-lab-create.bak +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -URI="qemu:///system" - -IMGROOT="/var/lib/libvirt/images" -BASEDIR="$IMGROOT/base" -LABDIR="$IMGROOT/lab" - -TEMPLATE_DOMAIN="debian13-template" -TEMPLATE_BASE="$BASEDIR/debian13-template.qcow2" - -usage() { - echo "Usage: kvm-lab-create <lab-name> [--base template|work01|/abs/path.qcow2] [--start]" - echo "Examples:" - echo " kvm-lab-create lab10 --base template --start" - echo " kvm-lab-create lab11 --base work01 --start" - echo " kvm-lab-create lab12 --base /var/lib/libvirt/images/base/custom.qcow2 --start" -} - -# --- Parse args --- -NAME="${1:-}" -shift || true - -BASESEL="template" -START="no" - -while [[ $# -gt 0 ]]; do - case "$1" in - --base) - BASESEL="${2:-}" - shift 2 - ;; - --start) - START="yes" - shift - ;; - -h|--help) - usage - exit 0 - ;; - *) - echo "ERROR: Unknown argument: $1" - usage - exit 1 - ;; - esac -done - -if [[ -z "$NAME" ]]; then - usage - exit 1 -fi - -DISK="${LABDIR}/${NAME}.qcow2" -XML_TMP="$(mktemp "/tmp/${NAME}.xml.XXXXXX")" -cleanup() { rm -f "$XML_TMP"; } -trap cleanup EXIT - -# --- Resolve base selection --- -resolve_base() { - local sel="$1" - if [[ "$sel" == "template" ]]; then - echo "$TEMPLATE_BASE" - return 0 - fi - - if [[ "$sel" == "work01" ]]; then - # Pick newest promoted work01 base (must exist first) - local latest - latest="$(ls -1t "$BASEDIR"/work01-base-*.qcow2 2>/dev/null | head -n 1 || true)" - if [[ -z "$latest" ]]; then - echo "ERROR: No work01 base found in $BASEDIR (expected work01-base-*.qcow2)." - echo "Action: run your promote script to create one." - return 1 - fi - echo "$latest" - return 0 - fi - - # Absolute path base - if [[ "$sel" == /* ]]; then - echo "$sel" - return 0 - fi - - echo "ERROR: Invalid --base '$sel' (use template|work01|/abs/path.qcow2)" - return 1 -} - -BASE="$(resolve_base "$BASESEL")" - -# --- Preconditions (read-only checks) --- -if [[ ! -d "$LABDIR" ]]; then - echo "ERROR: Lab directory missing: $LABDIR" - exit 1 -fi - -if ! sudo test -r "$BASE"; then - echo "ERROR: Base image not readable (via sudo): $BASE" - exit 1 -fi - -if [[ -e "$DISK" ]]; then - echo "ERROR: Disk already exists: $DISK" - exit 1 -fi - -if virsh -c "$URI" dominfo "$NAME" &>/dev/null; then - echo "ERROR: Domain already exists: $NAME" - exit 1 -fi - -if ! virsh -c "$URI" dominfo "$TEMPLATE_DOMAIN" &>/dev/null; then - echo "ERROR: Template domain not found in $URI: $TEMPLATE_DOMAIN" - exit 1 -fi - -# --- Create overlay disk --- -echo "Using base: $BASE" -echo "Creating overlay disk: $DISK" -sudo qemu-img create -f qcow2 -F qcow2 -b "$BASE" "$DISK" >/dev/null -sudo chown libvirt-qemu:libvirt "$DISK" -sudo chmod 0660 "$DISK" - -echo "Validating backing file..." -sudo qemu-img info "$DISK" | grep -E "file format:|virtual size:|backing file:" || true - -# --- Clone domain XML --- -echo "Cloning domain XML from: $TEMPLATE_DOMAIN" -virsh -c "$URI" dumpxml "$TEMPLATE_DOMAIN" > "$XML_TMP" - -# Set name, disk path, and force NAT-only network "default" -sed -i \ - -e "s|<name>${TEMPLATE_DOMAIN}</name>|<name>${NAME}</name>|" \ - -e "s|${TEMPLATE_BASE}|${DISK}|g" \ - -e "s|<source network='[^']*'|<source network='default'|g" \ - "$XML_TMP" - -# Remove UUID to avoid collision with template -sed -i -E '/<uuid>[^<]*<\/uuid>/d' "$XML_TMP" - -# Remove any host filesystem passthrough (if present) -perl -0777 -i -pe 's/<filesystem[\s\S]*?<\/filesystem>\n?//g' "$XML_TMP" - -# --- Define domain --- -echo "Defining domain: $NAME" -virsh -c "$URI" define "$XML_TMP" >/dev/null - -# --- Optional start --- -if [[ "$START" == "yes" ]]; then - echo "Starting domain: $NAME" - virsh -c "$URI" start "$NAME" >/dev/null -fi - -echo "OK: Lab '$NAME' created (disk: $DISK)." -if [[ "$START" != "yes" ]]; then - echo "To start: virsh -c $URI start $NAME" -fi - diff --git a/market-monitor.sh b/market-monitor.sh new file mode 100755 index 0000000..5c0dd6a --- /dev/null +++ b/market-monitor.sh @@ -0,0 +1,499 @@ +#!/bin/bash + +# Skrypt wyświetlający aktualny kurs Bitcoin, CSPX.UK, EIMI.UK, CBU0.UK i IB01.UK + +clear + +while true; do + clear + echo "╔════════════════════════════════════════╗" + echo "║ Market Price Monitor ║" + echo "╚════════════════════════════════════════╝" + echo "" + + # Pobierz kurs Bitcoin z CoinGecko + btc_response=$(curl -s 'https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=eur') + + if [ $? -eq 0 ] && [ -n "$btc_response" ]; then + eur=$(echo $btc_response | grep -o '"eur":[0-9.]*' | cut -d':' -f2) + + if [ -n "$eur" ]; then + echo " 💰 Bitcoin (BTC)" + LC_NUMERIC=C printf " Price: %'d €\n" "$eur" + + # Średnia cena zakupu + avg_buy_price=71226.55 + gain=$(echo "scale=4; (($eur - $avg_buy_price) / $avg_buy_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Average buy price: %'.2f € (%.2f%%)\n" "$avg_buy_price" "$gain" + else + echo " ❌ Bitcoin: Error parsing data" + fi + else + echo " ❌ Bitcoin: Error fetching data" + fi + + echo "" + + # Pobierz kursy metali szlachetnych z Yahoo Finance + gold_response=$(curl -s -A "Mozilla/5.0" 'https://query1.finance.yahoo.com/v8/finance/chart/GC=F?interval=1d&range=1y' 2>/dev/null) + gold_price=$(echo "$gold_response" | grep -o '"regularMarketPrice":[0-9.]*' | head -1 | cut -d':' -f2) + gold_closes=$(echo "$gold_response" | grep -o '"close":\[[^]]*\]' | sed 's/"close":\[//;s/\]//' | tr ',' '\n') + gold_month=$(echo "$gold_closes" | tail -31 | head -1) + gold_year=$(echo "$gold_closes" | head -1) + + sleep 1 + silver_response=$(curl -s -A "Mozilla/5.0" 'https://query1.finance.yahoo.com/v8/finance/chart/SI=F?interval=1d&range=1y' 2>/dev/null) + silver_price=$(echo "$silver_response" | grep -o '"regularMarketPrice":[0-9.]*' | head -1 | cut -d':' -f2) + silver_closes=$(echo "$silver_response" | grep -o '"close":\[[^]]*\]' | sed 's/"close":\[//;s/\]//' | tr ',' '\n') + silver_month=$(echo "$silver_closes" | tail -31 | head -1) + silver_year=$(echo "$silver_closes" | head -1) + + if [ -n "$gold_price" ] && [ -n "$silver_price" ]; then + echo " 🥇 Precious Metals (per oz)" + LC_NUMERIC=C printf " Gold: %.2f $\n" "$gold_price" + if [ -n "$gold_month" ] && [ "$gold_month" != "null" ]; then + month_change=$(echo "scale=4; (($gold_price - $gold_month) / $gold_month) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Month ago: %.2f $ (%.2f%%)\n" "$gold_month" "$month_change" + fi + if [ -n "$gold_year" ] && [ "$gold_year" != "null" ]; then + year_change=$(echo "scale=4; (($gold_price - $gold_year) / $gold_year) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Year ago: %.2f $ (%.2f%%)\n" "$gold_year" "$year_change" + fi + + LC_NUMERIC=C printf " Silver: %.2f $\n" "$silver_price" + if [ -n "$silver_month" ] && [ "$silver_month" != "null" ]; then + month_change=$(echo "scale=4; (($silver_price - $silver_month) / $silver_month) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Month ago: %.2f $ (%.2f%%)\n" "$silver_month" "$month_change" + fi + if [ -n "$silver_year" ] && [ "$silver_year" != "null" ]; then + year_change=$(echo "scale=4; (($silver_price - $silver_year) / $silver_year) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Year ago: %.2f $ (%.2f%%)\n" "$silver_year" "$year_change" + fi + + echo "" + # Oblicz Gold/Silver Ratio + gold_silver_ratio=$(echo "scale=4; $gold_price / $silver_price" | LC_NUMERIC=C bc) + + echo " 📊 Metal Ratios:" + LC_NUMERIC=C printf " Gold/Silver: %.2f\n" "$gold_silver_ratio" + + # Interpretacja Gold/Silver ratio + ratio_int=$(echo "scale=0; $gold_silver_ratio / 1" | LC_NUMERIC=C bc) + if [ "$ratio_int" -gt 80 ]; then + echo " → Silver undervalued vs Gold" + elif [ "$ratio_int" -lt 50 ]; then + echo " → Gold undervalued vs Silver" + fi + else + echo " ❌ Metals: Error fetching data" + fi + + echo "" + + # Pobierz kurs CSPX.UK (iShares Core S&P 500) + sleep 1 + cspx_response=$(curl -s -A "Mozilla/5.0" 'https://query1.finance.yahoo.com/v8/finance/chart/CSPX.L?interval=1d&range=2y' 2>/dev/null) + cspx_price=$(echo "$cspx_response" | grep -o '"regularMarketPrice":[0-9.]*' | head -1 | cut -d':' -f2) + cspx_currency=$(echo "$cspx_response" | grep -o '"currency":"[A-Z]*"' | head -1 | cut -d'"' -f4) + cspx_closes=$(echo "$cspx_response" | grep -o '"close":\[[^]]*\]' | sed 's/"close":\[//;s/\]//' | tr ',' '\n') + cspx_prev_day=$(echo "$cspx_closes" | tail -2 | head -1) + cspx_week_price=$(echo "$cspx_closes" | tail -7 | head -1) + cspx_2week_price=$(echo "$cspx_closes" | tail -14 | head -1) + cspx_month_price=$(echo "$cspx_closes" | tail -31 | head -1) + cspx_13month_price=$(echo "$cspx_closes" | tail -283 | head -1) + + if [ -n "$cspx_price" ]; then + echo " 📊 iShares Core S&P 500 (CSPX.L)" + echo " ISIN: IE00B5BMR087" + + # Determine currency symbol + if [ "$cspx_currency" = "GBP" ]; then + currency_symbol="£" + elif [ "$cspx_currency" = "EUR" ]; then + currency_symbol="€" + elif [ "$cspx_currency" = "USD" ]; then + currency_symbol="$" + else + currency_symbol="$cspx_currency" + fi + + LC_NUMERIC=C printf " Price: %.2f %s\n" "$cspx_price" "$currency_symbol" + + if [ -n "$cspx_prev_day" ] && [ "$cspx_prev_day" != "null" ]; then + prev_change=$(echo "scale=4; (($cspx_price - $cspx_prev_day) / $cspx_prev_day) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Previous day: %.2f %s (%.2f%%)\n" "$cspx_prev_day" "$currency_symbol" "$prev_change" + fi + if [ -n "$cspx_week_price" ] && [ "$cspx_week_price" != "null" ]; then + week_change=$(echo "scale=4; (($cspx_price - $cspx_week_price) / $cspx_week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Week ago: %.2f %s (%.2f%%)\n" "$cspx_week_price" "$currency_symbol" "$week_change" + fi + if [ -n "$cspx_2week_price" ] && [ "$cspx_2week_price" != "null" ]; then + week2_change=$(echo "scale=4; (($cspx_price - $cspx_2week_price) / $cspx_2week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 2 weeks ago: %.2f %s (%.2f%%)\n" "$cspx_2week_price" "$currency_symbol" "$week2_change" + fi + if [ -n "$cspx_month_price" ] && [ "$cspx_month_price" != "null" ]; then + month_change=$(echo "scale=4; (($cspx_price - $cspx_month_price) / $cspx_month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Month ago: %.2f %s (%.2f%%)\n" "$cspx_month_price" "$currency_symbol" "$month_change" + fi + if [ -n "$cspx_month_price" ] && [ "$cspx_month_price" != "null" ] && [ -n "$cspx_13month_price" ] && [ "$cspx_13month_price" != "null" ]; then + year_gain=$(echo "scale=4; (($cspx_month_price - $cspx_13month_price) / $cspx_13month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 12-month gain (13m ago to 1m ago): %.2f%%\n" "$year_gain" + fi + else + echo " ❌ CSPX.L: Error fetching data" + fi + + echo "" + + # Pobierz kurs EIMI.UK (iShares Core MSCI EM IMI) + sleep 1 + eimi_response=$(curl -s -A "Mozilla/5.0" 'https://query1.finance.yahoo.com/v8/finance/chart/EIMI.L?interval=1d&range=2y' 2>/dev/null) + eimi_price=$(echo "$eimi_response" | grep -o '"regularMarketPrice":[0-9.]*' | head -1 | cut -d':' -f2) + eimi_currency=$(echo "$eimi_response" | grep -o '"currency":"[A-Z]*"' | head -1 | cut -d'"' -f4) + eimi_closes=$(echo "$eimi_response" | grep -o '"close":\[[^]]*\]' | sed 's/"close":\[//;s/\]//' | tr ',' '\n') + eimi_prev_day=$(echo "$eimi_closes" | tail -2 | head -1) + eimi_week_price=$(echo "$eimi_closes" | tail -7 | head -1) + eimi_2week_price=$(echo "$eimi_closes" | tail -14 | head -1) + eimi_month_price=$(echo "$eimi_closes" | tail -31 | head -1) + eimi_13month_price=$(echo "$eimi_closes" | tail -283 | head -1) + + if [ -n "$eimi_price" ]; then + echo " 📈 iShares Core MSCI EM IMI (EIMI.L)" + echo " ISIN: IE00BKM4GZ66" + + # Determine currency symbol + if [ "$eimi_currency" = "GBP" ]; then + currency_symbol="£" + elif [ "$eimi_currency" = "EUR" ]; then + currency_symbol="€" + elif [ "$eimi_currency" = "USD" ]; then + currency_symbol="$" + else + currency_symbol="$eimi_currency" + fi + + LC_NUMERIC=C printf " Price: %.2f %s\n" "$eimi_price" "$currency_symbol" + + if [ -n "$eimi_prev_day" ] && [ "$eimi_prev_day" != "null" ]; then + prev_change=$(echo "scale=4; (($eimi_price - $eimi_prev_day) / $eimi_prev_day) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Previous day: %.2f %s (%.2f%%)\n" "$eimi_prev_day" "$currency_symbol" "$prev_change" + fi + if [ -n "$eimi_week_price" ] && [ "$eimi_week_price" != "null" ]; then + week_change=$(echo "scale=4; (($eimi_price - $eimi_week_price) / $eimi_week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Week ago: %.2f %s (%.2f%%)\n" "$eimi_week_price" "$currency_symbol" "$week_change" + fi + if [ -n "$eimi_2week_price" ] && [ "$eimi_2week_price" != "null" ]; then + week2_change=$(echo "scale=4; (($eimi_price - $eimi_2week_price) / $eimi_2week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 2 weeks ago: %.2f %s (%.2f%%)\n" "$eimi_2week_price" "$currency_symbol" "$week2_change" + fi + if [ -n "$eimi_month_price" ] && [ "$eimi_month_price" != "null" ]; then + month_change=$(echo "scale=4; (($eimi_price - $eimi_month_price) / $eimi_month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Month ago: %.2f %s (%.2f%%)\n" "$eimi_month_price" "$currency_symbol" "$month_change" + fi + if [ -n "$eimi_month_price" ] && [ "$eimi_month_price" != "null" ] && [ -n "$eimi_13month_price" ] && [ "$eimi_13month_price" != "null" ]; then + year_gain=$(echo "scale=4; (($eimi_month_price - $eimi_13month_price) / $eimi_13month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 12-month gain (13m ago to 1m ago): %.2f%%\n" "$year_gain" + fi + else + echo " ❌ EIMI.L: Error fetching data" + fi + + echo "" + + # Pobierz kurs CBU0.UK (iShares Core Corporate Bond) + sleep 1 + cbu0_response=$(curl -s -A "Mozilla/5.0" 'https://query1.finance.yahoo.com/v8/finance/chart/CBU0.L?interval=1d&range=2y' 2>/dev/null) + cbu0_price=$(echo "$cbu0_response" | grep -o '"regularMarketPrice":[0-9.]*' | head -1 | cut -d':' -f2) + cbu0_currency=$(echo "$cbu0_response" | grep -o '"currency":"[A-Z]*"' | head -1 | cut -d'"' -f4) + cbu0_closes=$(echo "$cbu0_response" | grep -o '"close":\[[^]]*\]' | sed 's/"close":\[//;s/\]//' | tr ',' '\n') + cbu0_prev_day=$(echo "$cbu0_closes" | tail -2 | head -1) + cbu0_week_price=$(echo "$cbu0_closes" | tail -7 | head -1) + cbu0_2week_price=$(echo "$cbu0_closes" | tail -14 | head -1) + cbu0_month_price=$(echo "$cbu0_closes" | tail -31 | head -1) + cbu0_13month_price=$(echo "$cbu0_closes" | tail -283 | head -1) + + if [ -n "$cbu0_price" ]; then + echo " 💼 iShares Core Corporate Bond (CBU0.L)" + echo " ISIN: IE00BD1DJ122" + + # Determine currency symbol + if [ "$cbu0_currency" = "GBP" ]; then + currency_symbol="£" + elif [ "$cbu0_currency" = "EUR" ]; then + currency_symbol="€" + elif [ "$cbu0_currency" = "USD" ]; then + currency_symbol="$" + else + currency_symbol="$cbu0_currency" + fi + + LC_NUMERIC=C printf " Price: %.2f %s\n" "$cbu0_price" "$currency_symbol" + + if [ -n "$cbu0_prev_day" ] && [ "$cbu0_prev_day" != "null" ]; then + prev_change=$(echo "scale=4; (($cbu0_price - $cbu0_prev_day) / $cbu0_prev_day) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Previous day: %.2f %s (%.2f%%)\n" "$cbu0_prev_day" "$currency_symbol" "$prev_change" + fi + if [ -n "$cbu0_week_price" ] && [ "$cbu0_week_price" != "null" ]; then + week_change=$(echo "scale=4; (($cbu0_price - $cbu0_week_price) / $cbu0_week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Week ago: %.2f %s (%.2f%%)\n" "$cbu0_week_price" "$currency_symbol" "$week_change" + fi + if [ -n "$cbu0_2week_price" ] && [ "$cbu0_2week_price" != "null" ]; then + week2_change=$(echo "scale=4; (($cbu0_price - $cbu0_2week_price) / $cbu0_2week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 2 weeks ago: %.2f %s (%.2f%%)\n" "$cbu0_2week_price" "$currency_symbol" "$week2_change" + fi + if [ -n "$cbu0_month_price" ] && [ "$cbu0_month_price" != "null" ]; then + month_change=$(echo "scale=4; (($cbu0_price - $cbu0_month_price) / $cbu0_month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Month ago: %.2f %s (%.2f%%)\n" "$cbu0_month_price" "$currency_symbol" "$month_change" + fi + if [ -n "$cbu0_month_price" ] && [ "$cbu0_month_price" != "null" ] && [ -n "$cbu0_13month_price" ] && [ "$cbu0_13month_price" != "null" ]; then + year_gain=$(echo "scale=4; (($cbu0_month_price - $cbu0_13month_price) / $cbu0_13month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 12-month gain (13m ago to 1m ago): %.2f%%\n" "$year_gain" + fi + else + echo " ❌ CBU0.L: Error fetching data" + fi + + echo "" + + # Pobierz kurs IB01.UK (iShares Treasury Bond 0-1yr) + sleep 1 + ib01_response=$(curl -s -A "Mozilla/5.0" 'https://query1.finance.yahoo.com/v8/finance/chart/IB01.L?interval=1d&range=2y' 2>/dev/null) + ib01_price=$(echo "$ib01_response" | grep -o '"regularMarketPrice":[0-9.]*' | head -1 | cut -d':' -f2) + ib01_currency=$(echo "$ib01_response" | grep -o '"currency":"[A-Z]*"' | head -1 | cut -d'"' -f4) + ib01_closes=$(echo "$ib01_response" | grep -o '"close":\[[^]]*\]' | sed 's/"close":\[//;s/\]//' | tr ',' '\n') + ib01_prev_day=$(echo "$ib01_closes" | tail -2 | head -1) + ib01_week_price=$(echo "$ib01_closes" | tail -7 | head -1) + ib01_2week_price=$(echo "$ib01_closes" | tail -14 | head -1) + ib01_month_price=$(echo "$ib01_closes" | tail -31 | head -1) + ib01_13month_price=$(echo "$ib01_closes" | tail -283 | head -1) + + if [ -n "$ib01_price" ]; then + echo " 🏦 iShares Treasury Bond 0-1yr (IB01.L)" + echo " ISIN: IE00B4WXJJ64" + + # Determine currency symbol + if [ "$ib01_currency" = "GBP" ]; then + currency_symbol="£" + elif [ "$ib01_currency" = "EUR" ]; then + currency_symbol="€" + elif [ "$ib01_currency" = "USD" ]; then + currency_symbol="$" + else + currency_symbol="$ib01_currency" + fi + + LC_NUMERIC=C printf " Price: %.2f %s\n" "$ib01_price" "$currency_symbol" + + if [ -n "$ib01_prev_day" ] && [ "$ib01_prev_day" != "null" ]; then + prev_change=$(echo "scale=4; (($ib01_price - $ib01_prev_day) / $ib01_prev_day) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Previous day: %.2f %s (%.2f%%)\n" "$ib01_prev_day" "$currency_symbol" "$prev_change" + fi + if [ -n "$ib01_week_price" ] && [ "$ib01_week_price" != "null" ]; then + week_change=$(echo "scale=4; (($ib01_price - $ib01_week_price) / $ib01_week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Week ago: %.2f %s (%.2f%%)\n" "$ib01_week_price" "$currency_symbol" "$week_change" + fi + if [ -n "$ib01_2week_price" ] && [ "$ib01_2week_price" != "null" ]; then + week2_change=$(echo "scale=4; (($ib01_price - $ib01_2week_price) / $ib01_2week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 2 weeks ago: %.2f %s (%.2f%%)\n" "$ib01_2week_price" "$currency_symbol" "$week2_change" + fi + if [ -n "$ib01_month_price" ] && [ "$ib01_month_price" != "null" ]; then + month_change=$(echo "scale=4; (($ib01_price - $ib01_month_price) / $ib01_month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Month ago: %.2f %s (%.2f%%)\n" "$ib01_month_price" "$currency_symbol" "$month_change" + fi + if [ -n "$ib01_month_price" ] && [ "$ib01_month_price" != "null" ] && [ -n "$ib01_13month_price" ] && [ "$ib01_13month_price" != "null" ]; then + year_gain=$(echo "scale=4; (($ib01_month_price - $ib01_13month_price) / $ib01_13month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 12-month gain (13m ago to 1m ago): %.2f%%\n" "$year_gain" + fi + else + echo " ❌ IB01.L: Error fetching data" + fi + + echo "" + + # Pobierz kurs BETAW20TR (Beta ETF WIG20TR) + sleep 1 + betaw20_response=$(curl -s -A "Mozilla/5.0" 'https://query1.finance.yahoo.com/v8/finance/chart/ETFBW20TR.WA?interval=1d&range=2y' 2>/dev/null) + betaw20_price=$(echo "$betaw20_response" | grep -o '"regularMarketPrice":[0-9.]*' | head -1 | cut -d':' -f2) + betaw20_currency=$(echo "$betaw20_response" | grep -o '"currency":"[A-Z]*"' | head -1 | cut -d'"' -f4) + betaw20_closes=$(echo "$betaw20_response" | grep -o '"close":\[[^]]*\]' | sed 's/"close":\[//;s/\]//' | tr ',' '\n') + betaw20_prev_day=$(echo "$betaw20_closes" | tail -2 | head -1) + betaw20_week_price=$(echo "$betaw20_closes" | tail -7 | head -1) + betaw20_2week_price=$(echo "$betaw20_closes" | tail -14 | head -1) + betaw20_month_price=$(echo "$betaw20_closes" | tail -31 | head -1) + betaw20_7month_price=$(echo "$betaw20_closes" | tail -157 | head -1) + betaw20_13month_price=$(echo "$betaw20_closes" | tail -283 | head -1) + + if [ -n "$betaw20_price" ]; then + echo " 🇵🇱 Beta ETF WIG20TR (BETAW20TR)" + echo " ISIN: PL0ETF000019" + + # Determine currency symbol + if [ "$betaw20_currency" = "PLN" ]; then + currency_symbol="zł" + elif [ "$betaw20_currency" = "EUR" ]; then + currency_symbol="€" + elif [ "$betaw20_currency" = "USD" ]; then + currency_symbol="$" + else + currency_symbol="$betaw20_currency" + fi + + LC_NUMERIC=C printf " Price: %.2f %s\n" "$betaw20_price" "$currency_symbol" + + if [ -n "$betaw20_prev_day" ] && [ "$betaw20_prev_day" != "null" ]; then + prev_change=$(echo "scale=4; (($betaw20_price - $betaw20_prev_day) / $betaw20_prev_day) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Previous day: %.2f %s (%.2f%%)\n" "$betaw20_prev_day" "$currency_symbol" "$prev_change" + fi + if [ -n "$betaw20_week_price" ] && [ "$betaw20_week_price" != "null" ]; then + week_change=$(echo "scale=4; (($betaw20_price - $betaw20_week_price) / $betaw20_week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Week ago: %.2f %s (%.2f%%)\n" "$betaw20_week_price" "$currency_symbol" "$week_change" + fi + if [ -n "$betaw20_2week_price" ] && [ "$betaw20_2week_price" != "null" ]; then + week2_change=$(echo "scale=4; (($betaw20_price - $betaw20_2week_price) / $betaw20_2week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 2 weeks ago: %.2f %s (%.2f%%)\n" "$betaw20_2week_price" "$currency_symbol" "$week2_change" + fi + if [ -n "$betaw20_month_price" ] && [ "$betaw20_month_price" != "null" ]; then + month_change=$(echo "scale=4; (($betaw20_price - $betaw20_month_price) / $betaw20_month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Month ago: %.2f %s (%.2f%%)\n" "$betaw20_month_price" "$currency_symbol" "$month_change" + fi + if [ -n "$betaw20_month_price" ] && [ "$betaw20_month_price" != "null" ] && [ -n "$betaw20_7month_price" ] && [ "$betaw20_7month_price" != "null" ]; then + six_month_gain=$(echo "scale=4; (($betaw20_month_price - $betaw20_7month_price) / $betaw20_7month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 6-month gain (7m ago to 1m ago): %.2f%%\n" "$six_month_gain" + fi + if [ -n "$betaw20_month_price" ] && [ "$betaw20_month_price" != "null" ] && [ -n "$betaw20_13month_price" ] && [ "$betaw20_13month_price" != "null" ]; then + year_gain=$(echo "scale=4; (($betaw20_month_price - $betaw20_13month_price) / $betaw20_13month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 12-month gain (13m ago to 1m ago): %.2f%%\n" "$year_gain" + fi + else + echo " ❌ BETAW20TR: Error fetching data" + fi + + echo "" + + # Pobierz kurs BETAM40TR (Beta ETF mWIG40TR) + sleep 1 + betam40_response=$(curl -s -A "Mozilla/5.0" 'https://query1.finance.yahoo.com/v8/finance/chart/ETFBM40TR.WA?interval=1d&range=2y' 2>/dev/null) + betam40_price=$(echo "$betam40_response" | grep -o '"regularMarketPrice":[0-9.]*' | head -1 | cut -d':' -f2) + betam40_currency=$(echo "$betam40_response" | grep -o '"currency":"[A-Z]*"' | head -1 | cut -d'"' -f4) + betam40_closes=$(echo "$betam40_response" | grep -o '"close":\[[^]]*\]' | sed 's/"close":\[//;s/\]//' | tr ',' '\n') + betam40_prev_day=$(echo "$betam40_closes" | tail -2 | head -1) + betam40_week_price=$(echo "$betam40_closes" | tail -7 | head -1) + betam40_2week_price=$(echo "$betam40_closes" | tail -14 | head -1) + betam40_month_price=$(echo "$betam40_closes" | tail -31 | head -1) + betam40_7month_price=$(echo "$betam40_closes" | tail -157 | head -1) + betam40_13month_price=$(echo "$betam40_closes" | tail -283 | head -1) + + if [ -n "$betam40_price" ]; then + echo " 🇵🇱 Beta ETF mWIG40TR (BETAM40TR)" + echo " ISIN: PL0ETF000027" + + # Determine currency symbol + if [ "$betam40_currency" = "PLN" ]; then + currency_symbol="zł" + elif [ "$betam40_currency" = "EUR" ]; then + currency_symbol="€" + elif [ "$betam40_currency" = "USD" ]; then + currency_symbol="$" + else + currency_symbol="$betam40_currency" + fi + + LC_NUMERIC=C printf " Price: %.2f %s\n" "$betam40_price" "$currency_symbol" + + if [ -n "$betam40_prev_day" ] && [ "$betam40_prev_day" != "null" ]; then + prev_change=$(echo "scale=4; (($betam40_price - $betam40_prev_day) / $betam40_prev_day) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Previous day: %.2f %s (%.2f%%)\n" "$betam40_prev_day" "$currency_symbol" "$prev_change" + fi + if [ -n "$betam40_week_price" ] && [ "$betam40_week_price" != "null" ]; then + week_change=$(echo "scale=4; (($betam40_price - $betam40_week_price) / $betam40_week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Week ago: %.2f %s (%.2f%%)\n" "$betam40_week_price" "$currency_symbol" "$week_change" + fi + if [ -n "$betam40_2week_price" ] && [ "$betam40_2week_price" != "null" ]; then + week2_change=$(echo "scale=4; (($betam40_price - $betam40_2week_price) / $betam40_2week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 2 weeks ago: %.2f %s (%.2f%%)\n" "$betam40_2week_price" "$currency_symbol" "$week2_change" + fi + if [ -n "$betam40_month_price" ] && [ "$betam40_month_price" != "null" ]; then + month_change=$(echo "scale=4; (($betam40_price - $betam40_month_price) / $betam40_month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Month ago: %.2f %s (%.2f%%)\n" "$betam40_month_price" "$currency_symbol" "$month_change" + fi + if [ -n "$betam40_month_price" ] && [ "$betam40_month_price" != "null" ] && [ -n "$betam40_7month_price" ] && [ "$betam40_7month_price" != "null" ]; then + six_month_gain=$(echo "scale=4; (($betam40_month_price - $betam40_7month_price) / $betam40_7month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 6-month gain (7m ago to 1m ago): %.2f%%\n" "$six_month_gain" + fi + if [ -n "$betam40_month_price" ] && [ "$betam40_month_price" != "null" ] && [ -n "$betam40_13month_price" ] && [ "$betam40_13month_price" != "null" ]; then + year_gain=$(echo "scale=4; (($betam40_month_price - $betam40_13month_price) / $betam40_13month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 12-month gain (13m ago to 1m ago): %.2f%%\n" "$year_gain" + fi + else + echo " ❌ BETAM40TR: Error fetching data" + fi + + echo "" + + # Pobierz kurs BETAS80TR (Beta ETF sWIG80TR) + sleep 1 + betas80_response=$(curl -s -A "Mozilla/5.0" 'https://query1.finance.yahoo.com/v8/finance/chart/ETFBS80TR.WA?interval=1d&range=2y' 2>/dev/null) + betas80_price=$(echo "$betas80_response" | grep -o '"regularMarketPrice":[0-9.]*' | head -1 | cut -d':' -f2) + betas80_currency=$(echo "$betas80_response" | grep -o '"currency":"[A-Z]*"' | head -1 | cut -d'"' -f4) + betas80_closes=$(echo "$betas80_response" | grep -o '"close":\[[^]]*\]' | sed 's/"close":\[//;s/\]//' | tr ',' '\n') + betas80_prev_day=$(echo "$betas80_closes" | tail -2 | head -1) + betas80_week_price=$(echo "$betas80_closes" | tail -7 | head -1) + betas80_2week_price=$(echo "$betas80_closes" | tail -14 | head -1) + betas80_month_price=$(echo "$betas80_closes" | tail -31 | head -1) + betas80_7month_price=$(echo "$betas80_closes" | tail -157 | head -1) + betas80_13month_price=$(echo "$betas80_closes" | tail -283 | head -1) + + if [ -n "$betas80_price" ]; then + echo " 🇵🇱 Beta ETF sWIG80TR (BETAS80TR)" + echo " ISIN: PL0ETF000035" + + # Determine currency symbol + if [ "$betas80_currency" = "PLN" ]; then + currency_symbol="zł" + elif [ "$betas80_currency" = "EUR" ]; then + currency_symbol="€" + elif [ "$betas80_currency" = "USD" ]; then + currency_symbol="$" + else + currency_symbol="$betas80_currency" + fi + + LC_NUMERIC=C printf " Price: %.2f %s\n" "$betas80_price" "$currency_symbol" + + if [ -n "$betas80_prev_day" ] && [ "$betas80_prev_day" != "null" ]; then + prev_change=$(echo "scale=4; (($betas80_price - $betas80_prev_day) / $betas80_prev_day) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Previous day: %.2f %s (%.2f%%)\n" "$betas80_prev_day" "$currency_symbol" "$prev_change" + fi + if [ -n "$betas80_week_price" ] && [ "$betas80_week_price" != "null" ]; then + week_change=$(echo "scale=4; (($betas80_price - $betas80_week_price) / $betas80_week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Week ago: %.2f %s (%.2f%%)\n" "$betas80_week_price" "$currency_symbol" "$week_change" + fi + if [ -n "$betas80_2week_price" ] && [ "$betas80_2week_price" != "null" ]; then + week2_change=$(echo "scale=4; (($betas80_price - $betas80_2week_price) / $betas80_2week_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 2 weeks ago: %.2f %s (%.2f%%)\n" "$betas80_2week_price" "$currency_symbol" "$week2_change" + fi + if [ -n "$betas80_month_price" ] && [ "$betas80_month_price" != "null" ]; then + month_change=$(echo "scale=4; (($betas80_price - $betas80_month_price) / $betas80_month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " Month ago: %.2f %s (%.2f%%)\n" "$betas80_month_price" "$currency_symbol" "$month_change" + fi + if [ -n "$betas80_month_price" ] && [ "$betas80_month_price" != "null" ] && [ -n "$betas80_7month_price" ] && [ "$betas80_7month_price" != "null" ]; then + six_month_gain=$(echo "scale=4; (($betas80_month_price - $betas80_7month_price) / $betas80_7month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 6-month gain (7m ago to 1m ago): %.2f%%\n" "$six_month_gain" + fi + if [ -n "$betas80_month_price" ] && [ "$betas80_month_price" != "null" ] && [ -n "$betas80_13month_price" ] && [ "$betas80_13month_price" != "null" ]; then + year_gain=$(echo "scale=4; (($betas80_month_price - $betas80_13month_price) / $betas80_13month_price) * 100" | LC_NUMERIC=C bc) + LC_NUMERIC=C printf " 12-month gain (13m ago to 1m ago): %.2f%%\n" "$year_gain" + fi + else + echo " ❌ BETAS80TR: Error fetching data" + fi + + echo "" + echo " Updated: $(date '+%Y-%m-%d %H:%M:%S')" + echo " Press Ctrl+C to exit" + echo "" + echo " Next update in 30 minutes..." + + # Czekaj 30 minut przed następnym odświeżeniem + sleep 1800 +done diff --git a/passmenu-otp b/passmenu-otp index d511944..11a236b 100755 --- a/passmenu-otp +++ b/passmenu-otp @@ -1,24 +1,28 @@ #!/bin/sh set -eu +# Config : "${PASSWORD_STORE_DIR:=$HOME/.password-store}" DMENU="${DMENU:-dmenu}" +OTP_PREFIX="${OTP_PREFIX:-otp}" # expects entries under $PASSWORD_STORE_DIR/otp/ -# Build list of pass entry paths (relative to PASSWORD_STORE_DIR) that contain an otpauth:// line. +otp_dir="$PASSWORD_STORE_DIR/$OTP_PREFIX" + +# If no otp/ subtree exists, exit quietly +[ -d "$otp_dir" ] || exit 0 + +# Build list of entry names from filenames only (no decryption). entries=$( - find "$PASSWORD_STORE_DIR" -type f -name '*.gpg' ! -path '*/.git/*' -print 2>/dev/null | - while IFS= read -r f; do - entry="${f#$PASSWORD_STORE_DIR/}" - entry="${entry%.gpg}" - if pass show "$entry" 2>/dev/null | grep -q '^otpauth://'; then - printf '%s\n' "$entry" - fi - done + find "$otp_dir" -type f -name '*.gpg' ! -path '*/.git/*' -print 2>/dev/null | + sed -e "s|^$PASSWORD_STORE_DIR/||" -e 's|\.gpg$||' | + sort ) [ -n "${entries:-}" ] || exit 0 -choice=$(printf '%s\n' "$entries" | "$DMENU" -i -p "OTP:") +choice=$(printf '%s\n' "$entries" | $DMENU -i -p "OTP:") [ -n "${choice:-}" ] || exit 0 +# Copy OTP to clipboard using pass-otp extension (-c handles clipboard + clearing). pass otp -c "$choice" + diff --git a/rofi-task-names b/rofi-task-names new file mode 100755 index 0000000..965bb93 --- /dev/null +++ b/rofi-task-names @@ -0,0 +1,26 @@ +#!/bin/sh +set -eu + +DB="$HOME/.local/share/cheat-sheets/task-tags.tsv" + +[ -f "$DB" ] || exit 1 + +choice="$( + cat "$DB" | + rofi -dmenu -i -p 'Naming conventions ›' +)" + +[ -n "${choice:-}" ] || exit 0 + +# First column = keystrokes +keys="$(printf '%s' "$choice" | cut -f1)" + +# Clipboard (Wayland/X11) +if command -v wl-copy >/dev/null 2>&1; then + printf '%s' "$keys" | wl-copy +elif command -v xclip >/dev/null 2>&1; then + printf '%s' "$keys" | xclip -selection clipboard +else + printf '%s\n' "$keys" +fi + diff --git a/backup_shield.sh b/shield-backup index 96f9269..96f9269 100755 --- a/backup_shield.sh +++ b/shield-backup diff --git a/luks-shield b/shield-mount index 9080f35..9080f35 100755 --- a/luks-shield +++ b/shield-mount @@ -0,0 +1,4 @@ +#!/bin/sh +mkdir -p "$HOME/.cache/simplex-tmp" +export TMPDIR="$HOME/.cache/simplex-tmp" +exec st -e simplex-chat diff --git a/backup_usb.sh b/usb-backup index 8c81b69..8c81b69 100755 --- a/backup_usb.sh +++ b/usb-backup diff --git a/usb-tether.sh b/usb-tether index bbe16ed..bbe16ed 100755 --- a/usb-tether.sh +++ b/usb-tether |
