Add bin directory
This commit is contained in:
22
bin/autostart
Executable file
22
bin/autostart
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export LOGDIR="$HOME/.var/log"
|
||||
export RUNDIR="$HOME/.var/run"
|
||||
export LIBDIR="$HOME/.var/lib"
|
||||
export BINDIR="$HOME/bin"
|
||||
|
||||
LOGFILE="$LOGDIR/autostart.log"
|
||||
|
||||
log() {
|
||||
echo "[$(date +%FT%T)] $*" >> "$LOGFILE"
|
||||
}
|
||||
|
||||
if [[ -d "$HOME/.autostart" ]] ; then
|
||||
log "Looking for autostart files."
|
||||
for f in "$HOME/.autostart/"*.sh ; do
|
||||
if [[ -x "$f" ]] ; then
|
||||
log "Executing autostart file \"$f\""
|
||||
. "$f"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
23
bin/fuck-lxc
Executable file
23
bin/fuck-lxc
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
vagrant destroy -f
|
||||
killall vagrant
|
||||
killall -9 vagrant
|
||||
|
||||
pgrep -fa lxc | grep -v fuck-lxc | awk '{print $1}' | xargs sudo kill -9
|
||||
|
||||
sudo lxc-ls -1 | xargs -l1 sudo lxc-stop --kill --name ; sudo lxc-ls -1 | xargs -l1 sudo lxc-destroy --name
|
||||
|
||||
pgrep -fa lxc | grep -v fuck-lxc | awk '{print $1}' | xargs sudo kill -9
|
||||
|
||||
rm -rf .vagrant
|
||||
|
||||
sudo systemctl restart nfs-kernel-server
|
||||
sudo systemctl restart lxc\*
|
||||
|
||||
sudo apt-get install --reinstall lxc
|
||||
|
||||
sudo systemctl restart nfs-kernel-server
|
||||
sudo systemctl restart lxc\*
|
||||
16
bin/gdrive-backup
Executable file
16
bin/gdrive-backup
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
rclone \
|
||||
--checksum \
|
||||
--delete-excluded \
|
||||
--exclude /.cache/ \
|
||||
--exclude /.vagrant.d/ \
|
||||
--exclude /.minikube/ \
|
||||
--exclude /Downloads/ \
|
||||
--exclude /downloads/ \
|
||||
--exclude /tmp/ \
|
||||
--verbose \
|
||||
--stats 60s \
|
||||
sync \
|
||||
$HOME \
|
||||
gdrive:backup
|
||||
15
bin/git-sm-commit
Executable file
15
bin/git-sm-commit
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o nounset
|
||||
|
||||
submodule_count=$(git diff --staged --submodule=log | grep -c '^Submodule')
|
||||
|
||||
if (( $submodule_count == 1 )) ; then
|
||||
msg="Update submodule $(git diff --staged --submodule=log | grep '^Submodule' | cut -d ' ' -f 2)"
|
||||
else
|
||||
msg="Update submodules"
|
||||
fi
|
||||
|
||||
git commit --edit --no-status \
|
||||
--message="$msg" \
|
||||
--message "$(git diff --staged --color=never --submodule=log | sed 's/^S/\nS/' | sed 's/^Submodule /* /' | sed 's/ >/ */')"
|
||||
21
bin/git-worktree-add
Executable file
21
bin/git-worktree-add
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o nounset
|
||||
set -o xtrace
|
||||
set -o errexit
|
||||
|
||||
cd ./.gitdir
|
||||
git fetch
|
||||
if git rev-parse --verify "${1}" >/dev/null 2>&1 ; then
|
||||
# local branch exists, use that
|
||||
git worktree add --force ../${1} "${1}"
|
||||
elif git rev-parse --verify origin/"${1}" >/dev/null 2>&1 ; then
|
||||
# remove branch exists, use that
|
||||
git worktree add --force -b ${1} ../${1} origin/${1}
|
||||
|
||||
else
|
||||
git worktree add --no-track --force -b ${1} ../${1} origin/master
|
||||
fi
|
||||
cd ../"${1}"
|
||||
git push --set-upstream origin ${1}
|
||||
git submodule update --init
|
||||
8
bin/git-worktree-rm
Executable file
8
bin/git-worktree-rm
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o nounset
|
||||
|
||||
rm -r "${1}"
|
||||
cd ./.gitdir
|
||||
git worktree remove "${1}"
|
||||
git branch -D "${1}"
|
||||
1
bin/screencfg
Symbolic link
1
bin/screencfg
Symbolic link
@@ -0,0 +1 @@
|
||||
/home/hannes-work/archive/screencfg/screencfg.py
|
||||
3
bin/share-screen
Executable file
3
bin/share-screen
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
~/code/helper-scripts/sysop-share-screen.sh pi@monitor-sysop-${1:-middle}-${2:-top} 1
|
||||
14
bin/split-multiyaml-to-json
Executable file
14
bin/split-multiyaml-to-json
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import yaml
|
||||
import json
|
||||
|
||||
data = list(yaml.load_all(sys.stdin))
|
||||
files = sys.argv[1:]
|
||||
|
||||
for i in range(len(data)):
|
||||
doc = data[i]
|
||||
path = files[i]
|
||||
with open(path, 'w') as f:
|
||||
json.dump(doc, f, indent=4)
|
||||
Reference in New Issue
Block a user