moved all of my config into this nix flake

This commit is contained in:
Sebastian Moser
2023-10-28 19:10:37 +02:00
parent 9facde9d3a
commit 112ef46fd2
46 changed files with 3545 additions and 0 deletions

4
mybin/dim Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
xinput disable "Logitech Wireless Mouse"

5
mybin/disp Executable file
View File

@@ -0,0 +1,5 @@
cmd=$1
out-default="xrandr --output HDMI-1 --same-as eDP-1 --mode 1920x1080"

4
mybin/enm Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
xinput enable "Logitech Wireless Mouse"

19
mybin/fingre Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
v_flag=""
flag=""
while getopts ':v:' flag; do
case "${flag}" in
v) v_flag="${OPTARG}";;
*) echo "invalid flag"
exit 1 ;;
esac
done
if [[ "$v_flag" == "" ]]
then
find . -not -type d | xargs grep $@ 2>/dev/null
else
find . -not -type d | grep -v "$v_flag" | xargs grep $@ 2>/dev/null
fi

5
mybin/mdolphin Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
QT_STYLE_OVERRIDE=breeze QT_SCALE_FACTOR=1.3 QT_QPA_PLATFORMTHEME=qt5ct dolphin

5
mybin/mshot Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
#gnome-screenshot -ia
flameshot gui

