Initial commit

This commit is contained in:
Tim Schubert 2021-01-24 19:00:03 +01:00
commit c2e0ef5886
Signed by: dadada
GPG key ID: EEB8D1CE62C4DFEA
9 changed files with 122 additions and 0 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Tim Schubert
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

24
archpad Executable file
View file

@ -0,0 +1,24 @@
#!/bin/sh
url="$1"
pad=$(basename $url).txt
dst="$2"
gitdir="$(dirname $dst)"
wget -Q 10m -O "${dst}" "${url}/export/txt"
status="$?"
if [ ${status} -ne 0 ]; then
echo "Failed to get pad at ${url}"
return ${status}
else
git -C "${gitdir}" add "${dst}"
changes=$(git -C "${gitdir}" diff --cached | wc -l)
if [ $changes -gt 0 ]; then
git -C "${gitdir}" commit -m "Updated: ${dst} from ${url}"
else
echo "Nothing changed for ${url}"
fi
fi
git -C "${gitdir}" reset --hard HEAD

26
colortest Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#
T='gYw' # The test text
echo -e "\n 40m 41m 42m 43m\
44m 45m 46m 47m";
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \
'1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \
' 36m' '1;36m' ' 37m' '1;37m';
do FG=${FGs// /}
echo -en " $FGs \033[$FG $T "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";
done
echo;
done
echo

22
default.nix Normal file
View file

@ -0,0 +1,22 @@
{ stdenv }:
stdenv.mkDerivation rec {
name = "dadadaScripts";
version = "1";
#src = ./src;
buildPhase = "";
installPhase = ''
mkdir -p $out/bin
cp * $out/bin
'';
meta = with stdenv.lib; {
description = "Assorted scripts";
license = licenses.mit;
platforms = platforms.linux;
maintainers = [ "dadada" ];
};
}

6
lock-session Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
qdbus org.keepassxc.KeePassXC.MainWindow /keepassxc org.keepassxc.MainWindow.lockAllDatabases
swaymsg 'output * dpms off'
swaylock -c 1f2022
swaymsg 'output * dpms on'

3
notify-failed Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
notify-send -u critical "$1" 'Unit failed' --icon=dialog-warning

3
notify-finished Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
notify-send -u low "$1" 'Unit finished' --icon=dialog-information

3
notify-starting Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
notify-send -u low "$1" 'Unit is starting' --icon=dialog-information

14
share Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
set -u
set -e
name=$(basename $1)
user="dadada"
host="share.dadada.li"
w3dir="share"
pubname="$(sha256sum $1 | cut -d " " -f 1)"
ssh ${user}@${host} "mkdir -p ${w3dir}/${pubname}" > /dev/null
scp $1 ${user}@${host}:${w3dir}/${pubname}/${name} > /dev/null
echo "https://${host}/${pubname}/${name}"