aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/backup.sh57
-rwxr-xr-xscripts/once-only-nextcloud.sh9
-rwxr-xr-xscripts/single-monitor.sh2
-rwxr-xr-xscripts/sleepsort20
-rwxr-xr-xscripts/three-monitors.sh2
5 files changed, 90 insertions, 0 deletions
diff --git a/scripts/backup.sh b/scripts/backup.sh
new file mode 100755
index 0000000..ce186d8
--- /dev/null
+++ b/scripts/backup.sh
@@ -0,0 +1,57 @@
+#!/usr/bin/env bash
+
+
+#
+# BorgBackup
+#
+
+if [ ! -d ~/UTCLOUD/ ]; then
+ red "~/UTCLOUD not attached. Backup not started."
+ exit 1
+fi
+
+if [ ! -d ~/borgbkp/ ]; then
+ yellow "~/borgbkp/ repository doesn't exist. Downloading latest version from $R:borgbkp/ into ~/borgbkp"
+ # The initial borg repo was created with:
+ # $ borg init --append-only --encryption=keyfile ~/borgbkp
+ # See also: https://borgbackup.readthedocs.io/en/stable/usage/notes.html#append-only-mode
+ rsync --verbose --progress --stats --update --recursive "$R:borgbkp/" ~/borgbkp
+fi
+
+yellow "Creating new borg archive entry"
+borg create \
+ --verbose \
+ --stats \
+ --progress \
+ --compression lzma,9 \
+ ~/borgbkp::'{hostname}-{now}' \
+ ~/Nextcloud/
+ # add folders to be backed up here
+green "Done"
+
+yellow "Syncing ~/borgbkp to ~/UTCLOUD/borgbkp/"
+rsync --verbose --progress --stats --update --recursive ~/borgbkp/ ~/UTCLOUD/borgbkp/
+green "Done"
+
+yellow "Syncing ~/borgbkp to $R:borgbkp/"
+rsync --verbose --progress --stats --update --recursive ~/borgbkp/ "$R:borgbkp/"
+green "Done"
+
+
+#
+# mr
+#
+
+yellow "Backing up git repos"
+
+pushd ~/
+
+mr master
+mr status
+mr -j16 update
+mr hd
+mr -j4 rsyncnet
+
+popd
+
+green "Done"
diff --git a/scripts/once-only-nextcloud.sh b/scripts/once-only-nextcloud.sh
new file mode 100755
index 0000000..8400080
--- /dev/null
+++ b/scripts/once-only-nextcloud.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ "$(pidof nextcloud)" ]
+then
+ echo "Nextcloud already running."
+else
+ echo "Nextcloud not running yet. Starting it."
+ nextcloud & disown
+fi
diff --git a/scripts/single-monitor.sh b/scripts/single-monitor.sh
new file mode 100755
index 0000000..ec6c5e2
--- /dev/null
+++ b/scripts/single-monitor.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+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/sleepsort b/scripts/sleepsort
new file mode 100755
index 0000000..ea20fcb
--- /dev/null
+++ b/scripts/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/three-monitors.sh b/scripts/three-monitors.sh
new file mode 100755
index 0000000..d1ef7c6
--- /dev/null
+++ b/scripts/three-monitors.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+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