58
mybin/mvn Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/bash
#revert:
#svn st | grep ^D | cut -c 9- | sed 's/^/"/' | sed 's/$/"/' | xargs svn revert -R
#svn st | grep ^A | cut -c 9- | sed 's/^/"/' | sed 's/$/"/' | xargs svn revert -R
if [ "$1" == "cut" ]
then
cut -c 9- | sed 's/^/"/' | sed 's/$/"/'
fi
if [ "$1" == "e" ]
then
if [ "$2" == "" ]
then
export SVN_EDITOR=nvim
echo "DONE: export SVN_EDITOR=nvim"
else
export SVN_EDITOR=nvim
svn propedit svn:ignore $2
fi
fi
if [ "$1" == "ignore" ]
then
if [ -t 0 ]
then
echo
else
# have a pipe
cat >> ./svn-ignore
fi
# do if no or some pipe ... apply the things in the svn-ignore file
cat ./svn-ignore | tr -d '"' | sed 's/$/\/../' | xargs svn propdel svn:ignore 1>/null
cat ./svn-ignore | tr -d '"' | sed 's\^\./\' | while read p; do
name=$(echo -en "$p" | tr "/" "\n" | tail -n 1)
path=${p%/*}
prop=$(svn propget svn:ignore $path)
svn propset svn:ignore "${prop}"$'\n'"${name}" $path
echo prop: $prop
echo path: $path
done
fi
if [ "$1" == "up" ]
then
echo "-----------------------------------------------------------------"
svn st | grep ^? | cut -c 9- | sed 's/^/"/' | sed 's/$/"@/' | xargs svn add
svn st | grep ^! | cut -c 9- | sed 's/^/"/' | sed 's/$/"@/' | xargs svn rm
echo "-----------------------------------------------------------------"
svn ci -m "$2"
fi

75
mybin/ru Executable file
View File

@@ -0,0 +1,75 @@
#!/bin/bash
if [ "$1" == "sync-school" ]
then
~/work/config/rclone/sync-school.sh
elif [ "$1" == "mnt-wechner" ]
then
rclone mount --vfs-cache-mode full -vvvv onedrive-school:projekt-autobatterie ~/wechner-mount/
elif [ "$1" == "wstunnel" ]
then
wstunnel -L 55555:127.0.0.1:49388 ws://sebastian.dns.army:49389
elif [ "$1" == "speed-test-nixos-iso" ]
then
wget "https://dl.t2sde.org/binary/2022/t2-22.6-x86-64-minimal-desktop-gcc-glibc.iso"
elif [ "$1" == "p" ]
then
ping orf.at
elif [ "$1" == "mnt-files-local" ]
then
sudo mount -t cifs //192.168.1.2/files /home/me/files -o x-gvfs-hide,rw,defaults,nofail,credentials=/home/me/.mysecrets/rpi-share-files,uid=1000,iocharset=utf8,gid=1000
elif [ "$1" == "mnt-files-remote" ]
then
sshfs -o default_permissions,idmap=user,uid=1000,gid=1000 files:/home/files/storage/files /home/me/files
#fusermount -u /home/sebastian/files
#fusermount -u /home/sebastian/lan
elif [ "$1" == "mnt-lan-remote" ]
then
sshfs -o default_permissions,idmap=user,uid=1000,gid=1000 files:/home/files/storage/lan /home/me/lan
elif [ "$1" == "mnt-lan-local" ]
then
sudo mount -t cifs //192.168.1.2/lan /home/me/lan -o x-gvfs-hide,username=guest,defaults,nofail,guest,uid=1000,gid=1000,iocharset=utf8
elif [ "$1" == "bat" ]
then
now=$(cat /sys/class/power_supply/BAT0/charge_now)
full=$(cat /sys/class/power_supply/BAT0/charge_full)
stat=$(python -c "print( round($now / float($full) *100) )")
echo BAT0 at: ${stat}%
elif [ "$1" == "bstat" ]
then
cat /sys/class/power_supply/BAT0/status
elif [ "$1" == "hibernate" ]
then
sudo systemctl hibernate
fi

3
mybin/song Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
SONG_CONF_PATH=~/work/things/cool-songs.json ~/scripts/song $@

3
mybin/songt Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
SONG_CONF_PATH=~/work/things/touching-songs.json ~/scripts/song $@

181
mybin/thq Executable file
View File

@@ -0,0 +1,181 @@
#!/usr/bin/env python3
DIR = "/home/me/work/things/storage/thq"
FILE = DIR + "/main.json"
EDITOR = "nvim"
import os
import click
from click_aliases import ClickAliasedGroup
# python.....
true = True
false = False
class JSON:
from json import dumps as stringify
from json import loads as parse
@click.group(cls=ClickAliasedGroup)
def main():
pass
@main.command(aliases=["al"])
def add_link():
global data
lnk = input("LINK: ")
new = {
"type": "link",
"val": lnk
}
data.append(new)
@main.command(aliases=["als"])
def add_links():
global data
lns = []
while true:
lnk = input("LINK: ")
if lnk == "":
break
else:
lns.append(lnk)
new = {
"type": "links",
"val": lns
}
data.append(new)
@main.command(aliases=["ae"])
def add_edit():
os.system(f'{EDITOR} {DIR}/edit-file')
with open(f'{DIR}/edit-file', "r") as file:
st = file.read()
os.remove(f'{DIR}/edit-file')
new = {
"type": "string",
"val": st
}
data.append(new)
@main.command(aliases=["af"])
def add_file():
global data
os.system("mv " + file + " " + DIR + "/files")
name = file.split("/")[-1]
print(name)
new = {
"type": "file",
"val": name
}
data.append(new)
@main.command(aliases=["a"])
@click.argument("text", nargs=-1)
def add(text):
global data
new = {
"type": "string",
"val": " ".join(text)
}
data.append(new)
@main.command(aliases=["g"])
def get():
global data
if len(data) == 0:
print("Nothing to do...")
return
now = data[0]
with open(f'{DIR}/now.json', "w") as file:
file.write(JSON.stringify(now))
data.pop(0)
if now["type"] == "string":
print("now")
elif now["type"] == "link":
os.system("firefox " + now["val"])
elif now["type"] == "links":
for link in now["val"]:
os.system("firefox " + link)
elif now["type"] == "file":
print("FILE: " + now["val"])
#os.system("zath " + now["val"])
@main.command(aliases=["ar"])
def archive_now():
with open(f'{DIR}/now.json', "r") as file:
now = JSON.parse(file.read())
if not os.path.exists(FILE + "/archive.json"):
f = open(FILE + "/archive.json", "w")
f.write(JSON.stringify({"main": []}))
f.close()
with open(f'{DIR}/archive.json', "r+") as ar_file:
archive = JSON.parse(ar_file.read())
archive["main"].append(now)
ar_file.write(JSON.stringify(archive))
@main.command(aliases=["n"])
def now():
with open(f'{DIR}/now.json', "r") as file:
print(file.read())
@main.command()
def all():
global data
print(JSON.stringify(data))
@main.command(aliases=["ea"])
def edit_all():
os.system(f'{EDITOR} {DIR}/main.json')
@main.command(aliases=["l"])
def get_len():
global data
print(len(data))
@main.result_callback()
def process_result(result, **kwargs):
global data
with open(FILE, "w") as file:
file.write(JSON.stringify(data))
#############################################################################
# main
if __name__ == "__main__":
if not os.path.exists(DIR):
os.mkdir(DIR)
os.mkdir(DIR + "/files")
if not os.path.exists(FILE):
f = open(FILE, "w")
f.write(JSON.stringify([]))
f.close()
global data
with open(FILE, "r") as file:
data = JSON.parse(file.read())
main()

3
mybin/win Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
~/work/config/scripts/win -o main-win 192.168.122.5 $@