more stuff

This commit is contained in:
2023-03-20 16:27:43 -07:00
parent 28ab0d57b7
commit b626201d51
8 changed files with 412 additions and 67 deletions

View File

@@ -0,0 +1,6 @@
wget https://dl.google.com/android/repository/commandlinetools-mac-9123335_latest.zip -O ~/Downloads/as-mac-cli-tools.zip
mkdir -p ~/opt

24
scripts/mbackup Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bb
(require '[clojure.string :as str :refer [split]])
(require '[babashka.tasks :as tasks :refer [shell]])
(def drive-dest "turtlebasket-gdrive:/macbook-air-m1")
(def paths ["Desktop"
"Documents/Personal Knowledge Base"
"Documents/Berkeley Notes"])
;; currently not used
(def exclude ["*.swp" ".git" "node_modules" "__pycache__" ".DS_Store"])
(for [path paths]
(future
(let [res
(shell "rclone" "sync"
path
(format "%s/%s" drive-dest (-> path (split #"/") last))
"--progress" "--retries" 1 "--delete-excluded")]
(if (= (get res "exit") 0)
(println (format "Backed up %s" path))
(println (get res "error"))))))
;; (for [item exclude] (cons "--exclude" item))))

19
scripts/mbackup-py Normal file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env python3
from concurrent.futures import ThreadPoolExecutor
from subprocess import run as srun
DEST="turtlebasket-gdrive:/macbook-air-m1"
paths=[
"Desktop"
"Documents/Personal Knowledge Base"
"Documents/Berkeley Notes"
]
with ThreadPoolExecutor(max_workers=4) as executor:
for path in paths:
fname = path.split("/")[-1]
srun("rclone", "sync",
path,
f'{DEST}/{fname}',
"--progress", "--rertries", 1, "--delete-excluded")

19
scripts/projects-prune.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
# PROJECT DIR PRUNING SCRIPT
printf "%-40s%-20s%s\n" 'Clean git, oldest to newest' 'Date Modified' 'Size'
printf "%-40s%-20s%s\n" '===========================' '=============' '===='
for pdir in $(ls -r1dt */); do
cd $pdir
git status 2> /dev/null | grep 'nothing to commit, working tree clean' 1> /dev/null
if [ "$?" == "0" ]; then
dirModDate=$(date -r . +"%m/%d/%Y")
dirSize=$(du -sh . | awk '{print $1}')
printf "%-40s\e[32m%-20s\e[0m%s\n" $pdir $dirModDate $dirSize
fi
cd ..
done