From b584329740ab8453852cad6176558d4af4079b7c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 6 Dec 2018 12:18:16 -0200 Subject: Add mail files to GC routine. --- scripts/gc.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/gc.sh b/scripts/gc.sh index 9670149..ac1b412 100755 --- a/scripts/gc.sh +++ b/scripts/gc.sh @@ -45,14 +45,15 @@ docker rm $(docker ps -a -q) echo y | docker volume prune echo y | docker container prune + +# Source: https://www.reddit.com/r/emacs/comments/6wqfp3/notmuch_delete_mail/ +yellow "Clean up deleted email files" +notmuch search --output=files --exclude=false tag:deleted | xargs -I{} rm "{}" +notmuch new + after=$(disk_space) green "Done." green "Disk space before and after:" blue " before: ${before}" blue " after: ${after}" - -# Clean up deleted email files: -# Source: https://www.reddit.com/r/emacs/comments/6wqfp3/notmuch_delete_mail/ -# notmuch search --output=files --exclude=false tag:deleted | xargs -I{} rm "{}" -# notmuch new -- cgit v1.2.3 From d4e6648afd61205136c98fdc56cf151eb437a078 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 22 Dec 2018 18:19:29 -0200 Subject: Move external scripts to bin/. --- bin/git-blame-someone-else | 21 +++++++++++++++++++++ bin/sl | 13 +++++++++++++ bin/sleepsort | 20 ++++++++++++++++++++ scripts/bump.sh | 21 --------------------- scripts/git-blame-someone-else | 21 --------------------- scripts/sl | 13 ------------- scripts/sleepsort | 20 -------------------- 7 files changed, 54 insertions(+), 75 deletions(-) create mode 100755 bin/git-blame-someone-else create mode 100755 bin/sl create mode 100755 bin/sleepsort delete mode 100755 scripts/bump.sh delete mode 100755 scripts/git-blame-someone-else delete mode 100755 scripts/sl delete mode 100755 scripts/sleepsort (limited to 'scripts') diff --git a/bin/git-blame-someone-else b/bin/git-blame-someone-else new file mode 100755 index 0000000..dd71826 --- /dev/null +++ b/bin/git-blame-someone-else @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# Taken from https://github.com/jayphelps/git-blame-someone-else/ + +if [ $# -ne 2 ]; then + >&2 echo "Usage: $0 " + exit 1 +fi + +AUTHOR=$1 +AUTHOR_NAME=$(echo $AUTHOR | perl -wlne '/^(.*?)\s*<.*>$/ and print $1') +AUTHOR_EMAIL=$(echo $AUTHOR | perl -wlne '/^.*\s*<(.*)>$/ and print $1') +COMMIT=$(git rev-parse --short $2) + +{ + GIT_SEQUENCE_EDITOR="sed -i -e 's/^pick $COMMIT/edit $COMMIT/'" git rebase -i $COMMIT~1^^ + GIT_COMMITTER_NAME="$AUTHOR_NAME" GIT_COMMITTER_EMAIL="$AUTHOR_EMAIL" git commit --amend --no-edit --author="$AUTHOR" + # git rebase --continue +} &> /dev/null + +echo "$AUTHOR_NAME is now the author of $COMMIT. You're officially an asshole."; diff --git a/bin/sl b/bin/sl new file mode 100755 index 0000000..2333462 --- /dev/null +++ b/bin/sl @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Taken from: +# https://gir.st/blog/sl-alt.htm + +# sl - prints a mirror image of ls. (C) 2017 Tobias Girstmair, https://gir.st/, GPLv3 + +LEN=$(ls "$@" |wc -L) # get the length of the longest line + +ls "$@" | rev | while read -r line +do + printf "%${LEN}.${LEN}s\\n" "$line" | sed 's/^\(\s\+\)\(\S\+\)/\2\1/' +done \ No newline at end of file diff --git a/bin/sleepsort b/bin/sleepsort new file mode 100755 index 0000000..ea20fcb --- /dev/null +++ b/bin/sleepsort @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Taken from: +# https://www.quora.com/What-is-the-strangest-sorting-algorithm/answer/Nipun-Ramakrishnan + +function f() { + sleep "$1" + echo "$1" +} + +while [ -n "$1" ] +do + f "$1" & + shift +done + +wait + +# example usage: +# sleepsort 5 3 6 3 6 3 1 4 7 diff --git a/scripts/bump.sh b/scripts/bump.sh deleted file mode 100755 index 86eed54..0000000 --- a/scripts/bump.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -function latest_version() { - git tag | sort -V | tail -n 1 -} - -function overflow_bump() { - IFS=".$IFS" - read a b c - if [[ "$b" == 999 ]]; then - echo $((a + 1)).0.0 - elif [[ "$c" == 999 ]]; then - echo $a.$((b + 1)).0 - else - echo $a.$b.$((c + 1)) - fi -} - -latest_version | overflow_bump - -echo "$1" | overflow_bump diff --git a/scripts/git-blame-someone-else b/scripts/git-blame-someone-else deleted file mode 100755 index dd71826..0000000 --- a/scripts/git-blame-someone-else +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -# Taken from https://github.com/jayphelps/git-blame-someone-else/ - -if [ $# -ne 2 ]; then - >&2 echo "Usage: $0 " - exit 1 -fi - -AUTHOR=$1 -AUTHOR_NAME=$(echo $AUTHOR | perl -wlne '/^(.*?)\s*<.*>$/ and print $1') -AUTHOR_EMAIL=$(echo $AUTHOR | perl -wlne '/^.*\s*<(.*)>$/ and print $1') -COMMIT=$(git rev-parse --short $2) - -{ - GIT_SEQUENCE_EDITOR="sed -i -e 's/^pick $COMMIT/edit $COMMIT/'" git rebase -i $COMMIT~1^^ - GIT_COMMITTER_NAME="$AUTHOR_NAME" GIT_COMMITTER_EMAIL="$AUTHOR_EMAIL" git commit --amend --no-edit --author="$AUTHOR" - # git rebase --continue -} &> /dev/null - -echo "$AUTHOR_NAME is now the author of $COMMIT. You're officially an asshole."; diff --git a/scripts/sl b/scripts/sl deleted file mode 100755 index 2333462..0000000 --- a/scripts/sl +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# Taken from: -# https://gir.st/blog/sl-alt.htm - -# sl - prints a mirror image of ls. (C) 2017 Tobias Girstmair, https://gir.st/, GPLv3 - -LEN=$(ls "$@" |wc -L) # get the length of the longest line - -ls "$@" | rev | while read -r line -do - printf "%${LEN}.${LEN}s\\n" "$line" | sed 's/^\(\s\+\)\(\S\+\)/\2\1/' -done \ No newline at end of file diff --git a/scripts/sleepsort b/scripts/sleepsort deleted file mode 100755 index ea20fcb..0000000 --- a/scripts/sleepsort +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# Taken from: -# https://www.quora.com/What-is-the-strangest-sorting-algorithm/answer/Nipun-Ramakrishnan - -function f() { - sleep "$1" - echo "$1" -} - -while [ -n "$1" ] -do - f "$1" & - shift -done - -wait - -# example usage: -# sleepsort 5 3 6 3 6 3 1 4 7 -- cgit v1.2.3 From 09d0598347522ce376d9c1be13795e7179896de9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 22 Dec 2018 18:20:41 -0200 Subject: Remove autotime script. --- scripts/autotime | 76 -------------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100755 scripts/autotime (limited to 'scripts') diff --git a/scripts/autotime b/scripts/autotime deleted file mode 100755 index fb01392..0000000 --- a/scripts/autotime +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env perl6 - -# FIXME: stdin support with lines() -# FIXME: --help and -h support - -sub from-timestamp(Int \timestamp) { - sub formatter($_) { - sprintf '%04d-%02d-%02d %02d:%02d:%02d', - .year, .month, .day, - .hour, .minute, .second, - } - given DateTime.new(+timestamp, :&formatter) { - when .Date.DateTime == $_ { return .Date } - default { return $_ } - } -} - -sub from-date-string(Str $date, Str $time?) { - my $d = Date.new($date); - if $time { - my ( $hour, $minute, $second ) = $time.split(':'); - return DateTime.new(date => $d, :$hour, :$minute, :$second); - } else { - return $d.DateTime; - } -} - -# FIXME: add test -multi sub convert(Int \timestamp) { - from-timestamp(+timestamp); -} - -# FIXME: add test -multi sub convert(Str $date where { try Date.new($_) }, Str $time?) { - from-date-string($date, $time).posix; -} - -# FIXME: add test -#| Convert timestamp to ISO date -multi sub MAIN(Int \timestamp) { - say convert(+timestamp); -} - -# FIXME: add test -#| Convert ISO date to timestamp -multi sub MAIN(Str $date where { try Date.new($_) }, Str $time?) { - say convert($date, $time); -} - -# multi sub MAIN() { -# for lines() -> $line { - -# } -# } - -#| Run internal tests -multi sub MAIN('test') is hidden-from-USAGE { - use Test; - plan 2; - subtest 'timestamp', { - plan 2; - is-deeply from-timestamp(1450915200), Date.new('2015-12-24'), - 'Date';; - my $dt = from-timestamp(1450915201); - is $dt, "2015-12-24 00:00:01", - 'DateTime with string formatting'; - }; - subtest 'from-date-string', { - plan 2; - is from-date-string('2015-12-24').posix, 1450915200, - 'one argument'; - is from-date-string('2015-12-24', '00:00:01').posix, - 1450915201, - 'two arguments'; - }; -} -- cgit v1.2.3 From b89385e035b0fe55edb9afc05496a639d5c4664e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 28 Dec 2018 21:38:11 -0200 Subject: Add cp-todos.sh. --- scripts/cp-todos.sh | 1 + 1 file changed, 1 insertion(+) create mode 100755 scripts/cp-todos.sh (limited to 'scripts') diff --git a/scripts/cp-todos.sh b/scripts/cp-todos.sh new file mode 100755 index 0000000..4ec8962 --- /dev/null +++ b/scripts/cp-todos.sh @@ -0,0 +1 @@ +cp "$HOME/annex/txt/TODOs.org" "$HOME/Nextcloud/Notes/org.txt" -- cgit v1.2.3 From 5fb50dc53a1bfdcda9083d1121709bdfde5d8eb9 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 29 Dec 2018 06:27:07 -0200 Subject: Add cp-todos.sh cronJob. --- nixos/configuration.nix | 8 +++++++- scripts/cp-todos.sh | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 36e2cb1..ba0054f 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -311,7 +311,13 @@ services = { cron.enable = true; # We can see the actual generated crontab at /etc/crontab - cron.systemCronJobs = ["0 * * * * andreh /home/andreh/annex/dev/code/dotfiles/scripts/mail.sh -s"]; + cron.systemCronJobs = [ + # Sync emails with mbsync every hour + "0 * * * * andreh /home/andreh/annex/dev/code/dotfiles/scripts/mail.sh -s" + + # Make read-only copy of TODOs.org every hour + "0 * * * * andreh /home/andreh/annex/dev/code/dotfiles/scripts/cp-todos.sh -s" + ]; xserver = { enable = true; diff --git a/scripts/cp-todos.sh b/scripts/cp-todos.sh index 4ec8962..5ec5a0f 100755 --- a/scripts/cp-todos.sh +++ b/scripts/cp-todos.sh @@ -1 +1,2 @@ cp "$HOME/annex/txt/TODOs.org" "$HOME/Nextcloud/Notes/org.txt" +cp "$HOME/annex/txt/TODOs.org" "$HOME/Nextcloud/cache/TODOs.org" -- cgit v1.2.3 From 0714b19150de94debcfa94211e9d08cfdf02d8d7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 29 Dec 2018 18:19:20 -0200 Subject: Make scripts/startx executable. --- scripts/startx | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/startx (limited to 'scripts') diff --git a/scripts/startx b/scripts/startx old mode 100644 new mode 100755 -- cgit v1.2.3 From 67e642010bebd95b133592fc81637360d8fae0f0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 30 Dec 2018 22:37:39 -0200 Subject: Start playing with Dhall to generate yaml. --- dhall/dhall-gen.sh | 7 +++++++ dhall/repos.txt | 1 + dhall/sr-ht-build.dhall | 47 +++++++++++++++++++++++++++++++++++++++++++++++ nixos/configuration.nix | 3 ++- scripts/dhall-gen.sh | 1 + 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100755 dhall/dhall-gen.sh create mode 100644 dhall/repos.txt create mode 100644 dhall/sr-ht-build.dhall create mode 120000 scripts/dhall-gen.sh (limited to 'scripts') diff --git a/dhall/dhall-gen.sh b/dhall/dhall-gen.sh new file mode 100755 index 0000000..9bba429 --- /dev/null +++ b/dhall/dhall-gen.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +REPOS_PATH="$HOME/dev/libre" + +for repo in $(cat repos.txt); do + dhall 2> /dev/null <<< "./sr-ht-build.dhall \"$repo\"" | dhall-to-json --pretty > "$REPOS_PATH/$repo/.build.yml" +done diff --git a/dhall/repos.txt b/dhall/repos.txt new file mode 100644 index 0000000..0154e4c --- /dev/null +++ b/dhall/repos.txt @@ -0,0 +1 @@ +website diff --git a/dhall/sr-ht-build.dhall b/dhall/sr-ht-build.dhall new file mode 100644 index 0000000..41b937b --- /dev/null +++ b/dhall/sr-ht-build.dhall @@ -0,0 +1,47 @@ +-- let buildTemplate = + λ ( repoName + : Text + ) + → { image = + "debian/stretch" + , packages = + [ "curl" ] + , triggers = + [ { condition = + "failure" + , action = + "email" + , to = + "EuAndreh " + } + ] + , sources = + [ "https://git.sr.ht/~euandreh/" ++ repoName ] + , secrets = + [ "7159f943-811f-402d-bb6d-37cd764dc728" ] + , tasks = + [ { mapKey = + "setup" + , mapValue = + '' + curl https://nixos.org/nix/install | sh + echo '. $HOME/.nix-profile/etc/profile.d/nix.sh' >> $HOME/.buildenv'' + }, + { mapKey = + "test" + , mapValue = + '' + cd ${repoName}/ + nix-build -A test'' + }, + { mapKey = + "publish" + , mapValue = + '' + cd ${repoName}/ + nix-build -A publishScript + source env.sh + ./result/bin/publish.sh'' + } + ] + } diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 657c37b..cfa4b02 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -241,7 +241,8 @@ bats ledger perl - + dhall + dhall-json nodePackages.node2nix shellcheck (haskell.lib.justStaticExecutables haskellPackages.github-backup) diff --git a/scripts/dhall-gen.sh b/scripts/dhall-gen.sh new file mode 120000 index 0000000..75b8290 --- /dev/null +++ b/scripts/dhall-gen.sh @@ -0,0 +1 @@ +../dhall/dhall-gen.sh \ No newline at end of file -- cgit v1.2.3 From b679e7d91f7af2d97bead966a17b715cdb020b1a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 3 Jan 2019 06:12:39 -0200 Subject: Fix shellcheck ofsenses on bash scripts. --- bash/agents.sh | 3 +- bash/aliases.sh | 13 ++++--- bash/bash_profile.sh | 2 + bash/bashrc.sh | 5 ++- bash/colors.sh | 3 +- bash/env.sh | 2 +- bash/facepalm/rotten-apple.sh | 4 +- bash/fake-symlinks.sh | 26 ++++++++++--- bash/init.sh | 12 +++--- bash/npm.sh | 4 +- bash/platform.sh | 4 +- bash/symlinks.sh | 80 ++++++++++++++++++++-------------------- bash/tmuxinator-templates.sh | 9 ----- bash/util.sh | 32 ++++++++-------- bash/youtube.sh | 2 +- dhall/dhall-gen.sh | 7 ---- dhall/repos.txt | 1 - dhall/sr-ht-build.dhall | 47 ----------------------- encrypted/env.sh | Bin 3340 -> 3342 bytes encrypted/nu/nurc.sh | Bin 4124 -> 4240 bytes encrypted/scripts/video-feed.sh | Bin 3061 -> 3071 bytes nixos/npmrc.sh | 3 +- scripts/backup.sh | 12 +++--- scripts/cp-todos.sh | 2 + scripts/dhall-gen.sh | 1 - scripts/gc.sh | 12 +++--- scripts/mail.sh | 2 + scripts/once-only-nextcloud.sh | 2 +- scripts/single-monitor.sh | 2 +- scripts/startx | 2 +- scripts/three-monitors.sh | 2 +- templates/sr-ht-build.dhall | 47 +++++++++++++++++++++++ vps/push-receive-redeploy.sh | 4 +- xmonad/xsession.sh | 2 + 34 files changed, 178 insertions(+), 171 deletions(-) delete mode 100755 bash/tmuxinator-templates.sh delete mode 100755 dhall/dhall-gen.sh delete mode 100644 dhall/repos.txt delete mode 100644 dhall/sr-ht-build.dhall delete mode 120000 scripts/dhall-gen.sh create mode 100644 templates/sr-ht-build.dhall (limited to 'scripts') diff --git a/bash/agents.sh b/bash/agents.sh index 5dec196..d49757b 100644 --- a/bash/agents.sh +++ b/bash/agents.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# shellcheck disable=SC2015 eval "$(thefuck --alias f)" @@ -11,13 +12,11 @@ start_agent() { ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" echo succeeded chmod 600 "${SSH_ENV}" - # shellcheck source=/dev/null . "${SSH_ENV}" > /dev/null ssh-add } [ -f "${SSH_ENV}" ] && { - # shellcheck source=/dev/null . "${SSH_ENV}" > /dev/null pgrep ^ssh-agent$ > /dev/null || { start_agent diff --git a/bash/aliases.sh b/bash/aliases.sh index 403709c..52d24b4 100644 --- a/bash/aliases.sh +++ b/bash/aliases.sh @@ -8,13 +8,14 @@ alias l="ls -lahp" alias ll="ls -lhp" alias yt-dl="yt_dl" isLinux && { - alias copy="tr -d '\n' | xclip -sel clip" + alias copy="tr -d '\\n' | xclip -sel clip" } isMac && { - alias copy="tr -d '\n' | pbcopy" + alias copy="tr -d '\\n' | pbcopy" } -alias trim="tr -d '\n'" -alias lower="tr [:upper:] [:lower:]" +alias trim="tr -d '\\n'" +alias lowercase="tr [:upper:] [:lower:]" +alias lc="tr [:upper:] [:lower:]" alias pia-vpn="sudo openvpn --config $DOTFILES/VPN/euandreh.ovpn" # Source: https://unix.stackexchange.com/questions/25327/watch-command-alias-expansion#25329 alias watch="watch --color " @@ -31,9 +32,9 @@ alias fim="play $DOTFILES/bash/Positive.ogg &> /dev/null" alias mux="tmuxinator" u() { - pushd ~/annex > /dev/null; + pushd ~/annex > /dev/null || exit 1; git annex info --fast | grep available; - popd > /dev/null; + popd > /dev/null || exit 1; } export -f u diff --git a/bash/bash_profile.sh b/bash/bash_profile.sh index 12ce7f9..41bc7e9 100644 --- a/bash/bash_profile.sh +++ b/bash/bash_profile.sh @@ -1 +1,3 @@ +#!/usr/bin/env bash + source ~/annex/dev/code/dotfiles/bash/bashrc.sh diff --git a/bash/bashrc.sh b/bash/bashrc.sh index d06692b..a895df1 100644 --- a/bash/bashrc.sh +++ b/bash/bashrc.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + export DOTFILES=~/annex/dev/code/dotfiles source $DOTFILES/bash/platform.sh @@ -10,7 +12,6 @@ source $DOTFILES/bash/agents.sh source $DOTFILES/bash/init.sh source $DOTFILES/bash/symlinks.sh source $DOTFILES/bash/youtube.sh -source $DOTFILES/bash/tmuxinator-templates.sh source $DOTFILES/bash/facepalm/rotten-apple.sh source $DOTFILES/bash/npm.sh source $DOTFILES/bash/x.sh @@ -28,7 +29,7 @@ export PATH="$HOME/annex/dev/code/songbooks/cli:$PATH" alias sb="songbooks" isLinux && { - source "$(dirname $(readlink $(which autojump)))/../share/autojump/autojump.bash" + source "$(dirname "$(readlink "$(command -v autojump)")")/../share/autojump/autojump.bash" } export PATH="$HOME/.perl6/bin:$PATH" diff --git a/bash/colors.sh b/bash/colors.sh index 90cabc4..68acb06 100644 --- a/bash/colors.sh +++ b/bash/colors.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# shellcheck disable=1117 disable=1004 disable=2034 disable=2154 # Customize BASH PS1 prompt to show current GIT repository and branch. # by Mike Stewart - http://MediaDoneRight.com @@ -208,7 +209,7 @@ function lightblueb { } export -f lightblueb -function ,colors { +function colors { black "black" blackb "blackb" white "white" diff --git a/bash/env.sh b/bash/env.sh index 8ac8a25..5a09663 100644 --- a/bash/env.sh +++ b/bash/env.sh @@ -33,7 +33,7 @@ export EDITOR=vi export PATH="$DOTFILES/scripts/:$PATH" export PATH="$DOTFILES/encrypted/scripts/:$PATH" export INPUTRC=~/.inputrc -export CACHE_DIR="~/Nextcloud/cache" +export CACHE_DIR="$HOME/Nextcloud/cache" export PATH="$HOME/dev/libre/website/:$PATH" diff --git a/bash/facepalm/rotten-apple.sh b/bash/facepalm/rotten-apple.sh index 50d85c8..222a2b0 100644 --- a/bash/facepalm/rotten-apple.sh +++ b/bash/facepalm/rotten-apple.sh @@ -6,8 +6,8 @@ isMac && { alias limpar-derived-data="rm -rf ~/Library/Developer/Xcode/DerivedData/" alias fim="afplay $DOTFILES/bash/facepalm/Positive.mp3" - if [ -f $(brew --prefix)/etc/bash_completion ]; then - . $(brew --prefix)/etc/bash_completion + if [ -f "$(brew --prefix)/etc/bash_completion" ]; then + . "$(brew --prefix)/etc/bash_completion" fi [ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion diff --git a/bash/fake-symlinks.sh b/bash/fake-symlinks.sh index 336f0c5..3927b0c 100644 --- a/bash/fake-symlinks.sh +++ b/bash/fake-symlinks.sh @@ -1,19 +1,33 @@ #!/usr/bin/env bash if [[ -n "$GITHUB_TOKEN" ]]; then - cat $DOTFILES/git/gitconfig.ini | envsubst > ~/.gitconfig + envsubst < "$DOTFILES/git/gitconfig.ini" > ~/.gitconfig fi -SRHT_REPOS=("website" "mentat" "cement" "pouchdb-materialized-view" "pires" "superlogin" "superlogin-client") +SRHT_REPOS=(website mentat cement pouchdb-materialized-view pires superlogin superlogin-client) SRHT_REPOS_PATH="$HOME/dev/libre" -for repo in ${SRHT_REPOS[@]}; do - cat $DOTFILES/templates/sr-ht-build.yaml | REPO="$repo" envsubst > "$SRHT_REPOS_PATH/$repo/.build.yml" +for repo in "${SRHT_REPOS[@]}"; do + REPO="$repo" envsubst < "$DOTFILES/templates/sr-ht-build.yaml" > "$SRHT_REPOS_PATH/$repo/.build.yml" done -for repo in ${SRHT_REPOS[@]}; do +for repo in "${SRHT_REPOS[@]}"; do if [[ "$repo" != "website" ]]; then - cat "$DOTFILES/templates/env.sh" | REPO="$repo" envsubst > "$SRHT_REPOS_PATH/$repo/env.sh" + REPO="$repo" envsubst < "$DOTFILES/templates/env.sh" > "$SRHT_REPOS_PATH/$repo/env.sh" fi done + +mkdir -p ~/.tmuxinator + +TMUXINATOR_TEMPLATES=(annex pires songbooks sosps) + +for template in "${TMUXINATOR_TEMPLATES[@]}"; do + cp "$DOTFILES/tmux/projects/$template.yml" "$HOME/.tmuxinator/$template.yml" +done + +# DHALL_BUILD_REPOS=(website) + +# for repo in "${DHALL_BUILD_REPOS[@]}"; do +# dhall 2> /dev/null <<< "./sr-ht-build.dhall \"$repo\"" | dhall-to-json --pretty > "$SRHT_REPOS_PATH/$repo/.build.yml" +# done diff --git a/bash/init.sh b/bash/init.sh index 777a322..4e0ee65 100644 --- a/bash/init.sh +++ b/bash/init.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash locked_init() { - pushd ~/ > /dev/null + pushd ~/ > /dev/null || exit 1 mkdir -p ~/.emacs.d/.cache/ - mkdir -p $(dirname "$AUTOJUMP_TXT") + mkdir -p "$(dirname "$AUTOJUMP_TXT")" touch "$AUTOJUMP_TXT" # clone all missing repos @@ -13,12 +13,12 @@ locked_init() { printf "" > /tmp/mr-repos mr inject > /dev/null - printf "(\n" > /tmp/mr-projectile + printf "(\\n" > /tmp/mr-projectile sed -E 's/\/home\/andreh/~/' /tmp/mr-repos | awk '{print "\""$1"/""\""}' >> /tmp/mr-projectile printf ")" >> /tmp/mr-projectile cp /tmp/mr-projectile ~/.emacs.d/.cache/projectile-bookmarks.eld - popd > /dev/null + popd > /dev/null || exit 1 } export -f locked_init @@ -32,7 +32,7 @@ export -f locked_init # Tests -pushd $DOTFILES > /dev/null +pushd "$DOTFILES" > /dev/null || exit 1 sizes=$(git diff-files --ignore-submodules | awk '{print $6}' | xargs du | awk '{print $1}') for size in $sizes; do @@ -42,4 +42,4 @@ for size in $sizes; do fi done -popd > /dev/null +popd > /dev/null || exit 1 diff --git a/bash/npm.sh b/bash/npm.sh index c23c074..7fbe4f7 100644 --- a/bash/npm.sh +++ b/bash/npm.sh @@ -2,9 +2,9 @@ # FIXME: port to NixOS npm_i() { - (which $1 &> /dev/null) || { + (command -v "$1" &> /dev/null) || { yellow "Installing $2" - npm i -g $2 + npm i -g "$2" } } diff --git a/bash/platform.sh b/bash/platform.sh index efa5061..eb262e9 100644 --- a/bash/platform.sh +++ b/bash/platform.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash isMac () { - [[ `uname` == 'Darwin' ]] + [[ "$(uname)" == 'Darwin' ]] } isLinux () { - [[ `uname` == 'Linux' ]] + [[ "$(uname)" == 'Linux' ]] } isMac && { diff --git a/bash/symlinks.sh b/bash/symlinks.sh index 39d0a0b..e56ee58 100644 --- a/bash/symlinks.sh +++ b/bash/symlinks.sh @@ -1,77 +1,77 @@ #!/usr/bin/env bash function upsert_dir_symlink() { - local readonly from="$1" - local readonly to="$2" - ([ -d "$to" ] || [ -L "$to" ]) || { + local from="$1" + local to="$2" + { [ -d "$to" ] || [ -L "$to" ]; } || { ln -s "$from" "$to" } } export -f upsert_dir_symlink -upsert_dir_symlink $DOTFILES/encrypted/borg ~/.config/borg +upsert_dir_symlink "$DOTFILES/encrypted/borg" ~/.config/borg -ln -fs $DOTFILES/bash/bashrc.sh ~/.bashrc -ln -fs $DOTFILES/bash/bash_profile.sh ~/.bash_profile -ln -fs $DOTFILES/git/gitattributes ~/.gitattributes -ln -fs $DOTFILES/git/gitignore ~/.gitignore_global -ln -fs $DOTFILES/git/bash_git.sh ~/.bash_git -ln -fs $DOTFILES/encrypted/nugitconfig.ini ~/.nugitconfig -ln -fs $DOTFILES/sbclrc.lisp ~/.sbclrc -ln -fs $DOTFILES/inputrc.conf ~/.inputrc -ln -fs $DOTFILES/Xmodmap.conf ~/.Xmodmap +ln -fs "$DOTFILES/bash/bashrc.sh" ~/.bashrc +ln -fs "$DOTFILES/bash/bash_profile.sh" ~/.bash_profile +ln -fs "$DOTFILES/git/gitattributes" ~/.gitattributes +ln -fs "$DOTFILES/git/gitignore" ~/.gitignore_global +ln -fs "$DOTFILES/git/bash_git.sh" ~/.bash_git +ln -fs "$DOTFILES/encrypted/nugitconfig.ini" ~/.nugitconfig +ln -fs "$DOTFILES/sbclrc.lisp" ~/.sbclrc +ln -fs "$DOTFILES/inputrc.conf" ~/.inputrc +ln -fs "$DOTFILES/Xmodmap.conf" ~/.Xmodmap isLinux && { - ln -fs $DOTFILES/nixos/npmrc.sh ~/.npmrc + ln -fs "$DOTFILES/nixos/npmrc.sh" ~/.npmrc } ## SSH config mkdir -p ~/.ssh -ln -fs $DOTFILES/ssh_config.conf ~/.ssh/config +ln -fs "$DOTFILES/ssh_config.conf" ~/.ssh/config -ln -fs $DOTFILES/git/mrconfig.ini ~/.mrconfig +ln -fs "$DOTFILES/git/mrconfig.ini" ~/.mrconfig -upsert_dir_symlink $MEDIA_PREFIX/UTCLOUD ~/UTCLOUD -upsert_dir_symlink $MEDIA_PREFIX/SNEAKER ~/SNEAKER +upsert_dir_symlink "$MEDIA_PREFIX/UTCLOUD" ~/UTCLOUD +upsert_dir_symlink "$MEDIA_PREFIX/SNEAKER" ~/SNEAKER ## Clojure mkdir -p ~/.lein ~/.clojure -ln -fs $DOTFILES/lein/profiles.clj ~/.lein/profiles.clj -ln -fs $DOTFILES/lein/deps.edn ~/.clojure/deps.edn +ln -fs "$DOTFILES/lein/profiles.clj" ~/.lein/profiles.clj +ln -fs "$DOTFILES/lein/deps.edn" ~/.clojure/deps.edn ## AWS mkdir -p ~/.aws -ln -fs $DOTFILES/encrypted/aws/config ~/.aws/config -ln -fs $DOTFILES/encrypted/aws/credentials ~/.aws/credentials +ln -fs "$DOTFILES/encrypted/aws/config" ~/.aws/config +ln -fs "$DOTFILES/encrypted/aws/credentials" ~/.aws/credentials ## tmux -ln -fs $DOTFILES/tmux/tmux.conf ~/.tmux.conf -ln -fs $DOTFILES/tmux/tmux-macos.conf ~/.tmux-macos.conf -ln -fs $DOTFILES/tmux/tmux-gnu-linux.conf ~/.tmux-gnu-linux.conf +ln -fs "$DOTFILES/tmux/tmux.conf" ~/.tmux.conf +ln -fs "$DOTFILES/tmux/tmux-macos.conf" ~/.tmux-macos.conf +ln -fs "$DOTFILES/tmux/tmux-gnu-linux.conf" ~/.tmux-gnu-linux.conf ## NixOS -ln -fs $DOTFILES/nixos/evince.destkop ~/.local/share/applications/evince.desktop -ln -fs $DOTFILES/nixos/firefox.destkop ~/.local/share/applications/firefox.desktop +ln -fs "$DOTFILES/nixos/evince.destkop" ~/.local/share/applications/evince.desktop +ln -fs "$DOTFILES/nixos/firefox.destkop" ~/.local/share/applications/firefox.desktop ## Emacs -mkdir -p $HOME/.emacs.d/private/layers/ -ln -fs $DOTFILES/spacemacs.el ~/.spacemacs -ln -fs $DOTFILES/emacs/gnus.el ~/.gnus.el -ln -fs $CACHE_DIR/euandreh-auto-save.el ~/.emacs.d/.cache/layouts/euandreh-auto-save +mkdir -p "$HOME/.emacs.d/private/layers/" +ln -fs "$DOTFILES/spacemacs.el" ~/.spacemacs +ln -fs "$DOTFILES/emacs/gnus.el" ~/.gnus.el +ln -fs "$CACHE_DIR/euandreh-auto-save.el" ~/.emacs.d/.cache/layouts/euandreh-auto-save ## xmonad mkdir -p ~/.xmonad -ln -fs $DOTFILES/xmonad/xsession.sh ~/.xsession -ln -fs $DOTFILES/xmonad/xmonad.hs ~/.xmonad/xmonad.hs -ln -fs $DOTFILES/xmonad/xmobar.hs ~/.xmobarrc +ln -fs "$DOTFILES/xmonad/xsession.sh" ~/.xsession +ln -fs "$DOTFILES/xmonad/xmonad.hs" ~/.xmonad/xmonad.hs +ln -fs "$DOTFILES/xmonad/xmobar.hs" ~/.xmobarrc ## Mail mkdir -p ~/mbsync/.notmuch/hooks ~/mbsync/EuAndreh ~/mbsync/Gmail ~/mbsync/Nubank -ln -fs $DOTFILES/mail/notmuch-post.sh ~/mbsync/.notmuch/hooks/post-new -ln -fs $DOTFILES/mail/mbsyncrc.ini ~/.mbsyncrc -ln -fs $DOTFILES/mail/notmuch.ini ~/.notmuch-config -ln -fs /tmp/mbsync.$(date +%Y-%m-%d).log /tmp/mbsync.log -ln -fs /tmp/notmuch.$(date +%Y-%m-%d).log /tmp/notmuch.log +ln -fs "$DOTFILES/mail/notmuch-post.sh" ~/mbsync/.notmuch/hooks/post-new +ln -fs "$DOTFILES/mail/mbsyncrc.ini" ~/.mbsyncrc +ln -fs "$DOTFILES/mail/notmuch.ini" ~/.notmuch-config +ln -fs /tmp/mbsync."$(date +%Y-%m-%d)".log /tmp/mbsync.log +ln -fs /tmp/notmuch."$(date +%Y-%m-%d)".log /tmp/notmuch.log ## GNUS -ln -fs $DOTFILES/encrypted/IMAP/authinfo.gpg ~/.authinfo.gpg +ln -fs "$DOTFILES/encrypted/IMAP/authinfo.gpg" ~/.authinfo.gpg diff --git a/bash/tmuxinator-templates.sh b/bash/tmuxinator-templates.sh deleted file mode 100755 index adbbb5c..0000000 --- a/bash/tmuxinator-templates.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -mkdir -p ~/.tmuxinator - -templates=(annex pires songbooks sosps) - -for template in ${templates[@]}; do - cp $DOTFILES/tmux/projects/$template.yml ~/.tmuxinator/$template.yml -done diff --git a/bash/util.sh b/bash/util.sh index 833bc9c..e29d02f 100644 --- a/bash/util.sh +++ b/bash/util.sh @@ -1,20 +1,20 @@ #!/usr/bin/env bash extract () { - if [ -f $1 ] ; then - case $1 in - *.tar.bz2) tar xvjf $1 ;; - *.tar.gz) tar xvzf $1 ;; - *.bz2) bunzip2 $1 ;; - *.rar) unrar x $1 ;; - *.gz) gunzip $1 ;; - *.tar) tar xvf $1 ;; - *.tbz2) tar xvjf $1 ;; - *.tgz) tar xvzf $1 ;; - *.zip) unzip $1 ;; - *.Z) uncompress $1 ;; - *.7z) 7z x $1 ;; - *.xz) unxz $1 ;; + if [ -f "$1" ] ; then + case "$1" in + *.tar.bz2) tar xvjf "$1" ;; + *.tar.gz) tar xvzf "$1" ;; + *.bz2) bunzip2 "$1" ;; + *.rar) unrar x "$1" ;; + *.gz) gunzip "$1" ;; + *.tar) tar xvf "$1" ;; + *.tbz2) tar xvjf "$1" ;; + *.tgz) tar xvzf "$1" ;; + *.zip) unzip "$1" ;; + *.Z) uncompress "$1" ;; + *.7z) 7z x "$1" ;; + *.xz) unxz "$1" ;; *) echo "don't know how to extract '$1'..." ;; esac else @@ -24,11 +24,11 @@ extract () { merkle-tree () { dirname="${1-.}" - pushd "$dirname" > /dev/null + pushd "$dirname" > /dev/null || exit 1 find . -type f | \ sort | \ xargs -I{} sha256sum "{}" | \ sha256sum | \ awk '{print $1}' - popd > /dev/null + popd > /dev/null || exit 1 } diff --git a/bash/youtube.sh b/bash/youtube.sh index c40e0a7..19c9af0 100644 --- a/bash/youtube.sh +++ b/bash/youtube.sh @@ -2,7 +2,7 @@ export DEFAULT_PLAYLIST_END=15 export DEFAULT_INC_STEP=10 -export YT_TEMPLATE="~/Downloads/yt-dl/%(uploader)s/%(upload_date)s %(title)s.%(ext)s" +export YT_TEMPLATE="$HOME/Downloads/yt-dl/%(uploader)s/%(upload_date)s %(title)s.%(ext)s" # Always downloads video, doesn't look at the download-archive yt_dl() { diff --git a/dhall/dhall-gen.sh b/dhall/dhall-gen.sh deleted file mode 100755 index 9bba429..0000000 --- a/dhall/dhall-gen.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -REPOS_PATH="$HOME/dev/libre" - -for repo in $(cat repos.txt); do - dhall 2> /dev/null <<< "./sr-ht-build.dhall \"$repo\"" | dhall-to-json --pretty > "$REPOS_PATH/$repo/.build.yml" -done diff --git a/dhall/repos.txt b/dhall/repos.txt deleted file mode 100644 index 0154e4c..0000000 --- a/dhall/repos.txt +++ /dev/null @@ -1 +0,0 @@ -website diff --git a/dhall/sr-ht-build.dhall b/dhall/sr-ht-build.dhall deleted file mode 100644 index 41b937b..0000000 --- a/dhall/sr-ht-build.dhall +++ /dev/null @@ -1,47 +0,0 @@ --- let buildTemplate = - λ ( repoName - : Text - ) - → { image = - "debian/stretch" - , packages = - [ "curl" ] - , triggers = - [ { condition = - "failure" - , action = - "email" - , to = - "EuAndreh " - } - ] - , sources = - [ "https://git.sr.ht/~euandreh/" ++ repoName ] - , secrets = - [ "7159f943-811f-402d-bb6d-37cd764dc728" ] - , tasks = - [ { mapKey = - "setup" - , mapValue = - '' - curl https://nixos.org/nix/install | sh - echo '. $HOME/.nix-profile/etc/profile.d/nix.sh' >> $HOME/.buildenv'' - }, - { mapKey = - "test" - , mapValue = - '' - cd ${repoName}/ - nix-build -A test'' - }, - { mapKey = - "publish" - , mapValue = - '' - cd ${repoName}/ - nix-build -A publishScript - source env.sh - ./result/bin/publish.sh'' - } - ] - } diff --git a/encrypted/env.sh b/encrypted/env.sh index af98c5c..e4ebb21 100644 Binary files a/encrypted/env.sh and b/encrypted/env.sh differ diff --git a/encrypted/nu/nurc.sh b/encrypted/nu/nurc.sh index a8532c2..b92a178 100644 Binary files a/encrypted/nu/nurc.sh and b/encrypted/nu/nurc.sh differ diff --git a/encrypted/scripts/video-feed.sh b/encrypted/scripts/video-feed.sh index 6efa22d..a6e17d9 100755 Binary files a/encrypted/scripts/video-feed.sh and b/encrypted/scripts/video-feed.sh differ diff --git a/nixos/npmrc.sh b/nixos/npmrc.sh index 326ac0b..2669f85 100644 --- a/nixos/npmrc.sh +++ b/nixos/npmrc.sh @@ -1,4 +1,5 @@ -prefix="~/.npm-packages" +# shellcheck disable=2148 disable=2034 +prefix="$HOME/.npm-packages" # Taken from: # http://www.tomsquest.com/blog/2018/10/better-npm-ing/ save-exact=true diff --git a/scripts/backup.sh b/scripts/backup.sh index a33a630..6a4de25 100755 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -6,12 +6,12 @@ # if [ ! -d ~/UTCLOUD/ ]; then - red "~/UTCLOUD not attached. Backup not started." + red "$HOME/UTCLOUD not attached. Backup not started." exit 1 fi if [ ! -d ~/borgbackup/ ]; then - yellow "~/borgbackup/ repository doesn't exist. Downloading latest version from ~/UTCLOUD/borg/borgbackup/ into ~/borgbackup/" + yellow "$HOME/borgbackup/ repository doesn't exist. Downloading latest version from ~/UTCLOUD/borg/borgbackup/ into ~/borgbackup/" # The initial borg repo was created with: # $ borg init --append-only --encryption=keyfile ~/borgbackup # See also: https://borgbackup.readthedocs.io/en/stable/usage/notes.html#append-only-mode @@ -46,7 +46,7 @@ green "Done" # yellow "Backing up git repos" -pushd ~/ +pushd ~/ || exit 1 mr -s master mr -s status @@ -54,13 +54,13 @@ mr -s -j16 update mr -s hd mr -s -j4 rsyncnet -popd +popd || exit 1 yellow "Syncing annex" -pushd ~/annex/ +pushd ~/annex/ || exit 1 git annex sync -popd +popd || exit 1 green "Done" diff --git a/scripts/cp-todos.sh b/scripts/cp-todos.sh index 5ec5a0f..d8e6f30 100755 --- a/scripts/cp-todos.sh +++ b/scripts/cp-todos.sh @@ -1,2 +1,4 @@ +#!/usr/bin/env bash + cp "$HOME/annex/txt/TODOs.org" "$HOME/Nextcloud/Notes/org.txt" cp "$HOME/annex/txt/TODOs.org" "$HOME/Nextcloud/cache/TODOs.org" diff --git a/scripts/dhall-gen.sh b/scripts/dhall-gen.sh deleted file mode 120000 index 75b8290..0000000 --- a/scripts/dhall-gen.sh +++ /dev/null @@ -1 +0,0 @@ -../dhall/dhall-gen.sh \ No newline at end of file diff --git a/scripts/gc.sh b/scripts/gc.sh index ac1b412..c4d3ec3 100755 --- a/scripts/gc.sh +++ b/scripts/gc.sh @@ -10,8 +10,8 @@ yellow "Cleaning up the NixOS store" profiles=(per-user/root/channels per-user/andreh/profile per-user/andreh/channels system) -for p in ${profiles[@]}; do - sudo nix-env --delete-generations old -p /nix/var/nix/profiles/$p +for p in "${profiles[@]}"; do + sudo nix-env --delete-generations old -p "/nix/var/nix/profiles/$p" done # Current profile, change when installing with =nix-env -iA nixpkgs.bsdgames= @@ -36,11 +36,11 @@ sudo find /tmp -type f -atime +10 -delete yellow "Erasing docker images" echo y | docker system prune -a -docker rmi $(docker images -a -q) -docker rm $(docker ps -a -f status=exited -q) +docker rmi "$(docker images -a -q)" +docker rm "$(docker ps -a -f status=exited -q)" -docker stop $(docker ps -a -q) -docker rm $(docker ps -a -q) +docker stop "$(docker ps -a -q)" +docker rm "$(docker ps -a -q)" echo y | docker volume prune echo y | docker container prune diff --git a/scripts/mail.sh b/scripts/mail.sh index a7c8208..00c111f 100755 --- a/scripts/mail.sh +++ b/scripts/mail.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + if [ "$1" = "-s" ]; then mbsync -aV &>> /tmp/mbsync.log && notmuch new &>> /tmp/notmuch.log else diff --git a/scripts/once-only-nextcloud.sh b/scripts/once-only-nextcloud.sh index 8400080..7886b6f 100755 --- a/scripts/once-only-nextcloud.sh +++ b/scripts/once-only-nextcloud.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash if [ "$(pidof nextcloud)" ] then diff --git a/scripts/single-monitor.sh b/scripts/single-monitor.sh index ec6c5e2..5b0d03e 100755 --- a/scripts/single-monitor.sh +++ b/scripts/single-monitor.sh @@ -1,2 +1,2 @@ -#!/bin/sh +#!/usr/bin/env bash xrandr --output VIRTUAL1 --off --output eDP1 --primary --mode 1920x1080 --pos 640x1440 --rotate normal --output DP1 --off --output HDMI2 --off --output HDMI1 --off --output DP2 --off diff --git a/scripts/startx b/scripts/startx index 9b1d153..cca34a2 100755 --- a/scripts/startx +++ b/scripts/startx @@ -1,3 +1,3 @@ -#!/bin/sh +#!/usr/bin/env bash sudo systemctl restart display-manager & diff --git a/scripts/three-monitors.sh b/scripts/three-monitors.sh index d1ef7c6..d8c4e53 100755 --- a/scripts/three-monitors.sh +++ b/scripts/three-monitors.sh @@ -1,2 +1,2 @@ -#!/bin/sh +#!/usr/bin/env bash xrandr --output VIRTUAL1 --off --output eDP1 --primary --mode 1920x1080 --pos 640x1440 --rotate normal --output DP1 --off --output HDMI2 --off --output HDMI1 --mode 2560x1440 --pos 0x0 --rotate normal --output DP2 --mode 2560x1440 --pos 2560x0 --rotate left diff --git a/templates/sr-ht-build.dhall b/templates/sr-ht-build.dhall new file mode 100644 index 0000000..41b937b --- /dev/null +++ b/templates/sr-ht-build.dhall @@ -0,0 +1,47 @@ +-- let buildTemplate = + λ ( repoName + : Text + ) + → { image = + "debian/stretch" + , packages = + [ "curl" ] + , triggers = + [ { condition = + "failure" + , action = + "email" + , to = + "EuAndreh " + } + ] + , sources = + [ "https://git.sr.ht/~euandreh/" ++ repoName ] + , secrets = + [ "7159f943-811f-402d-bb6d-37cd764dc728" ] + , tasks = + [ { mapKey = + "setup" + , mapValue = + '' + curl https://nixos.org/nix/install | sh + echo '. $HOME/.nix-profile/etc/profile.d/nix.sh' >> $HOME/.buildenv'' + }, + { mapKey = + "test" + , mapValue = + '' + cd ${repoName}/ + nix-build -A test'' + }, + { mapKey = + "publish" + , mapValue = + '' + cd ${repoName}/ + nix-build -A publishScript + source env.sh + ./result/bin/publish.sh'' + } + ] + } diff --git a/vps/push-receive-redeploy.sh b/vps/push-receive-redeploy.sh index 87fecd5..46a65bc 100755 --- a/vps/push-receive-redeploy.sh +++ b/vps/push-receive-redeploy.sh @@ -1,6 +1,6 @@ -#!/bin/sh +#!/usr/bin/env bash -cd ~/ +cd ~/ || exit 1 docker pull registry.gitlab.com/euandreh/songbooks/prod:latest docker-compose stop songbooks_app docker-compose up -d --no-deps songbooks_app diff --git a/xmonad/xsession.sh b/xmonad/xsession.sh index b25a9a1..542994f 100644 --- a/xmonad/xsession.sh +++ b/xmonad/xsession.sh @@ -1 +1,3 @@ +#!/usr/bin/env bash + xmonad -- cgit v1.2.3 From 569abfc95209b00188a71dd4a199fb020ffe5218 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 13 Jan 2019 14:58:12 -0200 Subject: gc.sh: use sudo to rm the trash folder. --- scripts/gc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gc.sh b/scripts/gc.sh index c4d3ec3..e3ada13 100755 --- a/scripts/gc.sh +++ b/scripts/gc.sh @@ -28,7 +28,7 @@ guix gc yellow "Cleaning up up the Trash and /tmp folders" -rm -rf ~/.local/share/Trash/files/* +sudo rm -rf ~/.local/share/Trash/files/* # https://askubuntu.com/a/609396 sudo find /tmp -type f -atime +10 -delete -- cgit v1.2.3 From fb27243da67e41ec1f6f157a4affbfd18c6c07cb Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 13 Jan 2019 15:00:17 -0200 Subject: gc.sh: s/,u/u/. --- scripts/gc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gc.sh b/scripts/gc.sh index e3ada13..c93c948 100755 --- a/scripts/gc.sh +++ b/scripts/gc.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash disk_space() { - ,u | awk '{print $5" "$6}' + u | awk '{print $5" "$6}' } before=$(disk_space) -- cgit v1.2.3 From a5859fad8b43fbefc24f969b6f794c9a8abe797c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 20 Jan 2019 23:34:12 -0200 Subject: Initial setup for buku. --- nixos/configuration.nix | 2 ++ scripts/buku-add.sh | 3 +++ xmonad/xmonad.hs | 5 +++++ 3 files changed, 10 insertions(+) create mode 100755 scripts/buku-add.sh (limited to 'scripts') diff --git a/nixos/configuration.nix b/nixos/configuration.nix index fc48b78..36a2474 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -248,6 +248,8 @@ shellcheck (haskell.lib.justStaticExecutables haskellPackages.github-backup) rustracer + xsel + buku ## Containers and VMs diff --git a/scripts/buku-add.sh b/scripts/buku-add.sh new file mode 100755 index 0000000..beccd0a --- /dev/null +++ b/scripts/buku-add.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +xsel | xargs -I{} buku -a "{}" ril diff --git a/xmonad/xmonad.hs b/xmonad/xmonad.hs index dd46d25..1f7d47a 100644 --- a/xmonad/xmonad.hs +++ b/xmonad/xmonad.hs @@ -95,6 +95,11 @@ myKeyBindings = -- restart network , ((mod4Mask, xK_x), spawn "gksudo -S systemctl restart network-manager") + + -- save selection (link) in buku + , ((mod4Mask, xK_c), + -- spawn "gksudo -S systemctl restart network-manager") + spawn "$HOME/dev/libre/dotfiles/scripts/buku-add.sh") ] startup :: X() -- cgit v1.2.3 From 8d490839b7ef11549bee6c92fdd86ef60afd55e0 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 21 Jan 2019 01:25:07 -0200 Subject: Generate local RSS feed from buku tags. --- .gitignore | 3 +++ bash/aliases.sh | 1 + newsboat/urls | Bin 589 -> 653 bytes nixos/configuration.nix | 3 +++ scripts/atom.js | 22 ++++++++++++++++++++++ scripts/atom.sh | 19 +++++++++++++++++++ 6 files changed, 48 insertions(+) create mode 100644 scripts/atom.js create mode 100755 scripts/atom.sh (limited to 'scripts') diff --git a/.gitignore b/.gitignore index e671f1e..68b7e2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ mail/offlineimap.pyc tam_required /result + +/scripts/node_modules/ +/scripts/package-lock.json \ No newline at end of file diff --git a/bash/aliases.sh b/bash/aliases.sh index 52d24b4..e8ff449 100644 --- a/bash/aliases.sh +++ b/bash/aliases.sh @@ -24,6 +24,7 @@ alias sbcl="rlwrap sbcl" alias du="ncdu --color dark" alias perl6="rlwrap perl6" alias m="mail.sh" +alias a="atom.sh" alias gnome-control-center="XDG_CURRENT_DESKTOP=GNOME gnome-control-center" diff --git a/newsboat/urls b/newsboat/urls index 444e1a7..1047793 100644 Binary files a/newsboat/urls and b/newsboat/urls differ diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 36a2474..6f8c7e0 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -333,6 +333,9 @@ # Sync emails with mbsync every hour "0 * * * * andreh /home/andreh/dev/libre/dotfiles/scripts/mail.sh -s" + # Refresh local RSS files every hour + "0 * * * * andreh /home/andreh/dev/libre/dotfiles/scripts/atom.sh" + # Make read-only copy of TODOs.org every hour # "0 * * * * andreh /home/andreh/dev/libre/dotfiles/scripts/cp-todos.sh -s" ]; diff --git a/scripts/atom.js b/scripts/atom.js new file mode 100644 index 0000000..878df05 --- /dev/null +++ b/scripts/atom.js @@ -0,0 +1,22 @@ +const RSS = require('rss'); + +const feedName = process.argv[2]; +const feedSrc = process.argv[3]; + +const feed = new RSS({ + title: `Buku feed tag for '${feedName}'.`, + description: `Buku feed tag for ${feedName}`, +}); + +const items = require(feedSrc); +items.forEach(({ title, description, uri }) => { + feed.item({ + title, + description, + url: uri + }); +}); + +const xml = feed.xml({indent: true}); + +console.log(xml); diff --git a/scripts/atom.sh b/scripts/atom.sh new file mode 100755 index 0000000..73c35ec --- /dev/null +++ b/scripts/atom.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" + +if [[ ! -d "node_modules" ]]; then + npm i rss +fi + +feed() { + local tag="$1" + local tmp="/tmp/$tag.json" + buku -t "$tag" --json > "$tmp" + node atom.js "$tag" "$tmp" +} + +mkdir -p ~/.newsboat +feed ril > ~/.newsboat/ril.xml +feed simple-archive > ~/.newsboat/simple-archive.xml +feed inbox > ~/.newsboat/inbox.xml -- cgit v1.2.3 From 01228f89c43d9a40f79eb8e2e9556d8d9fa01fc7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 21 Jan 2019 09:19:32 -0200 Subject: WIP: add extra keybindings for Buku actions. --- bash/aliases.sh | 9 +++++---- scripts/buku-archive.sh | 15 +++++++++++++++ scripts/buku-delete.sh | 14 ++++++++++++++ xmonad/xmonad.hs | 9 ++++++++- 4 files changed, 42 insertions(+), 5 deletions(-) create mode 100755 scripts/buku-archive.sh create mode 100755 scripts/buku-delete.sh (limited to 'scripts') diff --git a/bash/aliases.sh b/bash/aliases.sh index e8ff449..2149d86 100644 --- a/bash/aliases.sh +++ b/bash/aliases.sh @@ -25,6 +25,7 @@ alias du="ncdu --color dark" alias perl6="rlwrap perl6" alias m="mail.sh" alias a="atom.sh" +alias n="newsboat" alias gnome-control-center="XDG_CURRENT_DESKTOP=GNOME gnome-control-center" @@ -45,9 +46,9 @@ ps1() { } # git -alias ,s="git status" -alias ,d="git diff" -alias ,ds="git diff --staged" +alias s="git status" +alias d="git diff" +alias ds="git diff --staged" alias reload="source $DOTFILES/bash/tests.sh && locked_init && source ~/.bashrc" -alias ,r="source $DOTFILES/bash/tests.sh && locked_init && source ~/.bashrc" +alias r="source $DOTFILES/bash/tests.sh && locked_init && source ~/.bashrc" diff --git a/scripts/buku-archive.sh b/scripts/buku-archive.sh new file mode 100755 index 0000000..5af56a0 --- /dev/null +++ b/scripts/buku-archive.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -x + +SEL="$(xsel)" +BOOKMARK_ID="$(buku "$SEL" -f 1 --tacit | tail -n +2 | awk '{print $1}')" +# tail to trim unwanted "waiting for input" output from buku https://github.com/jarun/Buku/blob/d60d56bc9f7f5e1410e99dc8bb4e35abf5068a14/buku#L4619 + +if [[ ! -z "$BOOKMARK_ID" ]]; then + echo "Archiving $BOOKMARK_ID." + buku -u "$BOOKMARK_ID" --tag - ril + buku -u "$BOOKMARK_ID" --tag + simple-archive +else + echo "Bookmark for '$SEL' not found." + exit 1 +fi diff --git a/scripts/buku-delete.sh b/scripts/buku-delete.sh new file mode 100755 index 0000000..3e2f3dd --- /dev/null +++ b/scripts/buku-delete.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -x + +SEL="$(xsel)" +BOOKMARK_ID="$(buku "$SEL" -f 1 --tacit | tail -n +2 | awk '{print $1}')" +# tail to trim unwanted "waiting for input" output from buku https://github.com/jarun/Buku/blob/d60d56bc9f7f5e1410e99dc8bb4e35abf5068a14/buku#L4619 + +if [[ ! -z "$BOOKMARK_ID" ]]; then + echo "Deleting $BOOKMARK_ID." + buku -d "$BOOKMARK_ID" --tacit +else + echo "Bookmark for '$SEL' not found." + exit 1 +fi diff --git a/xmonad/xmonad.hs b/xmonad/xmonad.hs index 1f7d47a..ff14005 100644 --- a/xmonad/xmonad.hs +++ b/xmonad/xmonad.hs @@ -98,8 +98,15 @@ myKeyBindings = -- save selection (link) in buku , ((mod4Mask, xK_c), - -- spawn "gksudo -S systemctl restart network-manager") spawn "$HOME/dev/libre/dotfiles/scripts/buku-add.sh") + + -- delete selection (link) from buku + , ((mod4Mask, xK_d), + spawn "$HOME/dev/libre/dotfiles/scripts/buku-delete.sh > ~/tmp/dbg-delete") + + -- archive selection (link) in buku + , ((mod4Mask, xK_a), + spawn "$HOME/dev/libre/dotfiles/scripts/buku-archive.sh > ~/tmp/dbg-archive") ] startup :: X() -- cgit v1.2.3 From c71d427f78f5a5548ce4512c8ec4e87d406b4377 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 22 Jan 2019 13:08:43 -0200 Subject: Integrate buku with newsboat. --- bash/symlinks.sh | 1 - newsboat/urls | Bin 770 -> 706 bytes scripts/atom.sh | 20 +++++++++++++++----- 3 files changed, 15 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/bash/symlinks.sh b/bash/symlinks.sh index 70e66af..573c817 100644 --- a/bash/symlinks.sh +++ b/bash/symlinks.sh @@ -51,7 +51,6 @@ ln -fs "$DOTFILES/tmux/tmux-gnu-linux.conf" ~/.tmux-gnu-linux.conf ## Newsboat mkdir -p ~/.newsboat -ln -fs "$DOTFILES/newsboat/urls" ~/.newsboat/urls ln -fs "$DOTFILES/newsboat/config" ~/.newsboat/config ## NixOS diff --git a/newsboat/urls b/newsboat/urls index 6f4ddff..ce88f4c 100644 Binary files a/newsboat/urls and b/newsboat/urls differ diff --git a/scripts/atom.sh b/scripts/atom.sh index 73c35ec..d1e968f 100755 --- a/scripts/atom.sh +++ b/scripts/atom.sh @@ -6,14 +6,24 @@ if [[ ! -d "node_modules" ]]; then npm i rss fi +RSS_DIR="$HOME/.newsboat" +LINKS_OUT="$RSS_DIR/gen/buku.urls" + +mkdir -p "$RSS_DIR/gen" + +# Empty the text file +> "$LINKS_OUT" + feed() { local tag="$1" local tmp="/tmp/$tag.json" buku -t "$tag" --json > "$tmp" - node atom.js "$tag" "$tmp" + node atom.js "$tag" "$tmp" > "$RSS_DIR/gen/$1.xml" + echo "file://$RSS_DIR/gen/$1.xml" >> "$LINKS_OUT" } -mkdir -p ~/.newsboat -feed ril > ~/.newsboat/ril.xml -feed simple-archive > ~/.newsboat/simple-archive.xml -feed inbox > ~/.newsboat/inbox.xml +feed ril +feed simple-archive +feed ril-batch + +cat "$DOTFILES/newsboat/urls" <(echo) "$LINKS_OUT" > "$RSS_DIR/urls" -- cgit v1.2.3 From 3e938ac726a9470083148ef31507e9dc6123ae0c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 22 Jan 2019 13:11:35 -0200 Subject: Setup integration between buku and newsboat. --- bash/symlinks.sh | 3 +++ scripts/buku-add.sh | 2 +- scripts/buku-archive.sh | 26 +++++++++++++++++++++----- scripts/buku-delete.sh | 26 +++++++++++++++++++++----- xmonad/xmonad.hs | 6 +++--- 5 files changed, 49 insertions(+), 14 deletions(-) (limited to 'scripts') diff --git a/bash/symlinks.sh b/bash/symlinks.sh index 573c817..f6adb0c 100644 --- a/bash/symlinks.sh +++ b/bash/symlinks.sh @@ -79,3 +79,6 @@ ln -fs /tmp/notmuch."$(date +%Y-%m-%d)".log /tmp/notmuch.log ## GNUS ln -fs "$DOTFILES/encrypted/IMAP/authinfo.gpg" ~/.authinfo.gpg + +## Buku +ln -fs /tmp/buku-xmonad."$(date +%Y-%m-%d)".log /tmp/buku-xmonad.log diff --git a/scripts/buku-add.sh b/scripts/buku-add.sh index beccd0a..005adbd 100755 --- a/scripts/buku-add.sh +++ b/scripts/buku-add.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -xsel | xargs -I{} buku -a "{}" ril +xclip -o | xargs -I{} buku -a "{}" ril diff --git a/scripts/buku-archive.sh b/scripts/buku-archive.sh index 5af56a0..6ce1e80 100755 --- a/scripts/buku-archive.sh +++ b/scripts/buku-archive.sh @@ -1,12 +1,28 @@ #!/usr/bin/env bash -set -x -SEL="$(xsel)" -BOOKMARK_ID="$(buku "$SEL" -f 1 --tacit | tail -n +2 | awk '{print $1}')" -# tail to trim unwanted "waiting for input" output from buku https://github.com/jarun/Buku/blob/d60d56bc9f7f5e1410e99dc8bb4e35abf5068a14/buku#L4619 +SEL="$(xclip -o | tr -d '\n')" +if [[ -z "${SEL// }" ]]; then + echo "Empty selection." + exit 1 +fi +BOOKMARK_ID= +IFS=" +" +BOOKMARKS="$(buku "$SEL" -f 1 --tacit)" + +for bookmark in $BOOKMARKS; do + echo "$bookmark" + ID="$(echo "$bookmark" | cut -d$'\t' -f 1)" + URL="$(echo "$bookmark" | cut -d$'\t' -f 2)" + if [[ "$URL" = "$SEL" ]]; then + BOOKMARK_ID="$ID" + break + fi +done + if [[ ! -z "$BOOKMARK_ID" ]]; then - echo "Archiving $BOOKMARK_ID." + echo "Archiving $BOOKMARK_ID (URL: $SEL)." buku -u "$BOOKMARK_ID" --tag - ril buku -u "$BOOKMARK_ID" --tag + simple-archive else diff --git a/scripts/buku-delete.sh b/scripts/buku-delete.sh index 3e2f3dd..552d6b0 100755 --- a/scripts/buku-delete.sh +++ b/scripts/buku-delete.sh @@ -1,12 +1,28 @@ #!/usr/bin/env bash -set -x -SEL="$(xsel)" -BOOKMARK_ID="$(buku "$SEL" -f 1 --tacit | tail -n +2 | awk '{print $1}')" -# tail to trim unwanted "waiting for input" output from buku https://github.com/jarun/Buku/blob/d60d56bc9f7f5e1410e99dc8bb4e35abf5068a14/buku#L4619 +SEL="$(xclip -o | tr -d '\n')" +if [[ -z "${SEL// }" ]]; then + echo "Empty selection." + exit 1 +fi +BOOKMARK_ID= +IFS=" +" +BOOKMARKS="$(buku "$SEL" -f 1 --tacit)" + +for bookmark in $BOOKMARKS; do + echo "$bookmark" + ID="$(echo "$bookmark" | cut -d$'\t' -f 1)" + URL="$(echo "$bookmark" | cut -d$'\t' -f 2)" + if [[ "$URL" = "$SEL" ]]; then + BOOKMARK_ID="$ID" + break + fi +done + if [[ ! -z "$BOOKMARK_ID" ]]; then - echo "Deleting $BOOKMARK_ID." + echo "Deleting $BOOKMARK_ID (URL: $SEL)." buku -d "$BOOKMARK_ID" --tacit else echo "Bookmark for '$SEL' not found." diff --git a/xmonad/xmonad.hs b/xmonad/xmonad.hs index ff14005..8c12ae5 100644 --- a/xmonad/xmonad.hs +++ b/xmonad/xmonad.hs @@ -98,15 +98,15 @@ myKeyBindings = -- save selection (link) in buku , ((mod4Mask, xK_c), - spawn "$HOME/dev/libre/dotfiles/scripts/buku-add.sh") + spawn "$HOME/dev/libre/dotfiles/scripts/buku-add.sh >> /tmp/buku-xmonad.log") -- delete selection (link) from buku , ((mod4Mask, xK_d), - spawn "$HOME/dev/libre/dotfiles/scripts/buku-delete.sh > ~/tmp/dbg-delete") + spawn "$HOME/dev/libre/dotfiles/scripts/buku-delete.sh >> /tmp/buku-xmonad.log") -- archive selection (link) in buku , ((mod4Mask, xK_a), - spawn "$HOME/dev/libre/dotfiles/scripts/buku-archive.sh > ~/tmp/dbg-archive") + spawn "$HOME/dev/libre/dotfiles/scripts/buku-archive.sh >> /tmp/buku-xmonad.log") ] startup :: X() -- cgit v1.2.3 From 5e0919db80267d5ed476c744e3f13f8d8f711571 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 22 Jan 2019 16:39:17 -0200 Subject: Nextcloud -> ownCloud Client change only. --- bash/env.sh | 4 +--- bash/youtube.sh | 2 +- nixos/configuration.nix | 3 ++- scripts/backup.sh | 2 +- scripts/cp-todos.sh | 4 ++-- scripts/once-only-nextcloud.sh | 9 --------- scripts/once-only-owncloud.sh | 9 +++++++++ spacemacs.el | 7 ++++--- xmonad/xmonad.hs | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) delete mode 100755 scripts/once-only-nextcloud.sh create mode 100755 scripts/once-only-owncloud.sh (limited to 'scripts') diff --git a/bash/env.sh b/bash/env.sh index d8233be..a0b750f 100644 --- a/bash/env.sh +++ b/bash/env.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -export PATH="$HOME/Nextcloud/bin/:$PATH" - # # Git Annex # @@ -33,7 +31,7 @@ export EDITOR=vi export PATH="$DOTFILES/scripts/:$PATH" export PATH="$DOTFILES/encrypted/scripts/:$PATH" export INPUTRC=~/.inputrc -export CACHE_DIR="$HOME/Nextcloud/cache" +export CACHE_DIR="$HOME/ownCloud/cache" export PATH="$HOME/dev/libre/website/:$PATH" export PATH="$DOTFILES/bin:$PATH" export PATH="$HOME/dev/misc/flutter/bin:$PATH" diff --git a/bash/youtube.sh b/bash/youtube.sh index 19c9af0..14d0371 100644 --- a/bash/youtube.sh +++ b/bash/youtube.sh @@ -12,7 +12,7 @@ export -f yt_dl download() { youtube-dl "$1" \ - --download-archive ~/Nextcloud/cache/youtube-dl-seen.conf \ + --download-archive ~/ownCloud/cache/youtube-dl-seen.conf \ --prefer-free-formats \ --playlist-end "$2" \ --write-description \ diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 6f8c7e0..95a3b27 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -105,6 +105,7 @@ gnupg mr nextcloud-client + owncloud-client borgbackup git-sizer @@ -366,7 +367,7 @@ # xmodmap -e 'keycode 118 = bar Greek_lamda' sessionCommands = '' ${pkgs.haskellPackages.xmobar}/bin/xmobar ~/.xmobarrc & - ${pkgs.fvwm}/bin/xpmroot ~/Nextcloud/Images/emotion.png & + ${pkgs.fvwm}/bin/xpmroot ~/ownCloud/Images/emotion.png & ''; }; }; diff --git a/scripts/backup.sh b/scripts/backup.sh index 6a4de25..f31a503 100755 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -27,7 +27,7 @@ borg create \ --progress \ --compression lzma,6 \ ~/borgbackup::"{hostname}-{now}-${BACKUP_TAG}" \ - ~/Nextcloud/ \ + ~/ownCloud/ \ ~/mbsync/ # add folders to be backed up here green "Done" diff --git a/scripts/cp-todos.sh b/scripts/cp-todos.sh index d8e6f30..e839ae8 100755 --- a/scripts/cp-todos.sh +++ b/scripts/cp-todos.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -cp "$HOME/annex/txt/TODOs.org" "$HOME/Nextcloud/Notes/org.txt" -cp "$HOME/annex/txt/TODOs.org" "$HOME/Nextcloud/cache/TODOs.org" +cp "$HOME/annex/txt/TODOs.org" "$HOME/ownCloud/Notes/org.txt" +cp "$HOME/annex/txt/TODOs.org" "$HOME/ownCloud/cache/TODOs.org" diff --git a/scripts/once-only-nextcloud.sh b/scripts/once-only-nextcloud.sh deleted file mode 100755 index 7886b6f..0000000 --- a/scripts/once-only-nextcloud.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -if [ "$(pidof nextcloud)" ] -then - echo "Nextcloud already running." -else - echo "Nextcloud not running yet. Starting it." - nextcloud & disown -fi diff --git a/scripts/once-only-owncloud.sh b/scripts/once-only-owncloud.sh new file mode 100755 index 0000000..66b3ee4 --- /dev/null +++ b/scripts/once-only-owncloud.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if [ "$(pidof owncloud)" ] +then + echo "ownCloud already running." +else + echo "ownCloud not running yet. Starting it." + owncloud & disown +fi diff --git a/spacemacs.el b/spacemacs.el index 9c19ac2..f30415d 100644 --- a/spacemacs.el +++ b/spacemacs.el @@ -576,7 +576,7 @@ dump." ("M-p" . (lambda () (interactive) (find-file "~/annex/txt/money.ledger"))) ("M-SPC" . (lambda () (interactive) (just-one-space -1))) ("M-[" . (lambda () (interactive) (find-file "~/tmp/scratch.org"))) - ("M-]" . (lambda () (interactive) (find-file "~/Nextcloud/Notes/TODOs.txt"))) + ("M-]" . (lambda () (interactive) (find-file "~/ownCloud/Notes/TODOs.txt"))) ("M-s-q" . (lambda () (interactive) (insert "/"))) ("M-s-w" . (lambda () (interactive) (insert "?"))) ("M-s-a" . (lambda () (interactive) (insert "\\"))) @@ -728,7 +728,7 @@ This is the place where most of your configurations should be done. Unless it is ;; - http://cachestocaches.com/2016/9/my-workflow-org-agenda ;; - http://doc.norang.ca/org-mode.html org-todo-keywords '((sequence "TODO" "NEXT" "WAITING" "INACTIVE" "CANCELLED" "MEETING" "DOING" "|" "DONE")) - org-agenda-files '("~/Nextcloud/txt/TODOs.org") + org-agenda-files '("~/ownCloud/txt/TODOs.org") org-columns-default-format "%50ITEM(Task) %10CLOCKSUM %16TIMESTAMP_IA" org-default-notes-file "~/annex/txt/TODOs.org" org-scratch-notes-file "~/annex/txt/TODOs.org" @@ -778,7 +778,8 @@ This function is called at the very end of Spacemacs initialization." ;; If there is more than one, they won't work right. '(ledger-reports (quote - (("balance" "ledger -f money.ledger balance Assets Liabilities")))) + (("balance-rs" "ledger -f money.ledger balance Assets Liabilities -V") + ("balance" "ledger -f money.ledger balance Assets Liabilities")))) '(package-selected-packages (quote (selectric-mode ob-rust fireplace writeroom-mode visual-fill-column yasnippet-snippets yapfify yaml-mode xterm-color ws-butler winum which-key web-mode web-beautify volatile-highlights vi-tilde-fringe uuidgen use-package unicode-fonts unfill toml-mode toc-org tide tagedit systemd symon swift-mode string-inflection sql-indent spaceline-all-the-icons smeargle slime-company slim-mode shell-pop seeing-is-believing scss-mode sass-mode rvm ruby-tools ruby-test-mode ruby-refactor ruby-hash-syntax rubocop rspec-mode robe rjsx-mode restclient-helm restart-emacs rbenv rake rainbow-delimiters racer pyvenv pytest pyenv-mode py-isort pug-mode psci psc-ide prettier-js powershell popwin pippel pipenv pip-requirements persp-mode perl6-mode pdf-tools password-generator paradox ox-reveal overseer orgit org-projectile org-present org-pomodoro org-mime org-download org-bullets org-brain open-junk-file ob-restclient ob-http ob-elixir nov nix-mode neotree nameless mwim multi-term move-text mmm-mode minitest markdown-toc magit-svn magit-gitflow lorem-ipsum livid-mode live-py-mode link-hint json-navigator js2-refactor js-doc jinja2-mode interleave insert-shebang indent-guide importmagic impatient-mode hungry-delete hlint-refactor hl-todo hindent highlight-parentheses highlight-numbers highlight-indentation helm-xref helm-themes helm-swoop helm-rtags helm-pydoc helm-purpose helm-projectile helm-org-rifle helm-notmuch helm-nixos-options helm-mode-manager helm-make helm-hoogle helm-gitignore helm-git-grep helm-flx helm-descbinds helm-css-scss helm-company helm-c-yasnippet helm-ag haskell-snippets google-translate google-c-style golden-ratio gnuplot gitignore-templates gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link git-gutter-fringe git-gutter-fringe+ gh-md geiser fuzzy font-lock+ flyspell-correct-helm flycheck-rust flycheck-rtags flycheck-pos-tip flycheck-perl6 flycheck-mix flycheck-ledger flycheck-haskell flycheck-elm flycheck-credo flycheck-bashate flx-ido fish-mode fill-column-indicator fancy-battery eyebrowse expand-region evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-org evil-numbers evil-nerd-commenter evil-matchit evil-magit evil-lisp-state evil-lion evil-ledger evil-indent-plus evil-iedit-state evil-goggles evil-exchange evil-escape evil-ediff evil-cleverparens evil-args evil-anzu eshell-z eshell-prompt-extras esh-help erlang emmet-mode elm-test-runner elm-mode elisp-slime-nav editorconfig dumb-jump dotenv-mode doom-modeline dockerfile-mode docker disaster diminish diff-hl define-word debbugs cython-mode csv-mode counsel-projectile company-web company-tern company-statistics company-shell company-rtags company-restclient company-plsense company-nixos-options company-lua company-ghci company-cabal company-c-headers company-auctex company-ansible company-anaconda common-lisp-snippets column-enforce-mode cmm-mode clojure-snippets clojure-cheatsheet clj-refactor clean-aindent-mode clang-format cider-eval-sexp-fu chruby centered-cursor-mode cargo bundler browse-at-remote auto-yasnippet auto-highlight-symbol auto-dictionary auto-compile auctex-latexmk ansible-doc ansible alchemist aggressive-indent adoc-mode ace-window ace-link ace-jump-helm-line ac-ispell)))) diff --git a/xmonad/xmonad.hs b/xmonad/xmonad.hs index 8c12ae5..c266676 100644 --- a/xmonad/xmonad.hs +++ b/xmonad/xmonad.hs @@ -115,5 +115,5 @@ startup = do spawn "xmobar ~/.xmobarrc" spawn "killall trayer; trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 10 --transparent true --tint 0x191970 --height 17 --monitor 1" spawn "nm-applet" - spawn "~/annex/dev/code/dotfiles/scripts/once-only-nextcloud.sh" + spawn "~/annex/dev/code/dotfiles/scripts/once-only-owncloud.sh" setWMName "LG3D" -- https://stackoverflow.com/questions/30742662/java-swing-gui-not-displaying-in-xmonad -- cgit v1.2.3 From 522ea27dc31a79bb06510f8ffd1f15614ed052a8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 23 Jan 2019 22:37:16 -0200 Subject: Remove ril-batch feed. --- scripts/atom.sh | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/atom.sh b/scripts/atom.sh index d1e968f..64c9a14 100755 --- a/scripts/atom.sh +++ b/scripts/atom.sh @@ -24,6 +24,5 @@ feed() { feed ril feed simple-archive -feed ril-batch cat "$DOTFILES/newsboat/urls" <(echo) "$LINKS_OUT" > "$RSS_DIR/urls" -- cgit v1.2.3 From e77117dd559401c309a1b3da67b676dd897cbfff Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 24 Jan 2019 00:12:05 -0200 Subject: Don't generate XML for emtpy tags. --- scripts/atom.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/atom.sh b/scripts/atom.sh index 64c9a14..4d09815 100755 --- a/scripts/atom.sh +++ b/scripts/atom.sh @@ -18,8 +18,10 @@ feed() { local tag="$1" local tmp="/tmp/$tag.json" buku -t "$tag" --json > "$tmp" - node atom.js "$tag" "$tmp" > "$RSS_DIR/gen/$1.xml" - echo "file://$RSS_DIR/gen/$1.xml" >> "$LINKS_OUT" + if [[ -s "$tmp" ]]; then + node atom.js "$tag" "$tmp" > "$RSS_DIR/gen/$1.xml" + echo "file://$RSS_DIR/gen/$1.xml" >> "$LINKS_OUT" + fi } feed ril -- cgit v1.2.3 From 84ef92c909868f09b8f3d89621eb03e981250a2a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 7 Apr 2019 18:43:11 -0300 Subject: Fix shellcheck warnings. --- bash/youtube.sh | 3 ++- scripts/atom.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/bash/youtube.sh b/bash/youtube.sh index fe22169..275e0b8 100644 --- a/bash/youtube.sh +++ b/bash/youtube.sh @@ -46,7 +46,8 @@ inc_download() { local file="$HOME/.yt-db/$id" mkdir -p "$HOME/.yt-db" cat "$file" 2> /dev/null - local n_count="$(cat "$file" 2> /dev/null || printf 10)" + local n_count + n_count="$(cat "$file" 2> /dev/null || printf 10)" local n_count_new="$((n_count + step))" echo "$n_count_new" > "$file" diff --git a/scripts/atom.sh b/scripts/atom.sh index 4d09815..6ca4110 100755 --- a/scripts/atom.sh +++ b/scripts/atom.sh @@ -12,7 +12,7 @@ LINKS_OUT="$RSS_DIR/gen/buku.urls" mkdir -p "$RSS_DIR/gen" # Empty the text file -> "$LINKS_OUT" +true > "$LINKS_OUT" feed() { local tag="$1" -- cgit v1.2.3 From 8066b7a666943dab0aed422f1e595bd926a4a745 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 7 Apr 2019 19:12:30 -0300 Subject: Replace =! -z= for =-n=. --- scripts/buku-archive.sh | 2 +- scripts/buku-delete.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/buku-archive.sh b/scripts/buku-archive.sh index 6ce1e80..2a2a702 100755 --- a/scripts/buku-archive.sh +++ b/scripts/buku-archive.sh @@ -21,7 +21,7 @@ for bookmark in $BOOKMARKS; do done -if [[ ! -z "$BOOKMARK_ID" ]]; then +if [[ -n "$BOOKMARK_ID" ]]; then echo "Archiving $BOOKMARK_ID (URL: $SEL)." buku -u "$BOOKMARK_ID" --tag - ril buku -u "$BOOKMARK_ID" --tag + simple-archive diff --git a/scripts/buku-delete.sh b/scripts/buku-delete.sh index 552d6b0..01de451 100755 --- a/scripts/buku-delete.sh +++ b/scripts/buku-delete.sh @@ -21,7 +21,7 @@ for bookmark in $BOOKMARKS; do done -if [[ ! -z "$BOOKMARK_ID" ]]; then +if [[ -n "$BOOKMARK_ID" ]]; then echo "Deleting $BOOKMARK_ID (URL: $SEL)." buku -d "$BOOKMARK_ID" --tacit else -- cgit v1.2.3