generation 487 25.11.20250714.62e0f05
This commit is contained in:
@@ -107,6 +107,8 @@ in {
|
|||||||
feh
|
feh
|
||||||
ncdu
|
ncdu
|
||||||
clisp
|
clisp
|
||||||
|
libsForQt5.qt5.qttools
|
||||||
|
bc # for qdbus + bc for pomodoro script
|
||||||
# rocmPackages.llvm.clang-unwrapped
|
# rocmPackages.llvm.clang-unwrapped
|
||||||
# direnv
|
# direnv
|
||||||
# emacs # haha
|
# emacs # haha
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# blatently adapted from: https://gist.github.com/0atman/1a5133b842f929ba4c1e195ee67599d5
|
|
||||||
|
|
||||||
# set -e
|
|
||||||
|
|
||||||
# cd to your config dir
|
|
||||||
pushd /home/synchronous/nix-cfg
|
|
||||||
|
|
||||||
# early return if no changes are given
|
|
||||||
git --git-dir /home/synchronous/nix-cfg/.git add .
|
|
||||||
if git --git-dir /home/synchronous/nix-cfg/.git diff-index --quiet HEAD; then
|
|
||||||
echo "No changes detected, exiting."
|
|
||||||
popd
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
nix flake check /home/synchronous/nix-cfg/
|
|
||||||
|
|
||||||
# Autoformat your nix files
|
|
||||||
alejandra . &>/dev/null \
|
|
||||||
|| ( alejandra . ; echo "formatting failed!" && exit 1)
|
|
||||||
|
|
||||||
# shows changes between last commit and head
|
|
||||||
|
|
||||||
# git --git-dir /home/synchronous/nix-cfg/.git add .
|
|
||||||
# git --git-dir /home/synchronous/nix-cfg/.git --no-pager diff -U0
|
|
||||||
git --git-dir /home/synchronous/nix-cfg/.git --no-pager diff HEAD -U0
|
|
||||||
# '*.nix'
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Summary:"
|
|
||||||
git status --porcelain
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "NixOS Rebuilding..."
|
|
||||||
|
|
||||||
# Rebuild, output simplified errors, log trackebacks
|
|
||||||
sudo /run/current-system/sw/bin/nixos-rebuild switch --flake /home/synchronous/nix-cfg/flake.nix &> /tmp/nixos-switch.log
|
|
||||||
# cat /tmp/nixos-switch.log | grep --color error && exit 1
|
|
||||||
|
|
||||||
if grep --color error /tmp/nixos-switch.log; then
|
|
||||||
# cat /tmp/nixos-switch.log | grep --color error
|
|
||||||
read -p "Would you like to view the error log? (y/n): " choice
|
|
||||||
choice=${choice:-n}
|
|
||||||
if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
|
|
||||||
cat /tmp/nixos-switch.log
|
|
||||||
fi
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get current generation metadata
|
|
||||||
current=$(nixos-rebuild list-generations | grep current)
|
|
||||||
|
|
||||||
# Commit all changes witih the generation metadata
|
|
||||||
git --git-dir /home/synchronous/nix-cfg/.git add .
|
|
||||||
git --git-dir /home/synchronous/nix-cfg/.git commit -am "$current"
|
|
||||||
|
|
||||||
# Back to where you were
|
|
||||||
popd
|
|
||||||
|
|
||||||
# rm /tmp/nixos-switch.log
|
|
||||||
|
|
||||||
# Notify all OK!
|
|
||||||
notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "Full rebuild log in /tmp/nixos-switch.log"
|
|
||||||
@@ -122,9 +122,13 @@ in {
|
|||||||
name = "general phd resources";
|
name = "general phd resources";
|
||||||
url = "https://csd.cmu.edu/academics/doctoral-resources";
|
url = "https://csd.cmu.edu/academics/doctoral-resources";
|
||||||
}
|
}
|
||||||
|
# {
|
||||||
|
# name = "cmu orders";
|
||||||
|
# url = "https://rams.srv.cs.cmu.edu/ords/";
|
||||||
|
# }
|
||||||
{
|
{
|
||||||
name = "orders";
|
name = "cmu sio";
|
||||||
url = "https://rams.srv.cs.cmu.edu/ords/";
|
url = "https://s3.andrew.cmu.edu/sio";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "husker";
|
name = "husker";
|
||||||
@@ -134,6 +138,10 @@ in {
|
|||||||
name = "mit library experts";
|
name = "mit library experts";
|
||||||
url = "https://libraries.mit.edu/experts/";
|
url = "https://libraries.mit.edu/experts/";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name = "cmu canvas";
|
||||||
|
url = "https://canvas.cmu.edu/";
|
||||||
|
}
|
||||||
{
|
{
|
||||||
name = "cmu email";
|
name = "cmu email";
|
||||||
url = "https://email.cmu.edu";
|
url = "https://email.cmu.edu";
|
||||||
|
|||||||
86
home/scripts/music/cmus-status.sh
Normal file
86
home/scripts/music/cmus-status.sh
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
#
|
||||||
|
is_valid_utf8() {
|
||||||
|
local input="$1"
|
||||||
|
local converted=$(echo -n "$input" | iconv -f utf-8 -t utf-16 | iconv -f utf-16 -t utf-8)
|
||||||
|
[[ "$input" == "$converted" ]] && return 0 || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# if cmus or spotify isn't running, this exit will trigger
|
||||||
|
er="$(cmus-remote -Q 2> /dev/null)"
|
||||||
|
eq="$(playerctl --player=spotify status 2> /dev/null)"
|
||||||
|
if [ "$er" == "" ] && [ "$eq" == "" ] ;then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#sspot="$()"
|
||||||
|
#if [[ "$eq" == "Paused" ]];then
|
||||||
|
|
||||||
|
if [[ "$eq" != "" ]]; then
|
||||||
|
stitle="$(playerctl --player=spotify metadata --format "{{ title }}" 2> /dev/null)"
|
||||||
|
sartist="$(playerctl --player=spotify metadata --format "{{ artist }}" 2> /dev/null)"
|
||||||
|
|
||||||
|
if [ ${#sartist} -gt 13 ]; then
|
||||||
|
sartist="${sartist:0:$((13))}.."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${#stitle} -gt 20 ]; then
|
||||||
|
stitle="${stitle:0:$((20))}.."
|
||||||
|
fi
|
||||||
|
|
||||||
|
soutput="$sartist — $stitle"
|
||||||
|
rb=""
|
||||||
|
if [[ "$eq" == "Paused" ]]; then
|
||||||
|
rb="| ";
|
||||||
|
elif [[ "$eq" == "Playing" ]]; then
|
||||||
|
rb="> ";
|
||||||
|
fi
|
||||||
|
soutput="${rb}${soutput}"
|
||||||
|
|
||||||
|
if is_valid_utf8 "$soutput"; then
|
||||||
|
echo "$soutput"
|
||||||
|
else
|
||||||
|
echo "not UTF-8 :("
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$soutput"
|
||||||
|
elif [[ "$er" != "" ]]; then
|
||||||
|
# if cmus isn't currently playing a song, this will trigger
|
||||||
|
artist="$(cmus-remote -Q 2> /dev/null | awk -F"tag artist " '{print $2}' | tr -d '\n')"
|
||||||
|
if [[ "$artist" == "false" ]] ;then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
title="$( cmus-remote -Q 2> /dev/null | awk -F"tag title " '{print $2}' | tr -d '\n')"
|
||||||
|
|
||||||
|
if [ ${#artist} -gt 13 ]; then
|
||||||
|
artist="${artist:0:$((13))}.."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${#title} -gt 20 ]; then
|
||||||
|
title="${title:0:$((20))}.."
|
||||||
|
fi
|
||||||
|
|
||||||
|
ss="$(cmus-remote -Q 2> /dev/null| awk -F/ NR==1'{print $NF}'|awk -F. '{print $1}')"
|
||||||
|
|
||||||
|
output="$artist — $title"
|
||||||
|
scroll_length=30
|
||||||
|
|
||||||
|
# if not playing
|
||||||
|
if [[ "$ss" != "status playing" ]]; then
|
||||||
|
# to be completed..
|
||||||
|
r="| "
|
||||||
|
output="${r}${output}"
|
||||||
|
# if is playing
|
||||||
|
else
|
||||||
|
r="> "
|
||||||
|
output="${r}${output}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if is_valid_utf8 "$output"; then
|
||||||
|
echo "$output"
|
||||||
|
else
|
||||||
|
echo "not UTF-8 :("
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
24
home/scripts/pomodoro.sh
Normal file
24
home/scripts/pomodoro.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
state="$(qdbus org.gnome.Pomodoro /org/gnome/Pomodoro org.freedesktop.DBus.Properties.Get org.gnome.Pomodoro State)"
|
||||||
|
if [ "$state" == "null" ]; then
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
elapsed=$(qdbus org.gnome.Pomodoro /org/gnome/Pomodoro org.freedesktop.DBus.Properties.Get org.gnome.Pomodoro Elapsed)
|
||||||
|
state_duration=$(qdbus org.gnome.Pomodoro /org/gnome/Pomodoro org.freedesktop.DBus.Properties.Get org.gnome.Pomodoro StateDuration)
|
||||||
|
|
||||||
|
remaining=$(echo "$state_duration - $elapsed" | bc)
|
||||||
|
|
||||||
|
# Format the remaining time as minutes:seconds
|
||||||
|
minutes=$(echo "$remaining / 60" | bc)
|
||||||
|
seconds=$(echo "$remaining % 60" | bc)
|
||||||
|
|
||||||
|
# Pad seconds with leading zero if necessary
|
||||||
|
printf -v seconds "%02d" $seconds 2> /dev/null
|
||||||
|
|
||||||
|
if [ "$state" == "short-break" ]; then
|
||||||
|
state="break"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$state - $minutes:$seconds"
|
||||||
|
|
||||||
Reference in New Issue
Block a user