Compare commits
4 Commits
283ef0417b
...
d38de67704
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d38de67704 | ||
|
|
b0d8421b70 | ||
|
|
434c84caf6 | ||
|
|
0e65223381 |
@@ -5,7 +5,7 @@ SCRIPT_DIR="$(dirname $(realpath "$0"))"
|
|||||||
function run() {
|
function run() {
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
echo "Usage: $0 <category> <script> [args...]"
|
echo "Usage: $0 <category> <script> [args...]"
|
||||||
find "$SCRIPT_DIR" -mindepth 2 | awk -F'[./]' '{printf "$ run %s %s\n",$(NF-2),$(NF-1)}'
|
find "$SCRIPT_DIR" -mindepth 2 -iname "*.sh" | awk -F'[./]' '{printf "$ run %s %s\n",$(NF-2),$(NF-1)}'
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
bash "$SCRIPT_DIR/$1/$2.sh" ${@:3}
|
bash "$SCRIPT_DIR/$1/$2.sh" ${@:3}
|
||||||
|
|||||||
@@ -9,4 +9,5 @@ i3 workspace number 2
|
|||||||
i3 move workspace to output right
|
i3 move workspace to output right
|
||||||
i3 workspace number 3
|
i3 workspace number 3
|
||||||
i3 move workspace to output right
|
i3 move workspace to output right
|
||||||
|
i3 workspace number 3
|
||||||
i3 move workspace to output right
|
i3 move workspace to output right
|
||||||
|
|||||||
21
ledger/setup.sh
Normal file
21
ledger/setup.sh
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
read -p "Enter your setup token: " token
|
||||||
|
|
||||||
|
while : ; do
|
||||||
|
read -sp "Enter password: " password
|
||||||
|
echo
|
||||||
|
read -sp "Confirm password: " confirmed
|
||||||
|
echo
|
||||||
|
[[ "$password" == "$confirmed" ]] && break || echo "Passwords are not equal."
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
CLAIM_URL="$(echo "$token" | base64 -d)"
|
||||||
|
ACCESS_URL="$(curl -H "Content-Length: 0" -X POST "$CLAIM_URL")"
|
||||||
|
|
||||||
|
echo "Claim URL: $CLAIM_URL"
|
||||||
|
echo "Access URL: $ACCESS_URL"
|
||||||
|
|
||||||
|
echo "$ACCESS_URL" | openssl aes-256-cbc -salt -a -pbkdf2 -iter 1000000 -pass "pass:$password" > ~/.simplefin.enc
|
||||||
|
|
||||||
23
ledger/update.jq
Normal file
23
ledger/update.jq
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
def format_transactions:
|
||||||
|
map(
|
||||||
|
.name as $name |
|
||||||
|
.transactions |
|
||||||
|
map(.account = $name)[]
|
||||||
|
) |
|
||||||
|
sort_by(.transacted_at) |
|
||||||
|
map(
|
||||||
|
(.transacted_at | strftime("%Y/%m/%d")) + " " +
|
||||||
|
(.description | gsub("\\s+"; " ")) + "\n UNKNOWN $" +
|
||||||
|
(-(.amount | tonumber) | tostring) + " ; Payee: " +
|
||||||
|
.payee + "\n " +
|
||||||
|
.account + "\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
def rename_accounts:
|
||||||
|
map(.name |= (
|
||||||
|
if (.| startswith("Adv Plus Banking")) then "Checking"
|
||||||
|
elif (.| startswith("Unlimited Cash Rewards Visa Signature")) then "Credit"
|
||||||
|
elif (.| startswith("Amazon Prime Rewards Visa Signature")) then "Amazon"
|
||||||
|
end));
|
||||||
|
|
||||||
|
.accounts | rename_accounts | format_transactions[]
|
||||||
17
ledger/update.sh
Normal file
17
ledger/update.sh
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [[ $# < 1 ]]; then
|
||||||
|
echo "Usage: $0 <start-date>"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "~/.simplefin.enc" ]]; then
|
||||||
|
echo "Simplefin access URL is missing."
|
||||||
|
echo "Please run the setup script before running update."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
||||||
|
ACCESS_URL="$(cat ~/.simplefin.enc | openssl aes-256-cbc -d -a -salt -pbkdf2 -iter 1000000)"
|
||||||
|
|
||||||
|
curl -L "${ACCESS_URL}/accounts?start-date=$(date -d "$1" '+%s')&pending=1" | jq -r -f "${SCRIPT_DIR}/update.jq"
|
||||||
27
life/left.sh
Normal file
27
life/left.sh
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
MINUTE=60
|
||||||
|
HOUR=$(($MINUTE * 60))
|
||||||
|
DAY=$(($HOUR * 24))
|
||||||
|
MONTH=$(($DAY * 30))
|
||||||
|
YEAR=$(($DAY * 365))
|
||||||
|
|
||||||
|
if [[ $# < 2 ]]; then
|
||||||
|
echo "Usage: $0 <birthdate> <age>"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_lifetime() {
|
||||||
|
future=$(date +%s -d "$1 + $2 years")
|
||||||
|
epoch=$(($future - $(date +%s)))
|
||||||
|
|
||||||
|
echo "Seconds until $2 years old: $epoch"
|
||||||
|
echo "Minutes until $2 years old: $(($epoch / $MINUTE))"
|
||||||
|
echo "Hours until $2 years old: $(($epoch / $HOUR))"
|
||||||
|
echo "Days until $2 years old: $(($epoch / $DAY))"
|
||||||
|
echo "Months until $2 years old: $(($epoch / $MONTH))"
|
||||||
|
echo "Years until $2 years old: $(($epoch / $YEAR))"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print_lifetime "$1" "$2"
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
cd ~/dotfiles
|
cd ~/dotfiles
|
||||||
git pull
|
git pull
|
||||||
|
git submodule init
|
||||||
git submodule update
|
git submodule update
|
||||||
sudo nixos-rebuild switch --flake ~/dotfiles
|
sudo nixos-rebuild switch --flake ~/dotfiles
|
||||||
home-manager switch --flake ~/dotfiles
|
home-manager switch --flake ~/dotfiles
|
||||||
|
|||||||
Reference in New Issue
Block a user