Compare commits

...

10 Commits

Author SHA1 Message Date
Trevor Vallender 7e01e88b9d Log to a file 2023-09-22 14:56:19 +01:00
Trevor Vallender f0aead5584 All the things I forgot to commit 2023-09-15 10:02:42 +01:00
Trevor Vallender 067598a965 Add push to site compilation, small cleanups 2023-07-07 17:58:08 +01:00
Trevor Vallender 661b3b231c Add startup script for launching Hyprland 2023-06-13 09:04:19 +01:00
Trevor Vallender 4de0c6bcab Input a test command to bundle update script 2023-06-13 08:52:57 +01:00
Trevor Vallender 305c257716 Optimise site script
Now working more specifically with the site subdir of notes.
2023-06-05 11:15:05 +01:00
Trevor Vallender bd798bc35f Added Bundle udpate script 2023-06-01 14:22:51 +01:00
Trevor Vallender 4d3bde3d9d Improvements to site compiler 2023-06-01 13:09:19 +01:00
Trevor Vallender 30e37785ed First pass at site compiler
Takes vimwiki notes and throws them into HTML.

Still need to:
- Fix links on output
- Add header/footer
- Password-protect private dir
2023-05-26 11:20:55 +01:00
Trevor Vallender 4a4d524eb4 Wrapper script for aerc 2023-05-26 11:20:47 +01:00
9 changed files with 352 additions and 4 deletions

21
aerc.bash Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Best practice options
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
cd "$(dirname "$0")"
main() {
export BW_SESSION=$(
bw unlock --passwordfile ~/.bwpass |
grep "\--session " |
awk '{print $NF}'
)
aerc
}
main "$@"

41
bundle_update.sh Executable file
View File

@ -0,0 +1,41 @@
#!/usr/bin/env bash
# Best practice options
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
echo 'Usage:
bundle_update.sh test_command
'
exit
fi
declare -a UPDATE_LEVELS=(patch minor major)
TEST_COMMAND=$1
$TEST_COMMAND
if [ $? -ne 0 ]; then
echo "Tests failed prior to updating any gems. Exiting."
exit
fi
DATE=`date "+%F"`
git checkout -b "bundle_update_$DATE"
for level in "${UPDATE_LEVELS[@]}"; do
dip bundle update --$level
$TEST_COMMAND
if [ $? -ne 0 ]; then
echo "Tests failed after $level update, rolling those changes back."
git restore .
break
else
echo "Tests passed after $level update, committing changes."
git add -A
git commit -m "Successful automatic $level update"
fi
done
git push -u origin $(git symbolic-ref --short HEAD) -o merge_request.create # Create remote branch

68
c66.bash Executable file
View File

