-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
131 lines (111 loc) · 3.51 KB
/
Justfile
File metadata and controls
131 lines (111 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
default:
@just --list
clean:
rm -rf markout || echo "markout directory not found"
# make sure to re-encode from plain text file to b64 file so as to not reset the file during build
@just encode-private
@just decode-private
uv run markata clean
build:
# make sure to re-encode from plain text file to b64 file so as to not reset the file during build
@just encode-private
@just decode-private
uv run markata build
cp -r .well-known markout/
rm markout/markata.json
@just encode-private
clean-build:
@just clean
@just build
serve:
@just build
python -m http.server -d markout 8123
clean-serve:
@just clean
@just build
python -m http.server -d markout 8123
tailwind:
npx tailwindcss --input tailwind/input.css --output static/app.css --minify --watch
# npx tailwindcss --input tailwind/input.css --output static/app.css --minify
# Base64 encode private files to obfuscate from GitHub search
encode-private:
#!/bin/bash
echo "Encoding private files..."
for file in pages/private/*.md; do
if [ -f "$file" ] && [[ "$file" != *.b64 ]]; then
echo "Encoding: $file"
base64 -w 0 "$file" > "$file.b64"
rm "$file"
fi
done
echo "Private files encoded."
# Base64 decode private files for build time
decode-private:
#!/bin/bash
echo "Decoding private files..."
for file in pages/private/*.b64; do
if [ -f "$file" ]; then
original="${file%.b64}"
echo "Decoding: $file -> $original"
base64 -d "$file" > "$original"
fi
done
echo "Private files decoded."
# Manually encode all private files (for initial setup or manual use)
manual-encode-private:
@just encode-private
# Manually decode all private files (for editing)
manual-decode-private:
@just decode-private
[group('i-was-wrecked')]
get-vault-key:
bws secret get $HOMELAB_BOT_VAULT_KEY_ID | jq -r '.value'
[group('i-was-wrecked')]
encrypt:
#!/bin/bash
set +e
just get-vault-key > key
ansible-vault encrypt ./secret-file --vault-password-file key
ansible-vault encrypt ./secret-file2 --vault-password-file key
rm key
[group('i-was-wrecked')]
decrypt:
#!/bin/bash
set +e
just get-vault-key > key
ansible-vault decrypt ./secret-file --vault-password-file key
ansible-vault decrypt ./secret-file2 --vault-password-file key
rm key
[group('i-was-wrecked')]
encrypt-unsafe:
#!/bin/bash
set -e
just get-vault-key >> key
ansible-vault encrypt ./secret-file --vault-password-file key
ansible-vault encrypt ./secret-file2 --vault-password-file key
rm key
[group('i-was-wrecked')]
decrypt-unsafe:
#!/bin/bash
set -e
just get-vault-key >> key
ansible-vault decrypt ./secret-file --vault-password-file key
ansible-vault decrypt ./secret-file2 --vault-password-file key
rm key
# List and open draft posts (published: false) in fzf picker
drafts:
#!/bin/bash
set -e
draft_files=$(uvx --with python-frontmatter python scripts/find_drafts.py)
if [ -z "$draft_files" ]; then
echo "No drafts found"
exit 0
fi
selected=$(echo "$draft_files" | fzf --delimiter="|" --with-nth=2 --preview="cat {1}" --preview-window=right:60%:wrap --header="Select a draft to edit" | cut -d"|" -f1)
if [ -n "$selected" ] && [ -f "$selected" ]; then
if [ -n "$EDITOR" ]; then
"$EDITOR" "$selected"
else
vim "$selected"
fi
fi