@ -0,0 +1,68 @@
#!/usr/bin/env bash
# Best practice options
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
echo 'Usage:
c66 ssh Select and SSH to a server
c66 log file role Select a stack and tail the file “file” on all its servers
'
exit
fi
pushd ~
############################################################
## Main commands
############################################################
cx_ssh() {
set_stack
set_server
cx ssh --stack $APPLICATION --environment $ENVIRONMENT $SERVER
}
cx_log() {
set_stack
OUTPUT_FILE=$(mktemp)
echo "Logging to $OUTPUT_FILE"
SERVERS=$(cx servers list --stack $APPLICATION --environment $ENVIRONMENT | grep "\[.*$ROLE.*\]" | cut -d ' ' -f1)
for SERVER in ${SERVERS// /} ; do
echo "Following $LOG_FILE on $SERVER"
cx tail --stack $APPLICATION --environment $ENVIRONMENT $SERVER $LOG_FILE > ./$SERVER.log &
done
#tail -f $OUTPUT_FILE
#pkill cx
}
############################################################
## Helper functions
############################################################
set_stack() {
STACK=$(cx stacks list | fzf)
APPLICATION=$(echo $STACK | cut -d ' ' -f1)
ENVIRONMENT=$(echo $STACK | cut -d ' ' -f2)
}
set_server() {
SERVER=$(cx servers list --stack $APPLICATION --environment $ENVIRONMENT | fzf | cut -d ' ' -f1)
}
if [[ $# -eq 0 ]] ; then
echo "No arguments given. Use -h for help."
exit
fi
if [[ $1 = "ssh" ]] ; then
cx_ssh
elif [[ $1 = "log" ]] ; then
LOG_FILE=$2
ROLE=$3
cx_log
fi
popd

11
convert_countries.rb Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env ruby
require 'active_support/core_ext/string/inflections'
file = "/home/tsv/foxsoft/directors-uk/clapboard/app/models/concerns/progress_countries.rb"
File.open(file, "r+") do |f|
while(line = f.gets) != nil
m = line.match /\s\[\"(?<country>[\w\s\:\&\'\-\;\(\)]*)\".*\]/
puts line.gsub(m[:country], m[:country].titlecase) if m
end
end

72
make_site.bash Executable file
View File

@ -0,0 +1,72 @@
#!/usr/bin/env bash
# Best practice options
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
echo 'Usage:
'
exit
fi
INPUT_DIR=~/notes/site
OUTPUT_DIR=~/public_html
pushd ~
# Recursively iterate over directories, calling process_file on .md files
traverse_dir() {
local dir=$1
local depth=$2
for d in $dir; do
OUTPUT=$OUTPUT_DIR${d##$INPUT_DIR}
if [ -d "$d" ]; then
mkdir -p $OUTPUT
traverse_dir "$d/*" $((depth+1))
elif [[ $d == *.md ]]; then
OUTPUT=${OUTPUT%.md}.html
process_file "$d" "$OUTPUT" $depth
fi
done
}
# Take a Markdown file and process it to HTML
process_file() {
local INPUT=$1
local OUTPUT=$2
local depth=$3
local TITLE=${INPUT%.md}
TITLE=${TITLE##*/}
if [ "$TITLE" == 'index' ]; then
TITLE='Home'
fi
pandoc -f markdown -t html -o "$OUTPUT" -i "$INPUT" --standalone --template ~/code/site/template.html --variable=pagetitle:"$TITLE"
replace_links "$OUTPUT" $depth
}
# Replace links in Markdown files with working links to the new HTML files
replace_links() {
local FILE=$1
local depth=$2
# Add .html extensions
sed -Ei.bak '/https|\.[a-z]+/!s/href="[^"]*/&.html/' "$FILE"
if [ "$depth" -gt 0 ]; then
local path=$(for each in $(seq 1 $depth); do printf "..\/"; done)
local href="${path}style.css"
sed -i "s/href='style.css'/href='${href}'/g" "$FILE"
fi
}
setup_files() {
cp -r ~/code/site/assets/ ~/public_html/
cp ~/code/site/style.css ~/public_html
}
traverse_dir $INPUT_DIR/\* 0
setup_files
rsync -arz ~/public_html/* -e ssh tsv@kernighan:/var/www/tsvallender.co.uk
popd

23
obs_mount.bash Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Best practice options
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
echo 'Usage:
'
exit
fi
pushd ~
[ -d ~/sshfs/obs ] || mkdir -p ~/sshfs/obs
sshfs obs:/srv/salt ~/sshfs/obs
pushd ~/sshfs/obs
nvim
umount ~/sshfs/obs
popd
popd

18
startup.bash Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Best practice options
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
main() {
keyctl link @us @s
Hyprland
}
pushd ~
main "$@"
popd

94
tmp.html Normal file
View File

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta name="author" content="Trevor Vallender">
<meta name="description" content="Personal site of Trevor Vallender, software engineer">
<title>index | T S Vallender</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>T S Vallender</h1>
<h4>Software Engineer, nerd, maker and dad.</h4>
</header>
<main>
<h2 id="learning-plan"><a href="Learning%20plan">Learning
plan</a></h2>
<h2 id="foxsoft-todo">Foxsoft Todo</h2>
<ul class="incremental" class="task-list">
<li><input type="checkbox" disabled="" />Set up devenv on OxEd</li>
<li><input type="checkbox" disabled="" />Solve <a
href="https://github.com/bobvanderlinden/nixpkgs-ruby/issues/6">SSL
issue</a></li>
<li><input type="checkbox" disabled="" />Use pgcli</li>
<li><input type="checkbox" disabled="" />Create CI command</li>
<li><input type="checkbox" disabled="" />SLA Redmine script</li>
<li><input type="checkbox" disabled="" />Git changelog script</li>
</ul>
<h2 id="personal-todo">Personal Todo</h2>
<ul class="incremental">
<li><input type="checkbox" disabled="" checked="" />Secure email
passwords and commit accounts to repo</li>
<li><input type="checkbox" disabled="" />Fix issues with aerc (w3m
links/images, non-clickable links in kitty)</li>
<li><input type="checkbox" disabled="" checked="" />Set up tmux
pairing nicely</li>
<li><input type="checkbox" disabled="" checked="" />Set up tmux
keybindings</li>
<li><input type="checkbox" disabled="" checked="" />Move NixOS
config to Flakes</li>
<li><input type="checkbox" disabled="" checked="" />Set up
Hyprland</li>
<li><input type="checkbox" disabled="" checked="" />Solve Neovim
vimwiki errors</li>
<li><input type="checkbox" disabled="" />Move from gitea to standard
git UI</li>
<li><input type="checkbox" disabled="" checked="" />Fix note
sync</li>
<li><input type="checkbox" disabled="" />Fix photo sync issues</li>
<li><input type="checkbox" disabled="" />Set up separate hosts
correctly in Nix config</li>
<li><input type="checkbox" disabled="" />Move kernighan to nix</li>
<li><input type="checkbox" disabled="" />Fix personal site</li>
<li><input type="checkbox" disabled="" />Compile vimwiki notes
automatically</li>
<li><input type="checkbox" disabled="" checked="" />Move
HomeAssistant Pi to other case</li>
<li><input type="checkbox" disabled="" checked="" />Fix
HomeAssistant lighting</li>
<li><input type="checkbox" disabled="" checked="" />Download all
audiobooks</li>
<li><input type="checkbox" disabled="" />Set up routine
script</li>
<li><input type="checkbox" disabled="" />Look into
folder-per-branch</li>
<li>Finish Hyprland setup</li>
<li><input type="checkbox" disabled="" />Wallpaper per-desktop
https://github.com/hyprwm/hyprpaper</li>
<li><input type="checkbox" disabled="" checked="" />Codeium
https://github.com/jcdickinson/codeium.nvim/issues/18</li>
<li><input type="checkbox" disabled="" checked="" />Set up Compose
key</li>
<li><input type="checkbox" disabled="" checked="" />Dunst
notifications</li>
<li><input type="checkbox" disabled="" checked="" />Screenshots</li>
<li><input type="checkbox" disabled="" checked="" />Persist network
connection</li>
<li><input type="checkbox" disabled="" checked="" />Try out
qutebrowser</li>
<li><input type="checkbox" disabled="" />Set up Pass password
manager</li>
<li><input type="checkbox" disabled="" />Integrate pass with
qutebrowser</li>
</ul>
<h2 id="notes">Notes</h2>
<ul class="incremental">
<li><a href="Wishlist">Wishlist</a></li>
<li><a href="Stop%20branching">Stop branching</a></li>
<li><a href="Oxed%20Estimates">OxEd Estimates</a></li>
</ul>
</main>
</body>
</html>

View File

@ -7,9 +7,9 @@ set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
echo 'Usage: echo 'Usage:
tp new Start a new tmux session (unshared) tp new Start a new tmux session (unshared)
tp share Share an existing session (read-only) tp sharero Share an existing session (read-only)
tp sharew Share an existing session (write-access) tp sharew Share an existing session (write-access)
tp unshare Remove share from existing session tp unshare Remove share from existing session
' '
@ -18,7 +18,7 @@ fi
pushd ~ pushd ~
SOCKET_PATH="/var/tmux_share/shared" SOCKET_PATH="/var/tmux_share/shared"
SHARED_USER="foxsoft" # Should change this to use getent group tmux SHARED_USER="foxsoft" # Should change this to use getent group tmux
share_ro_session() { share_ro_session() {
@ -55,7 +55,7 @@ fi
if [[ $1 = "new" || $1 = "n" ]] ; then if [[ $1 = "new" || $1 = "n" ]] ; then
new_session new_session
elif [[ $1 = "sharero" || $1 = "sro" ]] ; then elif [[ $1 = "sharero" || $1 = "sro" ]] ; then
share_session share_ro_session
elif [[ $1 = "sharew" || $1 = "srw" ]] ; then elif [[ $1 = "sharew" || $1 = "srw" ]] ; then
share_rw_session share_rw_session
elif [[ $1 = "unshare" ]] ; then elif [[ $1 = "unshare" ]] ; then