Added programs

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
2021-03-22 21:27:54 +01:00
parent c1c92fc336
commit b82dc58f26
124 changed files with 18079 additions and 0 deletions

104
.local/bin/Checking-repo Executable file
View File

@ -0,0 +1,104 @@
#!/usr/bin/env bash
####################################################
#
# SRC_PREPARE
#
# Marcin Woźniak
# y0rune@aol.com
#
# Last edit: 16-09-2020
#
###################################################
mainteiner="Marcin Woźniak"
function scanning(){
EUSCAN=$(euscan --nocolor --quiet "$1")
if [ -n "$EUSCAN" ]; then
echo $1
echo "=============== NOW: $(find ./* -mindepth 2 -maxdepth 2 -name ''"$1"'*.ebuild' | sort | tail -1) =================
$(echo -e "$EUSCAN" | tail -1)"
sleep 1
fi
}
function folder(){
cd "$1"; git pull || exit
PACKAGES=()
for FILE in */*
do
PACKAGE=$(echo "$FILE" | grep -Eo '[A-z0-9_-]+$')
PACKAGES+=("$PACKAGE")
done
for i in "${PACKAGES[@]}"
do
scanning "$i" &
done
for j in $(jobs -p)
do
wait "$j"
done
echo -n ">>> Done scanning $1"
}
function nofolder(){
if [ -z "${1}" ]; then
echo "No overlay names given"
echo "Please give at least one overlay name as a commandline argument"
echo "Exiting"
exit 1
fi
for overlay in "${@}"
do
for ebuild in $(EIX_LIMIT=0 eix --only-names --in-overlay "${overlay}")
do
euscan --nocolor --quiet "${ebuild}" &
sleep 1
done
for j in $(jobs -p)
do
wait "$j"
done
echo -n ">>> Done scanning ${overlay}"
done
}
function help(){
echo "You can use:"
echo "* -r or --repo <HERE-REPO-NAME>"
echo "* -f or --folder <FOLDER-NAME>"
echo
echo "Example of usage"
echo "./logeuscan -r src_prepare-overlay"
echo "./logeuscan -f ~/git/src_prepare-overlay"
}
function main(){
[ "$(whereis eix | wc -w)" -le "1" ] && { echo "The eix is NOT installed"; exit; }
[ "$(whereis euscan | wc -w)" -le "1" ] && { echo "The euscan is NOT installed"; exit; }
case $1 in
-h|--help)
help
;;
-r|--repo)
nofolder "$2" | tee -a "euscan-$(date -I).log"
;;
-f|--folder)
folder "$2" | tee -a "euscan-$(date -I).log"
;;
*)
echo "No found variable"; echo; help
esac
}
main "$@"

1
.local/bin/Logs Symbolic link
View File

@ -0,0 +1 @@
emerge-logs

Binary file not shown.

177
.local/bin/ansible Executable file
View File

@ -0,0 +1,177 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# PYTHON_ARGCOMPLETE_OK
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
__requires__ = ['ansible_core']
import errno
import os
import shutil
import sys
import traceback
from ansible import context
from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError
from ansible.module_utils._text import to_text
# Used for determining if the system is running a new enough python version
# and should only restrict on our documented minimum versions
_PY38_MIN = sys.version_info[:2] >= (3, 8)
_PY3_MIN = sys.version_info[:2] >= (3, 5)
_PY2_MIN = (2, 6) <= sys.version_info[:2] < (3,)
_PY_MIN = _PY3_MIN or _PY2_MIN
if not _PY_MIN:
raise SystemExit('ERROR: Ansible requires a minimum of Python2 version 2.6 or Python3 version 3.5. Current version: %s' % ''.join(sys.version.splitlines()))
class LastResort(object):
# OUTPUT OF LAST RESORT
def display(self, msg, log_only=None):
print(msg, file=sys.stderr)
def error(self, msg, wrap_text=None):
print(msg, file=sys.stderr)
if __name__ == '__main__':
display = LastResort()
try: # bad ANSIBLE_CONFIG or config options can force ugly stacktrace
import ansible.constants as C
from ansible.utils.display import Display, initialize_locale
except AnsibleOptionsError as e:
display.error(to_text(e), wrap_text=False)
sys.exit(5)
initialize_locale()
cli = None
me = os.path.basename(sys.argv[0])
try:
display = Display()
if C.CONTROLLER_PYTHON_WARNING and not _PY38_MIN:
display.deprecated(
(
'Ansible will require Python 3.8 or newer on the controller starting with Ansible 2.12. '
'Current version: %s' % ''.join(sys.version.splitlines())
),
version='2.12',
collection_name='ansible.builtin',
)
display.debug("starting run")
sub = None
target = me.split('-')
if target[-1][0].isdigit():
# Remove any version or python version info as downstreams
# sometimes add that
target = target[:-1]
if len(target) > 1:
sub = target[1]
myclass = "%sCLI" % sub.capitalize()
elif target[0] == 'ansible':
sub = 'adhoc'
myclass = 'AdHocCLI'
else:
raise AnsibleError("Unknown Ansible alias: %s" % me)
try:
mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
except ImportError as e:
# ImportError members have changed in py3
if 'msg' in dir(e):
msg = e.msg
else:
msg = e.message
if msg.endswith(' %s' % sub):
raise AnsibleError("Ansible sub-program not implemented: %s" % me)
else:
raise
b_ansible_dir = os.path.expanduser(os.path.expandvars(b"~/.ansible"))
try:
os.mkdir(b_ansible_dir, 0o700)
except OSError as exc:
if exc.errno != errno.EEXIST:
display.warning("Failed to create the directory '%s': %s"
% (to_text(b_ansible_dir, errors='surrogate_or_replace'),
to_text(exc, errors='surrogate_or_replace')))
else:
display.debug("Created the '%s' directory" % to_text(b_ansible_dir, errors='surrogate_or_replace'))
try:
args = [to_text(a, errors='surrogate_or_strict') for a in sys.argv]
except UnicodeError:
display.error('Command line args are not in utf-8, unable to continue. Ansible currently only understands utf-8')
display.display(u"The full traceback was:\n\n%s" % to_text(traceback.format_exc()))
exit_code = 6
else:
cli = mycli(args)
exit_code = cli.run()
except AnsibleOptionsError as e:
cli.parser.print_help()
display.error(to_text(e), wrap_text=False)
exit_code = 5
except AnsibleParserError as e:
display.error(to_text(e), wrap_text=False)
exit_code = 4
# TQM takes care of these, but leaving comment to reserve the exit codes
# except AnsibleHostUnreachable as e:
# display.error(str(e))
# exit_code = 3
# except AnsibleHostFailed as e:
# display.error(str(e))
# exit_code = 2
except AnsibleError as e:
display.error(to_text(e), wrap_text=False)
exit_code = 1
except KeyboardInterrupt:
display.error("User interrupted execution")
exit_code = 99
except Exception as e:
if C.DEFAULT_DEBUG:
# Show raw stacktraces in debug mode, It also allow pdb to
# enter post mortem mode.
raise
have_cli_options = bool(context.CLIARGS)
display.error("Unexpected Exception, this is probably a bug: %s" % to_text(e), wrap_text=False)
if not have_cli_options or have_cli_options and context.CLIARGS['verbosity'] > 2:
log_only = False
if hasattr(e, 'orig_exc'):
display.vvv('\nexception type: %s' % to_text(type(e.orig_exc)))
why = to_text(e.orig_exc)
if to_text(e) != why:
display.vvv('\noriginal msg: %s' % why)
else:
display.display("to see the full traceback, use -vvv")
log_only = True
display.display(u"the full traceback was:\n\n%s" % to_text(traceback.format_exc()), log_only=log_only)
exit_code = 250
sys.exit(exit_code)

1
.local/bin/ansible-config Symbolic link
View File

@ -0,0 +1 @@
ansible

342
.local/bin/ansible-connection Executable file
View File

@ -0,0 +1,342 @@
#!/usr/bin/python3
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
__requires__ = ['ansible_core']
import fcntl
import hashlib
import os
import signal
import socket
import sys
import time
import traceback
import errno
import json
from contextlib import contextmanager
from ansible import constants as C
from ansible.module_utils._text import to_bytes, to_text
from ansible.module_utils.six import PY3
from ansible.module_utils.six.moves import cPickle, StringIO
from ansible.module_utils.connection import Connection, ConnectionError, send_data, recv_data
from ansible.module_utils.service import fork_process
from ansible.parsing.ajson import AnsibleJSONEncoder, AnsibleJSONDecoder
from ansible.playbook.play_context import PlayContext
from ansible.plugins.loader import connection_loader
from ansible.utils.path import unfrackpath, makedirs_safe
from ansible.utils.display import Display
from ansible.utils.jsonrpc import JsonRpcServer
def read_stream(byte_stream):
size = int(byte_stream.readline().strip())
data = byte_stream.read(size)
if len(data) < size:
raise Exception("EOF found before data was complete")
data_hash = to_text(byte_stream.readline().strip())
if data_hash != hashlib.sha1(data).hexdigest():
raise Exception("Read {0} bytes, but data did not match checksum".format(size))
# restore escaped loose \r characters
data = data.replace(br'\r', b'\r')
return data
@contextmanager
def file_lock(lock_path):
"""
Uses contextmanager to create and release a file lock based on the
given path. This allows us to create locks using `with file_lock()`
to prevent deadlocks related to failure to unlock properly.
"""
lock_fd = os.open(lock_path, os.O_RDWR | os.O_CREAT, 0o600)
fcntl.lockf(lock_fd, fcntl.LOCK_EX)
yield
fcntl.lockf(lock_fd, fcntl.LOCK_UN)
os.close(lock_fd)
class ConnectionProcess(object):
'''
The connection process wraps around a Connection object that manages
the connection to a remote device that persists over the playbook
'''
def __init__(self, fd, play_context, socket_path, original_path, task_uuid=None, ansible_playbook_pid=None):
self.play_context = play_context
self.socket_path = socket_path
self.original_path = original_path
self._task_uuid = task_uuid
self.fd = fd
self.exception = None
self.srv = JsonRpcServer()
self.sock = None
self.connection = None
self._ansible_playbook_pid = ansible_playbook_pid
def start(self, variables):
try:
messages = list()
result = {}
messages.append(('vvvv', 'control socket path is %s' % self.socket_path))
# If this is a relative path (~ gets expanded later) then plug the
# key's path on to the directory we originally came from, so we can
# find it now that our cwd is /
if self.play_context.private_key_file and self.play_context.private_key_file[0] not in '~/':
self.play_context.private_key_file = os.path.join(self.original_path, self.play_context.private_key_file)
self.connection = connection_loader.get(self.play_context.connection, self.play_context, '/dev/null',
task_uuid=self._task_uuid, ansible_playbook_pid=self._ansible_playbook_pid)
self.connection.set_options(var_options=variables)
self.connection._socket_path = self.socket_path
self.srv.register(self.connection)
messages.extend([('vvvv', msg) for msg in sys.stdout.getvalue().splitlines()])
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.sock.bind(self.socket_path)
self.sock.listen(1)
messages.append(('vvvv', 'local domain socket listeners started successfully'))
except Exception as exc:
messages.extend(self.connection.pop_messages())
result['error'] = to_text(exc)
result['exception'] = traceback.format_exc()
finally:
result['messages'] = messages
self.fd.write(json.dumps(result, cls=AnsibleJSONEncoder))
self.fd.close()
def run(self):
try:
while not self.connection._conn_closed:
signal.signal(signal.SIGALRM, self.connect_timeout)
signal.signal(signal.SIGTERM, self.handler)
signal.alarm(self.connection.get_option('persistent_connect_timeout'))
self.exception = None
(s, addr) = self.sock.accept()
signal.alarm(0)
signal.signal(signal.SIGALRM, self.command_timeout)
while True:
data = recv_data(s)
if not data:
break
log_messages = self.connection.get_option('persistent_log_messages')
if log_messages:
display.display("jsonrpc request: %s" % data, log_only=True)
request = json.loads(to_text(data, errors='surrogate_or_strict'))
if request.get('method') == "exec_command" and not self.connection.connected:
self.connection._connect()
signal.alarm(self.connection.get_option('persistent_command_timeout'))
resp = self.srv.handle_request(data)
signal.alarm(0)
if log_messages:
display.display("jsonrpc response: %s" % resp, log_only=True)
send_data(s, to_bytes(resp))
s.close()
except Exception as e:
# socket.accept() will raise EINTR if the socket.close() is called
if hasattr(e, 'errno'):
if e.errno != errno.EINTR:
self.exception = traceback.format_exc()
else:
self.exception = traceback.format_exc()
finally:
# allow time for any exception msg send over socket to receive at other end before shutting down
time.sleep(0.1)
# when done, close the connection properly and cleanup the socket file so it can be recreated
self.shutdown()
def connect_timeout(self, signum, frame):
msg = 'persistent connection idle timeout triggered, timeout value is %s secs.\nSee the timeout setting options in the Network Debug and ' \
'Troubleshooting Guide.' % self.connection.get_option('persistent_connect_timeout')
display.display(msg, log_only=True)
raise Exception(msg)
def command_timeout(self, signum, frame):
msg = 'command timeout triggered, timeout value is %s secs.\nSee the timeout setting options in the Network Debug and Troubleshooting Guide.'\
% self.connection.get_option('persistent_command_timeout')
display.display(msg, log_only=True)
raise Exception(msg)
def handler(self, signum, frame):
msg = 'signal handler called with signal %s.' % signum
display.display(msg, log_only=True)
raise Exception(msg)
def shutdown(self):
""" Shuts down the local domain socket
"""
lock_path = unfrackpath("%s/.ansible_pc_lock_%s" % os.path.split(self.socket_path))
if os.path.exists(self.socket_path):
try:
if self.sock:
self.sock.close()
if self.connection:
self.connection.close()
if self.connection.get_option("persistent_log_messages"):
for _level, message in self.connection.pop_messages():
display.display(message, log_only=True)
except Exception:
pass
finally:
if os.path.exists(self.socket_path):
os.remove(self.socket_path)
setattr(self.connection, '_socket_path', None)
setattr(self.connection, '_connected', False)
if os.path.exists(lock_path):
os.remove(lock_path)
display.display('shutdown complete', log_only=True)
def main():
""" Called to initiate the connect to the remote device
"""
rc = 0
result = {}
messages = list()
socket_path = None
# Need stdin as a byte stream
if PY3:
stdin = sys.stdin.buffer
else:
stdin = sys.stdin
# Note: update the below log capture code after Display.display() is refactored.
saved_stdout = sys.stdout
sys.stdout = StringIO()
try:
# read the play context data via stdin, which means depickling it
vars_data = read_stream(stdin)
init_data = read_stream(stdin)
if PY3:
pc_data = cPickle.loads(init_data, encoding='bytes')
variables = cPickle.loads(vars_data, encoding='bytes')
else:
pc_data = cPickle.loads(init_data)
variables = cPickle.loads(vars_data)
play_context = PlayContext()
play_context.deserialize(pc_data)
display.verbosity = play_context.verbosity
except Exception as e:
rc = 1
result.update({
'error': to_text(e),
'exception': traceback.format_exc()
})
if rc == 0:
ssh = connection_loader.get('ssh', class_only=True)
ansible_playbook_pid = sys.argv[1]
task_uuid = sys.argv[2]
cp = ssh._create_control_path(play_context.remote_addr, play_context.port, play_context.remote_user, play_context.connection, ansible_playbook_pid)
# create the persistent connection dir if need be and create the paths
# which we will be using later
tmp_path = unfrackpath(C.PERSISTENT_CONTROL_PATH_DIR)
makedirs_safe(tmp_path)
socket_path = unfrackpath(cp % dict(directory=tmp_path))
lock_path = unfrackpath("%s/.ansible_pc_lock_%s" % os.path.split(socket_path))
with file_lock(lock_path):
if not os.path.exists(socket_path):
messages.append(('vvvv', 'local domain socket does not exist, starting it'))
original_path = os.getcwd()
r, w = os.pipe()
pid = fork_process()
if pid == 0:
try:
os.close(r)
wfd = os.fdopen(w, 'w')
process = ConnectionProcess(wfd, play_context, socket_path, original_path, task_uuid, ansible_playbook_pid)
process.start(variables)
except Exception:
messages.append(('error', traceback.format_exc()))
rc = 1
if rc == 0:
process.run()
else:
process.shutdown()
sys.exit(rc)
else:
os.close(w)
rfd = os.fdopen(r, 'r')
data = json.loads(rfd.read(), cls=AnsibleJSONDecoder)
messages.extend(data.pop('messages'))
result.update(data)
else:
messages.append(('vvvv', 'found existing local domain socket, using it!'))
conn = Connection(socket_path)
conn.set_options(var_options=variables)
pc_data = to_text(init_data)
try:
conn.update_play_context(pc_data)
conn.set_check_prompt(task_uuid)
except Exception as exc:
# Only network_cli has update_play context and set_check_prompt, so missing this is
# not fatal e.g. netconf
if isinstance(exc, ConnectionError) and getattr(exc, 'code', None) == -32601:
pass
else:
result.update({
'error': to_text(exc),
'exception': traceback.format_exc()
})
if os.path.exists(socket_path):
messages.extend(Connection(socket_path).pop_messages())
messages.append(('vvvv', sys.stdout.getvalue()))
result.update({
'messages': messages,
'socket_path': socket_path
})
sys.stdout = saved_stdout
if 'exception' in result:
rc = 1
sys.stderr.write(json.dumps(result, cls=AnsibleJSONEncoder))
else:
rc = 0
sys.stdout.write(json.dumps(result, cls=AnsibleJSONEncoder))
sys.exit(rc)
if __name__ == '__main__':
display = Display()
main()

1
.local/bin/ansible-console Symbolic link
View File

@ -0,0 +1 @@
ansible

1
.local/bin/ansible-doc Symbolic link
View File

@ -0,0 +1 @@
ansible

1
.local/bin/ansible-galaxy Symbolic link
View File

@ -0,0 +1 @@
ansible

View File

@ -0,0 +1 @@
ansible

1
.local/bin/ansible-playbook Symbolic link
View File

@ -0,0 +1 @@
ansible

1
.local/bin/ansible-pull Symbolic link
View File

@ -0,0 +1 @@
ansible

28
.local/bin/ansible-test Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/python3
# PYTHON_ARGCOMPLETE_OK
"""Command line entry point for ansible-test."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
def main():
"""Main program entry point."""
ansible_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
source_root = os.path.join(ansible_root, 'test', 'lib')
if os.path.exists(os.path.join(source_root, 'ansible_test', '_internal', 'cli.py')):
# running from source, use that version of ansible-test instead of any version that may already be installed
sys.path.insert(0, source_root)
# noinspection PyProtectedMember
from ansible_test._internal.cli import main as cli_main
cli_main()
if __name__ == '__main__':
main()

1
.local/bin/ansible-vault Symbolic link
View File

@ -0,0 +1 @@
ansible

18
.local/bin/backupSynology Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
source ~/.password
mkdir -p ~/Movies/{Anime,Videos}
mkdir -p ~/Music
mkdir -p ~/Collage
#sudo mount -t cifs //192.168.0.220/Mega -o username=${USERNAME},password=${PASSWORD},vers=2\.0 /mnt/Synology
#sudo mount -t cifs //192.168.0.220/music -o username=${USERNAME},password=${PASSWORD},vers=2\.0 ~/Music
#sudo mount -t cifs //192.168.0.220/usbshare1/Video -o username=${USERNAME},password=${PASSWORD},vers=2\.0 ~/Movies/Videos
#sudo mount -t cifs //192.168.0.220/usbshare1/Anime -o username=${USERNAME},password=${PASSWORD},vers=2\.0 ~/Movies/Anime
#sudo mount -t cifs //192.168.0.220/Studia -o username=${USERNAME},password=${PASSWORD},vers=2\.0 ~/Collage
if [ -e /mnt/Synology/Systems ]
then
echo "Starting $(date)" > ~/.cache/.logSynology
sudo rsync -r --bwlimit=1024 --update --progress /usr/mega/ /mnt/Synology >> ~/.cache/.logSynology
echo "Ending $(date)" >> ~/.cache/.logSynology
fi

8
.local/bin/bin-cp Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
chmod +x *
chown -R yorune: *
sudo cp -pr * /bin/
#sudo cp /etc/bash.bashrc ../configs
#cp /home/yorune/Arch/configs/zshrc /home/yorune/.zshrc
#cp /home/yorune/Arch/configs/vimrc /home/yorune/.vimrc
echo DONE!!

12
.local/bin/browser-x Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
KERNEL=$(uname -sr)
[[ $KERNEL =~ "icrosoft" ]] && "/mnt/c/Program Files/Mozilla Firefox/firefox.exe" "$@"
[[ $KERNEL =~ "gentoo" ]] && GDK_DPI_SCALE="1.2" firefox-bin "$@"
#[[ $KERNEL =~ "gentoo" ]] && __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia __GL_SYNC_TO_VBLANK=0 GDK_DPI_SCALE="1.2" firefox "$@"
# Firefox
# media.ffmpeg.vaapi.enabled -> true

8
.local/bin/chardetect Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from chardet.cli.chardetect import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

15
.local/bin/cleaner Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -x
sudo rm -rf /var/tmp/portage/*
sudo rm -rf /var/tmp/binpkgs/*
sudo rm -rf /var/tmp/genkernel/*
sudo rm -rf /var/cache/genkernel/*
sudo emerge -a --depclean
sudo emerge -a @preserved-rebuild
sudo eclean -C -q packages
sudo eclean -C -q -d -t1w distfiles
sudo revdep-rebuild
sudo perl-cleaner --all
sudo etc-update
sudo env-update
source /etc/profile

6
.local/bin/cleanertmp Executable file
View File

@ -0,0 +1,6 @@
sudo rm -rf /var/tmp/portage/*
sudo rm -rf /var/tmp/binpkgs/*
sudo rm -rf /var/tmp/genkernel/*
sudo rm -rf /var/cache/genkernel/*
sudo eclean-dist -d
sudo eclean-pkg -d

5
.local/bin/cmus-control Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
pkill -RTMIN+11 dwmblocks
[ "$1" = "play" ] && cmus-remote -u
[ "$1" = "next" ] && cmus-remote -n
[ "$1" = "prev" ] && cmus-remote -r

4
.local/bin/cmus-shell Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
if ! screen -r -D cmus >/dev/null ; then
screen -S cmus /usr/bin/cmus "$@"
fi

59
.local/bin/dmenumount Executable file
View File

@ -0,0 +1,59 @@
#!/bin/sh
# Gives a dmenu prompt to mount unmounted drives.
# If they're in /etc/fstab, they'll be mounted automatically.
# Otherwise, you'll be prompted to give a mountpoint from already existsing directories.
# If you input a novel directory, it will prompt you to create that directory.
getmount() { \
[ -z "$chosen" ] && exit 1
mp="$(find $1 | dmenu -i -p "Type in mount point.")"
[ "$mp" = "" ] && exit 1
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?")
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
fi
}
mountusb() { \
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')"
sudo -A mount "$chosen" && notify-send "💻 USB mounting" "$chosen mounted." && exit 0
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$3}')
getmount "/mnt /media -maxdepth 5 -type d $alreadymounted"
partitiontype="$(lsblk -no "fstype" "$chosen")"
case "$partitiontype" in
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" 741 "$mp";;
esac
notify-send "💻 USB mounting" "$chosen mounted to $mp."
}
mountandroid() { \
chosen=$(echo "$anddrives" | dmenu -i -p "Which Android device?" | cut -d : -f 1)
getmount "/media -maxdepth 3 -type d"
sudo simple-mtpfs --device "$chosen" "$mp"
notify-send "🤖 Android Mounting" "Android device mounted to $mp."
}
asktype() { \
case $(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?") in
USB) mountusb ;;
Android) mountandroid ;;
esac
}
anddrives=$(simple-mtpfs -l 2>/dev/null)
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}')"
if [ -z "$usbdrives" ]; then
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
echo "Android device(s) detected."
mountandroid
else
if [ -z "$anddrives" ]; then
echo "USB drive(s) detected."
mountusb
else
echo "Mountable USB drive(s) and Android device(s) detected."
asktype
fi
fi

41
.local/bin/dmenuumount Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
# A dmenu prompt to unmount drives.
# Provides you with mounted partitions, select one to unmount.
# Drives mounted at /, /boot and /home will not be options to unmount.
unmountusb() {
[ -z "$drives" ] && exit
chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}')
[ -z "$chosen" ] && exit
sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted."
}
unmountandroid() { \
chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")
[ -z "$chosen" ] && exit
sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted."
}
asktype() { \
case "$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" in
USB) unmountusb ;;
Android) unmountandroid ;;
esac
}
drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
if ! grep simple-mtpfs /etc/mtab; then
[ -z "$drives" ] && echo "No drives to unmount." && exit
echo "Unmountable USB drive detected."
unmountusb
else
if [ -z "$drives" ]
then
echo "Unmountable Android device detected."
unmountandroid
else
echo "Unmountable USB drive(s) and Android device(s) detected."
asktype
fi
fi

18
.local/bin/dmenuunicode Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
# Give dmenu list of all unicode characters to copy.
# Shows the selected character in dunst if running.
# Must have xclip installed to even show menu.
xclip -h >/dev/null || exit
chosen=$(grep -v "#" ~/dwm/emoji | dmenu -i -l 20 -fn Monospace-18)
[ "$chosen" != "" ] || exit
c=$(echo "$chosen" | sed "s/ .*//")
echo "$c" | tr -d '\n' | xclip -selection clipboard
notify-send "'$c' copied to clipboard." &
s=$(echo "$chosen" | sed "s/.*; //" | awk '{print $1}')
echo "$s" | tr -d '\n' | xclip
notify-send "'$s' copied to primary." &

17
.local/bin/docker-start Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash -
#===============================================================================
#
# FILE: docker-start.sh
#
# USAGE: ./docker-start.sh
#
# OPTIONS: ---
# REQUIREMENTS: openrc system
# AUTHOR: Marcin Woźniak, y0rune@aol.com
# CREATED: 11/08/2020 11:21
# REVISION: ---
#===============================================================================
sudo rc-service docker start
sleep 10
sudo docker ps

99
.local/bin/dwmstatusbar Executable file
View File

@ -0,0 +1,99 @@
#!/bin/bash
print_weather() {
[ "$(stat -c %y "/home/yorune/.config/weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && curl -s "wttr.in/$location" > "/home/yorune/.config/weatherreport"
printf "%s" "$(sed '16q;d' "/home/yorune/.config/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" && sed '13q;d' "/home/yorune/.config/weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print" ❄",$1"°","☀",$2"°"}'
}
print_volume() {
[ "$(pulsemixer --get-mute)" = "1" ] && printf "🔇" && exit
vol=$(pulsemixer --get-volume | awk '{print $1}')
printf "%s%%\\n" "🔊 $vol"
}
print_wifi(){
echo -e "$(cat /sys/class/net/w*/operstate | sed "s/down/❌/;s/up/📶/") $(cat /sys/class/net/e*/operstate | sed "s/down/❌/;s/up/🌐/")"
#echo -e "$(cat /sys/class/net/w*/operstate | sed "s/down/❌/;s/up/📶/") $(cat /sys/class/net/e*/operstate | sed "s/down/❌/;s/up/🌐/") $( [[ $(ip -br a show | awk {'print $1'}) =~ "vpn" ]] && echo "📡" || echo "❌" )"
}
print_temp(){
echo -e "🔥 $(sensors | awk '/Core 0/ {print int($3)"°C"}') $(sudo nvidia-smi -q -d temperature | grep --color=no -i "GPU Current" |egrep --color=no -o '[0-9]*')°C"
}
print_date(){
echo -e "🕛 $(date +"%d/%m %H:%M")"
}
print_mem(){
free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠 %2.2fGiB", ( $3 / 1024) )}'
}
print_music(){
# Source: https://github.com/joestandring/dwm-bar
# A dwm_bar function that shows the current artist, track, position, duration, and status from cmus
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: cmus
if ps -C cmus > /dev/null; then
ARTIST=$(cmus-remote -Q | grep -a '^tag artist' | awk '{gsub("tag artist ", "");print}')
TRACK=$(cmus-remote -Q | grep -a '^tag title' | awk '{gsub("tag title ", "");print}')
POSITION=$(cmus-remote -Q | grep -a '^position' | awk '{gsub("position ", "");print}')
DURATION=$(cmus-remote -Q | grep -a '^duration' | awk '{gsub("duration ", "");print}')
STATUS=$(cmus-remote -Q | grep -a '^status' | awk '{gsub("status ", "");print}')
SHUFFLE=$(cmus-remote -Q | grep -a '^set shuffle' | awk '{gsub("set shuffle ", "");print}')
if [ "$STATUS" = "playing" ]; then
STATUS="▶"
else
STATUS="⏸"
fi
#printf "%s%s %s - %s " "$STATUS" "$ARTIST" "$TRACK"
printf "%s" "$STATUS"
#printf "%0d:%02d/" $((POSITION%3600/60)) $((POSITION%60))
#printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60))
#printf "%s\n"
fi
}
print_battery() {
# Find the battery level
hash acpi || return 0
onl="$(acpi -V | grep "on-line")"
charge="$(cat /sys/class/power_supply/BAT*/capacity)"
time="$(awk '{print $5}' <(acpi))"
# Determine battery glyph by percentage range
if [[ -z $onl && ${charge} -gt 80 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 80 && ${charge} -gt 60 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 60 && ${charge} -gt 40 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 40 && ${charge} -gt 20 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 20 ]]; then
echo -e "❗🔋 ${charge}% ${time}"
# If charging, use animated glyph
else
echo -e "🔌"
fi
}
print_mail(){
unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
icon="$(cat "/tmp/imapsyncicon_$USER" 2>/dev/null)"
[ "$unread" = "1" ] && [ "$icon" = "" ] || echo "📬 $unread$icon"
}
print_cpu() {
cpuUse=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print int(100 - $1)"%"}')
echo -e "💻 $cpuUse"
}
while true
do
xsetroot -name "$(print_music) $(print_temp) $(print_weather) $(print_mail) $(print_cpu) $(print_mem) $(print_wifi) $(print_battery) $(print_volume) $(print_date)"
sleep 10
done

2
.local/bin/eix-repos-sync Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
for i in /usr/repos/*/.git; do ( echo $i; cd $i/..; sudo git pull; ); done

13
.local/bin/emerge-logs Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
LOGS=( $(sudo find /var/tmp/portage/ -mindepth 1 -maxdepth 5 -name "build.log") )
LEN=${#LOGS[@]}
for (( i=0; i<$LEN; i++ ));
do
echo "$(( $i + 1 )) - ${LOGS[$i]}"
done
echo
read -p 'Select number to show logs: ' NUMBER
sudo tail -f ${LOGS[$NUMBER-1]}

8
.local/bin/epylint Executable file
View File

@ -0,0 +1,8 @@
#!/usr/lib/python-exec/python3.7/python
# -*- coding: utf-8 -*-
import re
import sys
from pylint import run_epylint
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(run_epylint())

4
.local/bin/euscan Executable file
View File

@ -0,0 +1,4 @@
#!/usr/lib/python-exec/python3.8/python
# EASY-INSTALL-SCRIPT: 'euscan==9999','euscan'
__requires__ = 'euscan==9999'
__import__('pkg_resources').run_script('euscan==9999', 'euscan')

44
.local/bin/ext Executable file
View File

@ -0,0 +1,44 @@
#!/bin/sh
# A general, all-purpose extraction script. Not all extraction programs here
# are installed by LARBS automatically.
#
# Default behavior: Extract archive into new directory
# Behavior with `-c` option: Extract contents into current directory
while getopts "hc" o; do case "${o}" in
c) extracthere="True" ;;
*) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit 1 ;;
esac done
if [ -z "$extracthere" ]; then
archive="$(readlink -f "$*")" &&
directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" &&
mkdir -p "$directory" &&
cd "$directory" || exit 1
else
archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)" 2>/dev/null)"
fi
[ -z "$archive" ] && printf "Give archive to extract as argument.\\n" && exit 1
if [ -f "$archive" ] ; then
case "$archive" in
*.tar.bz2|*.tbz2) tar xvjf "$archive" ;;
*.tar.xz) tar -vxf "$archive" ;;
*.tar.gz|*.tgz) tar xvzf "$archive" ;;
*.lzma) unlzma "$archive" ;;
*.bz2) bunzip2 "$archive" ;;
*.rar) unrar x -ad "$archive" ;;
*.gz) gunzip "$archive" ;;
*.tar) tar xvf "$archive" ;;
*.zip) unzip "$archive" ;;
*.Z) uncompress "$archive" ;;
*.7z) 7z x "$archive" ;;
*.xz) unxz "$archive" ;;
*.exe) cabextract "$archive" ;;
*) printf "extract: '%s' - unknown archive method\\n" "$archive" ;;
esac
else
printf "File \"%s\" not found.\\n" "$archive"
fi

8
.local/bin/f2py Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from numpy.f2py.f2py2e import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

8
.local/bin/f2py3 Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from numpy.f2py.f2py2e import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

8
.local/bin/f2py3.6 Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.6
# -*- coding: utf-8 -*-
import re
import sys
from numpy.f2py.f2py2e import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

8
.local/bin/f2py3.7 Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.7
# -*- coding: utf-8 -*-
import re
import sys
from numpy.f2py.f2py2e import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

8
.local/bin/f2py3.8 Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from numpy.f2py.f2py2e import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

8
.local/bin/flask Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from flask.cli import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

8
.local/bin/futurize Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from libfuturize.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

28
.local/bin/gentoo-test Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
sudo mount /dev/disk/by-uuid/c61f258f-5fd1-47f2-a270-bb8aa63b0020 /mnt/gentoo
sleep 5
sync
if [ -e /dev/disk/by-uuid/c61f258f-5fd1-47f2-a270-bb8aa63b0020 ]
then
sudo mkdir -p /mnt/gentoo/proc
sudo mkdir -p /mnt/gentoo/dev
sudo mkdir -p /mnt/gentoo/sys
sudo mkdir -p /mnt/gentoo/mnt/backup/ccache
sudo cp -r $CCACHE_DIR/ccache.conf /mnt/gentoo/mnt/backup/ccache
sudo rsync -az -H /etc/portage/ /mnt/gentoo/gentoo/etc/portage/
#sudo rsync -az -H /usr/portage/ /mnt/gentoo/gentoo/usr/portage/
#sudo rsync -az -H /usr/repos/ /mnt/gentoo/gentoo/usr/repos/
sudo mount --types proc /proc /mnt/gentoo/gentoo/proc
sudo mount --rbind /sys /mnt/gentoo/gentoo/sys
sudo mount --make-rslave /mnt/gentoo/gentoo/sys
sudo mount --rbind /dev /mnt/gentoo/gentoo/dev
sudo mount --make-rslave /mnt/gentoo/gentoo/dev
sleep 5
sudo chroot /mnt/gentoo/gentoo /bin/bash
# echo "Europe/Warsaw" > /etc/timezone
# emerge --config sys-libs/timezone-data
# emerge dev-util/ccache app-shells/oh-my-zsh app-admin/sudo app-editors/vim
fi

3
.local/bin/geoip Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
curl -s ipinfo.io/$1

16
.local/bin/getforecast Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# Updates weather forecast
FILE="$HOME/.config/.weatherreport.tmp"
FILER="$HOME/.config/weatherreport"
location="Kleczew"
curl -s --max-time 10 "wttr.in/$location" > $FILE
if [ -s "$FILE" ]
then
mv $FILE $FILER
# notify-send " Weather" "The weather forecast has been updated."
else
rm $FILE
fi

133
.local/bin/gfetch Executable file
View File

@ -0,0 +1,133 @@
#!/bin/sh
# Copyright (c) 2020, XGQT
# Licensed under the ISC License
# .vir.
# ,d$$$$$$b.
# &&&&( )&&&b
# Q$$$$$$$$$$B
# "$$$$$$$P
# ,d$$$$$$P"
# $$$$$$P
# `Q$$P"
# gfetch - tiny system info for gentoo
# based on:
# https://github.com/jschx/ufetch/
# INFO
host="$(hostname 2>/dev/null)"
cpu="$(uname -p 2>/dev/null)"
kernel="$(uname -sr 2>/dev/null)"
uptime="$(uptime -p 2>/dev/null | sed 's/up //')"
shell="$(basename "${SHELL}" 2>/dev/null)"
if [ -f /etc/lsb-release ]
then
os="$(cut -d \" -f 2 < /etc/lsb-release) $(uname -m)"
elif [ -f /etc/os-release ]
then
os="$(cut -d = -f 2 < /etc/os-release | sed 1q) $(uname -m)"
else
os="Gentoo $(uname -m)"
fi
if [ -d "${EPREFIX}"/var/db/pkg ]
then
packages="All: $(find "${EPREFIX}"/var/db/pkg/*/* -type d | wc -l)"
real="Real: $(find "${EPREFIX}"/var/db/pkg/*/* -type d | grep -c -v -E 'acct-group|acct-user|app-eselect|java-virtuals|media-fonts|virtual')"
else
packages="n/a"
real=""
fi
if [ -f "${EPREFIX}"/var/lib/portage/world ]
then
world="World: $(wc -l < "${EPREFIX}"/var/lib/portage/world)"
else
world=""
fi
if [ -n "${DE}" ]
then
ui="${DE}"
uitype='DE'
elif [ -n "${WM}" ]
then
ui="${WM}"
uitype='WM'
elif [ -n "${XDG_CURRENT_DESKTOP}" ]
then
ui="${XDG_CURRENT_DESKTOP}"
uitype='DE'
elif [ -n "${DESKTOP_SESSION}" ]
then
ui="${DESKTOP_SESSION}"
uitype='DE'
elif [ -f "${HOME}/.xinitrc" ]
then
ui="$(tail -n 1 "${HOME}/.xinitrc" | cut -d ' ' -f 2)"
uitype='WM'
elif [ -f "${HOME}/.xsession" ]
then
ui="$(tail -n 1 "${HOME}/.xsession" | cut -d ' ' -f 2)"
uitype='WM'
else
ui='unknown'
uitype='UI'
fi
# Color Definitions
if [ -x "$(command -v tput)" ]; then
bold="$(tput bold)"
# black="$(tput setaf 0)"
# red="$(tput setaf 1)"
# green="$(tput setaf 2)"
# yellow="$(tput setaf 3)"
# blue="$(tput setaf 4)"
magenta="$(tput setaf 5)"
# cyan="$(tput setaf 6)"
white="$(tput setaf 7)"
reset="$(tput sgr0)"
fi
# Output color
# labels
lc="${reset}${bold}${magenta}"
# user and hostname
nc="${reset}${bold}${magenta}"
# info
ic="${reset}${bold}${white}"
# first color
c0="${reset}${bold}${magenta}"
# second color
c1="${reset}${magenta}"
# OUTPUT
cat <<EOF
${c0} .vir. ${nc}${USER}${ic}@${nc}${host}${reset}
${c0} ,d\$\$\$\$${c1}\$\$b. ${lc}CPU: ${ic}${cpu}${reset}
${c0} &&&&${c1}( )&&&b ${lc}OS: ${ic}${os}${reset}
${c0} Q\$\$\$\$\$\$\$\$${c1}\$\$B ${lc}KERNEL: ${ic}${kernel}${reset}
${c0} "\$\$\$\$\$${c1}\$\$P ${lc}UP: ${ic}${uptime}${reset}
${c0} ,d\$\$\$\$${c1}\$\$P" ${lc}PKGS: ${ic}${packages} ${world} ${real}${reset}
${c0} \$\$\$\$${c1}\$\$P ${lc}SHELL: ${ic}${shell}${reset}
${c0} \`Q\$\$${c1}P" ${lc}${uitype}: ${ic}${ui}${reset}
EOF

11
.local/bin/git-init-folder Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
mkdir $1
cd $1
git init
touch README.md
git add README.md
git commit -m "first commit"
curl -u 'linux923344' https://api.github.com/user/repos -d '{"name":"'$1'"}'
git remote add origin git@github.com:linux923344/$1.git
git push -u origin master

8
.local/bin/haruhi-dl Executable file
View File

@ -0,0 +1,8 @@
#!/usr/lib/python-exec/python3.8/python3
# -*- coding: utf-8 -*-
import re
import sys
from haruhi_dl import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

6
.local/bin/iptables-restart Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
sudo rc-service iptables stop
sudo iptables -F
sudo ~/.config/iptables
sudo /etc/init.d/iptables save
sudo rc-service iptables start

42
.local/bin/iptables-update Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
TEMP=/tmp/iptablesTemp
FINAL="/home/yorune/.config/iptables"
LINK="https://www.ipdeny.com/ipblocks/data/countries/all-zones.tar.gz"
#BLOCKEDCOUNTRIES=(ad ae af ag ai al am ao ap aq ar as at au aw ax az ba bb bd be bf bg bh bi bj bl bm bn bo bq br bs bt bw by bz ca cd cf cg ch ci ck cl cm cn co cr cu cv cw cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gb gd ge gf gg gh gi gl gm gn gp gq gr gt gu gw gy hk hn hr ht hu id ie il im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc li lk lr ls lt lu lv ly ma mc md me mf mg mh mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pm pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg si sk sl sm sn so sr ss st sv sx sy sz tc td tg th tj tk tl tm tn to tr tt tv tw tz ua ug us uy uz va vc ve vg vivn vu wf ws ye yt za zm zw)
BLOCKEDCOUNTRIES=(af ax al dz as ad ao ai aq ag ar am aw au az bs bh bd bb by bz bj bm bt bo ba bw br io bn bg bf bi kh cm cv cf td cl cn co km cg cd ck cr ci hr cu cy dj dm do ec sv gq er ee et fk fj gf ga gm ge gh gi gd gp gu gt gn gw ht hn hk hu is in id ir iq im il jm je jo kz ke ki kp kr kw kg la lv lb ls lr ly mo mk mg mw my mv ml mt mh mq mr mu yt fm md mc mn me ms ma mz mm na nr np nc nz ni ne ng nu nf mp om pk pw ps pa py pe pr qa re ro ru rw kn lc pm vc ws sm st sa sn rs sc sl sg sk si sb so za es lk sd sr sy tw tj tz th tl tg tk to tt tn tr tm tc ug ua ae uy uz vu ve vn vg vi ye zm zw)
cd $HOME
mkdir {blocked,allzones}
curl -LO $LINK
tar xzvf all-zones.tar.gz -C allzones
rm all-zones.tar.gz
sed -n '/# CONFIGURATION:/,/# END OF CONFIG/p' $FINAL > beggining.txt
sed -n '/# END CONFIGURATION:/,/# END OF CONFIGURATION/p' $FINAL > end.txt
for blockedCountries in "${BLOCKEDCOUNTRIES[@]}"
do
mv allzones/$blockedCountries.zone blocked/
done
for f in blocked/*.zone;
do
echo "Adding $f to iptables.."
echo "" >> $TEMP
echo "# Adding zone $f" >> $TEMP
while read line; do
echo "iptables -A INPUT -s $line -j DROP" >> $TEMP
#echo "-A INPUT -s $line -j DROP" >> $TEMP
done < $f
done
cat beggining.txt > $FINAL
cat $TEMP >> $FINAL
echo "" >> $FINAL
cat end.txt >> $FINAL
rm -rf blocked allzones $TEMP beggining.txt end.txt
sh ~/.local/bin/iptables-restart
#systemctl restart iptables

8
.local/bin/isort Executable file
View File

@ -0,0 +1,8 @@
#!/usr/lib/python-exec/python3.7/python
# -*- coding: utf-8 -*-
import re
import sys
from isort.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

73
.local/bin/mailsync Executable file
View File

@ -0,0 +1,73 @@
#!/bin/bash
# Sync mail and give notification if there is new mail.
# Run only if user logged in (prevent cron errors)
export DISPLAY=:0
pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;}
# Run only if not already running in other instance
pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;}
# Checks for internet connection and set notification script.
ping -q -c 1 1.1.1.1 > /dev/null || { echo "No internet connection detected."; exit ;}
command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script."
# Required to display notifications if run as a cronjob:
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
# For individual configurations:
[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store"
# Settings are different for MacOS (Darwin) systems.
if [ "$(uname)" = "Darwin" ]; then
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
messageinfo() { osascript "display notification with title \"📧 $from\" subtitle \"$subject\"" ;}
else
notify() { notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;}
messageinfo() { notify-send --app-name="mutt-wizard" "📧$from:" "$subject" ;}
fi
# Check account for new mail. Notify if there is new content.
syncandnotify() {
acc="$(echo "$account" | sed "s/.*\///")"
mbsync $opts "$acc"
new=$(find $(ls $HOME/.local/share/mail/$acc/* | grep -i inbox | sed 's/\://')/new -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null)
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
if [ "$newcount" -gt "0" ]; then
notify "$acc" "$newcount" &
for file in $new; do
# Extract subject and sender from mail.
from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//')
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n-1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n')
messageinfo &
done
fi
}
# Sync accounts passed as argument or all.
if [ "$#" -eq "0" ]; then
accounts="$(awk '/^Channel/ {print $2}' "$HOME/.mbsyncrc")"
else
for arg in "$@"; do
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1
done
accounts=$*
fi
echo " 🔃" > /tmp/imapsyncicon_"$USER"
( pkill -RTMIN+12 "${STATUSBAR:-blocks}" >/dev/null 2>&1 ) 2>/dev/null
# Parallelize multiple accounts
for account in $accounts
do
syncandnotify &
done
wait
rm -f /tmp/imapsyncicon_"$USER"
( pkill -RTMIN+12 "${STATUSBAR:-blocks}" >/dev/null 2>&1 ) 2>/dev/null
notmuch new 2>/dev/null
#Create a touch file that indicates the time of the last run of mailsync
touch "$HOME/.config/mutt/.mailsynclastrun"

2
.local/bin/minecraft-launcher Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
__NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia __GL_SYNC_TO_VBLANK=0 java -jar ~/Downloads/TLauncher-2.75/TLauncher-2.75.jar

10
.local/bin/mouse-set Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
choices="Off\nCycle"
chosen=$(echo -e "$choices" | dmenu -i)
mouse=$(sudo ratbag-command list | awk '{print $1}' | sed 's/://')
case "$chosen" in
Off) sudo ratbag-command led 0 set mode off $mouse ;;
Cycle) sudo ratbag-command led 0 set mode cycle $mouse && sudo ratbag-command led 0 set rate 25000 $mouse ;;
esac

2
.local/bin/night Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
redshift -l 52.2327:18.3036 -t 6500:3200&

4
.local/bin/notify-program Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
KERNEL=$(uname -sr)
[[ $KERNEL =~ "icrosoft" ]] && $HOME/.local/bin/wsl-notify "$@"
[[ $KERNEL =~ "gentoo" ]] && /usr/bin/notify-send "$@"

2
.local/bin/password-manager Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
QT_SCALE_FACTOR=1.5 keepassxc

8
.local/bin/pasteurize Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from libpasteurize.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

223
.local/bin/pwiz.py Executable file
View File

@ -0,0 +1,223 @@
#!/usr/bin/python3.8
import datetime
import sys
from getpass import getpass
from optparse import OptionParser
from peewee import *
from peewee import print_
from peewee import __version__ as peewee_version
from playhouse.cockroachdb import CockroachDatabase
from playhouse.reflection import *
HEADER = """from peewee import *%s
database = %s('%s'%s)
"""
BASE_MODEL = """\
class BaseModel(Model):
class Meta:
database = database
"""
UNKNOWN_FIELD = """\
class UnknownField(object):
def __init__(self, *_, **__): pass
"""
DATABASE_ALIASES = {
CockroachDatabase: ['cockroach', 'cockroachdb', 'crdb'],
MySQLDatabase: ['mysql', 'mysqldb'],
PostgresqlDatabase: ['postgres', 'postgresql'],
SqliteDatabase: ['sqlite', 'sqlite3'],
}
DATABASE_MAP = dict((value, key)
for key in DATABASE_ALIASES
for value in DATABASE_ALIASES[key])
def make_introspector(database_type, database_name, **kwargs):
if database_type not in DATABASE_MAP:
err('Unrecognized database, must be one of: %s' %
', '.join(DATABASE_MAP.keys()))
sys.exit(1)
schema = kwargs.pop('schema', None)
DatabaseClass = DATABASE_MAP[database_type]
db = DatabaseClass(database_name, **kwargs)
return Introspector.from_database(db, schema=schema)
def print_models(introspector, tables=None, preserve_order=False,
include_views=False, ignore_unknown=False, snake_case=True):
database = introspector.introspect(table_names=tables,
include_views=include_views,
snake_case=snake_case)
db_kwargs = introspector.get_database_kwargs()
header = HEADER % (
introspector.get_additional_imports(),
introspector.get_database_class().__name__,
introspector.get_database_name(),
', **%s' % repr(db_kwargs) if db_kwargs else '')
print_(header)
if not ignore_unknown:
print_(UNKNOWN_FIELD)
print_(BASE_MODEL)
def _print_table(table, seen, accum=None):
accum = accum or []
foreign_keys = database.foreign_keys[table]
for foreign_key in foreign_keys:
dest = foreign_key.dest_table
# In the event the destination table has already been pushed
# for printing, then we have a reference cycle.
if dest in accum and table not in accum:
print_('# Possible reference cycle: %s' % dest)
# If this is not a self-referential foreign key, and we have
# not already processed the destination table, do so now.
if dest not in seen and dest not in accum:
seen.add(dest)
if dest != table:
_print_table(dest, seen, accum + [table])
print_('class %s(BaseModel):' % database.model_names[table])
columns = database.columns[table].items()
if not preserve_order:
columns = sorted(columns)
primary_keys = database.primary_keys[table]
for name, column in columns:
skip = all([
name in primary_keys,
name == 'id',
len(primary_keys) == 1,
column.field_class in introspector.pk_classes])
if skip:
continue
if column.primary_key and len(primary_keys) > 1:
# If we have a CompositeKey, then we do not want to explicitly
# mark the columns as being primary keys.
column.primary_key = False
is_unknown = column.field_class is UnknownField
if is_unknown and ignore_unknown:
disp = '%s - %s' % (column.name, column.raw_column_type or '?')
print_(' # %s' % disp)
else:
print_(' %s' % column.get_field())
print_('')
print_(' class Meta:')
print_(' table_name = \'%s\'' % table)
multi_column_indexes = database.multi_column_indexes(table)
if multi_column_indexes:
print_(' indexes = (')
for fields, unique in sorted(multi_column_indexes):
print_(' ((%s), %s),' % (
', '.join("'%s'" % field for field in fields),
unique,
))
print_(' )')
if introspector.schema:
print_(' schema = \'%s\'' % introspector.schema)
if len(primary_keys) > 1:
pk_field_names = sorted([
field.name for col, field in columns
if col in primary_keys])
pk_list = ', '.join("'%s'" % pk for pk in pk_field_names)
print_(' primary_key = CompositeKey(%s)' % pk_list)
elif not primary_keys:
print_(' primary_key = False')
print_('')
seen.add(table)
seen = set()
for table in sorted(database.model_names.keys()):
if table not in seen:
if not tables or table in tables:
_print_table(table, seen)
def print_header(cmd_line, introspector):
timestamp = datetime.datetime.now()
print_('# Code generated by:')
print_('# python -m pwiz %s' % cmd_line)
print_('# Date: %s' % timestamp.strftime('%B %d, %Y %I:%M%p'))
print_('# Database: %s' % introspector.get_database_name())
print_('# Peewee version: %s' % peewee_version)
print_('')
def err(msg):
sys.stderr.write('\033[91m%s\033[0m\n' % msg)
sys.stderr.flush()
def get_option_parser():
parser = OptionParser(usage='usage: %prog [options] database_name')
ao = parser.add_option
ao('-H', '--host', dest='host')
ao('-p', '--port', dest='port', type='int')
ao('-u', '--user', dest='user')
ao('-P', '--password', dest='password', action='store_true')
engines = sorted(DATABASE_MAP)
ao('-e', '--engine', dest='engine', default='postgresql', choices=engines,
help=('Database type, e.g. sqlite, mysql, postgresql or cockroachdb. '
'Default is "postgresql".'))
ao('-s', '--schema', dest='schema')
ao('-t', '--tables', dest='tables',
help=('Only generate the specified tables. Multiple table names should '
'be separated by commas.'))
ao('-v', '--views', dest='views', action='store_true',
help='Generate model classes for VIEWs in addition to tables.')
ao('-i', '--info', dest='info', action='store_true',
help=('Add database information and other metadata to top of the '
'generated file.'))
ao('-o', '--preserve-order', action='store_true', dest='preserve_order',
help='Model definition column ordering matches source table.')
ao('-I', '--ignore-unknown', action='store_true', dest='ignore_unknown',
help='Ignore fields whose type cannot be determined.')
ao('-L', '--legacy-naming', action='store_true', dest='legacy_naming',
help='Use legacy table- and column-name generation.')
return parser
def get_connect_kwargs(options):
ops = ('host', 'port', 'user', 'schema')
kwargs = dict((o, getattr(options, o)) for o in ops if getattr(options, o))
if options.password:
kwargs['password'] = getpass()
return kwargs
if __name__ == '__main__':
raw_argv = sys.argv
parser = get_option_parser()
options, args = parser.parse_args()
if len(args) < 1:
err('Missing required parameter "database"')
parser.print_help()
sys.exit(1)
connect = get_connect_kwargs(options)
database = args[-1]
tables = None
if options.tables:
tables = [table.strip() for table in options.tables.split(',')
if table.strip()]
introspector = make_introspector(options.engine, database, **connect)
if options.info:
cmd_line = ' '.join(raw_argv[1:])
print_header(cmd_line, introspector)
print_models(introspector, tables, options.preserve_order, options.views,
options.ignore_unknown, not options.legacy_naming)

8
.local/bin/pylint Executable file
View File

@ -0,0 +1,8 @@
#!/usr/lib/python-exec/python3.7/python
# -*- coding: utf-8 -*-
import re
import sys
from pylint import run_pylint
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(run_pylint())

8
.local/bin/pyreverse Executable file
View File

@ -0,0 +1,8 @@
#!/usr/lib/python-exec/python3.7/python
# -*- coding: utf-8 -*-
import re
import sys
from pylint import run_pyreverse
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(run_pyreverse())

5
.local/bin/rasp Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
sudo chown yorune: /mnt/rasp
sshfs root@192.168.0.222:/mnt/ /mnt/rasp/
sleep 10
cd /mnt/rasp

BIN
.local/bin/rcon Executable file

Binary file not shown.

19
.local/bin/record Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
AUDIO=$(pactl list sources | awk '/Name: alsa_out/{print $2}' | head -n1)
pkill -9 xautolock; xset s 10800
ffmpeg \
-f pulse \
-i "$AUDIO" \
-f x11grab \
-framerate 60 \
-r 30 \
-s 1920x1080 \
-i :0 \
-b:v 5500k \
-c:v h264 -preset ultrafast -c:a aac \
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4"
xset s 600&
xautolock -time 15 -locker slock&

6
.local/bin/remove-kernel Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
sudo emerge -C "=sys-kernel/gentoo-sources-$1"
sudo rm -rf /usr/src/linux-$1-gentoo
sudo rm -rf /lib/modules/$1-gentoo-x86_64
sudo rm -rf /boot/*$1*
sudo grub-mkconfig -o /boot/grub/grub.cfg

2
.local/bin/runJava Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
__NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia __GL_SYNC_TO_VBLANK=0 DRI_PRIME=1 exec java "$@"

4
.local/bin/saver-off Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
xset s off
xset -dpms
pkill -9 xautolock

25
.local/bin/sb-battery Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
print_battery() {
# Find the battery level
hash acpi || return 0
onl="$(acpi -V | grep "on-line")"
charge="$(cat /sys/class/power_supply/BAT*/capacity)"
time="$(awk '{print $5}' <(acpi))"
# Determine battery glyph by percentage range
if [[ -z $onl && ${charge} -gt 80 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 80 && ${charge} -gt 60 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 60 && ${charge} -gt 40 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 40 && ${charge} -gt 20 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 20 ]]; then
echo -e "❗🔋 ${charge}% ${time}"
# If charging, use animated glyph
else
echo -e "🔌"
fi
}
print_battery

5
.local/bin/sb-clock Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
print_date(){
echo -e "🕛 $(date +"%d/%m %H:%M")"
}
print_date

6
.local/bin/sb-cpu Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
print_cpu() {
cpuUse=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print int(100 - $1)"%"}')
echo -e "💻 $cpuUse"
}
print_cpu

7
.local/bin/sb-mail Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
print_mail(){
unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
icon="$(cat "/tmp/imapsyncicon_$USER" 2>/dev/null)"
[ "$unread" = "1" ] && [ "$icon" = "" ] || echo "📬 $unread$icon"
}
print_mail

5
.local/bin/sb-mem Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
print_mem(){
free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠 %2.2fGiB", ( $3 / 1024) )}'
}
print_mem

30
.local/bin/sb-music Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
print_music(){
# Source: https://github.com/joestandring/dwm-bar
# A dwm_bar function that shows the current artist, track, position, duration, and status from cmus
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: cmus
if ps -C cmus > /dev/null; then
ARTIST=$(cmus-remote -Q | grep -a '^tag artist' | awk '{gsub("tag artist ", "");print}')
TRACK=$(cmus-remote -Q | grep -a '^tag title' | awk '{gsub("tag title ", "");print}')
POSITION=$(cmus-remote -Q | grep -a '^position' | awk '{gsub("position ", "");print}')
DURATION=$(cmus-remote -Q | grep -a '^duration' | awk '{gsub("duration ", "");print}')
STATUS=$(cmus-remote -Q | grep -a '^status' | awk '{gsub("status ", "");print}')
SHUFFLE=$(cmus-remote -Q | grep -a '^set shuffle' | awk '{gsub("set shuffle ", "");print}')
if [ "$STATUS" = "playing" ]; then
STATUS="▶"
else
STATUS="⏸"
fi
#printf "%s%s %s - %s " "$STATUS" "$ARTIST" "$TRACK"
printf "%s" "$STATUS"
#printf "%0d:%02d/" $((POSITION%3600/60)) $((POSITION%60))
#printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60))
#printf "%s\n"
fi
}
print_music

5
.local/bin/sb-network Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
print_wifi(){
echo -e "$(cat /sys/class/net/w*/operstate | sed "s/down/❌/;s/up/📶/") $(cat /sys/class/net/e*/operstate | sed "s/down/❌/;s/up/🌐/")"
}
print_wifi

5
.local/bin/sb-temp Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
print_temp(){
echo -e "🔥 $(sensors | awk '/Core 0/ {print int($3)"°C"}') $(sudo nvidia-smi -q -d temperature | grep --color=no -i "GPU Current" |egrep --color=no -o '[0-9]*')°C"
}
print_temp

7
.local/bin/sb-volume Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
print_volume() {
[ "$(pulsemixer --get-mute)" = "1" ] && printf "🔇" && exit
vol=$(pulsemixer --get-volume | awk '{print $1}')
printf "%s%%\\n" "🔊 $vol"
}
print_volume

7
.local/bin/sb-weather Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
print_weather() {
[ "$(stat -c %y "/home/yorune/.config/weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && curl -s "wttr.in/$location" > "/home/yorune/.config/weatherreport"
printf "%s" "$(sed '16q;d' "/home/yorune/.config/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" && sed '13q;d' "/home/yorune/.config/weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print" ❄",$1"°","☀",$2"°"}'
}
print_weather

13
.local/bin/screen-switcher Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
choices="Left\nRight\nDuplicated\nHDMI\nMonitor\nTV\n"
chosen=$(echo -e "$choices" | dmenu -i)
case "$chosen" in
Monitor) mons -o ;;
Duplicated) mons -d ;;
Left) mons -e left ;;
Right) mons -e right ;;
HDMI) mons -s ;;
TV) xrandr --output HDMI-1 --left-of eDP-1 --mode 1366x768 --rate 60
esac

7
.local/bin/screenshot Executable file
View File

@ -0,0 +1,7 @@
FILE="/tmp/`date +%Y%m%d-%H.%M.%S.png`"
NAME=$(date +%s | sha256sum | base64 | head -c 20 ; echo)
gnome-screenshot -f "$FILE"
rsync -avz --delete $FILE -e "ssh -p 22" root@209.250.255.224:/var/www/yorune.pl/u/$NAME.png &&
echo -e "https://yorune.pl/u/$NAME.png" | xclip -selection clipboard && notify-send "Screenshot has been updated"

7
.local/bin/screenshot-area Executable file
View File

@ -0,0 +1,7 @@
FILE="/tmp/`date +%Y%m%d-%H.%M.%S.png`"
NAME=$(date +%s | sha256sum | base64 | head -c 20 ; echo)
gnome-screenshot --area -f "$FILE"
rsync -avz --delete $FILE -e "ssh -p 22" root@209.250.255.224:/var/www/yorune.pl/u/$NAME.png &&
echo -e "https://yorune.pl/u/$NAME.png" | xclip -selection clipboard && notify-send "Screenshot has been updated"

7
.local/bin/set-wallpaper Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
cp $1 ~/.wall.jpg
#feh --bg-scale /home/yorune/.wall.jpg
feh --bg-fill /home/yorune/.wall.jpg
#wal -i $1 -o wal-set
notify-send "Wallpaper changed"

11
.local/bin/shut-sup-rest Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
choices="Lock\nSuspend\nReboot\nShutdown"
chosen=$(echo -e "$choices" | dmenu -i)
case "$chosen" in
Lock) slock ;;
Suspend) sudo s2ram && slock ;;
Reboot) sudo reboot ;;
Shutdown) sudo shutdown -h now ;;
esac

2000
.local/bin/speedtest-cli Executable file

File diff suppressed because it is too large Load Diff

6
.local/bin/ssh-permissions Executable file
View File

@ -0,0 +1,6 @@
chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/known_hosts
chmod 644 ~/.ssh/config
chmod 400 ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa.pub

5
.local/bin/stream Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
KERNEL=$(uname -sr)
[[ $KERNEL =~ "icrosoft" ]] && nohup streamlink -p "https://www.twitch.tv/riotgames best" $1 best > /dev/null 2>&1 &
[[ $KERNEL =~ "gentoo" ]] && nohup streamlink -p mpv $1 best > /dev/null 2>&1 &

15
.local/bin/suspend-at-time Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
#./suspend-at-time 0:00
RUNAT="$1"
while [ 1 ]
do
DATE=`/bin/date +%H:%M`
if [ $DATE. = $RUNAT. ]
then
sudo systemctl suspend
echo ""DONE" at "$(date)""
pkill suspend-at-time
fi
done

8
.local/bin/symilar Executable file
View File

@ -0,0 +1,8 @@
#!/usr/lib/python-exec/python3.7/python
# -*- coding: utf-8 -*-
import re
import sys
from pylint import run_symilar
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(run_symilar())

BIN
.local/bin/tea Executable file

Binary file not shown.

3
.local/bin/temp Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
echo -e "CPU: $(sensors | awk '/Core 0/ {print $3}'| egrep --color=no -o '[0-9]+\.' | sed 's/\.//')"; echo -e "GPU: $(sudo nvidia-smi -q -d temperature | grep --color=no -i "GPU Current" |egrep --color=no -o '[0-9]*')"

3
.local/bin/term-wmi Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
xfreerdp /size:1920:1080 /u:s434812 /d:LABS /v:term.wmi.amu.edu.pl /cert:deny /sound /dynamic-resolution
#rdesktop -u "\LABS\s434812" -g 90% term.wmi.amu.edu.pl

5713
.local/bin/trans Executable file

File diff suppressed because it is too large Load Diff

22
.local/bin/twitch Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
CLIENT_ID=SET_CLIENT_ID_HERE
OAUTH_TOKEN=SET_OAUTH_TOKEN_HERE
if [ -z "$1" ]; then
curl -s \
-H 'Accept: application/vnd.twitchtv.v5+json' \
-H "Client-ID: ${TWITCH_CLIENT_ID:-$CLIENT_ID}" \
-H "Authorization: OAuth ${TWITCH_OAUTH_TOKEN:-$OAUTH_TOKEN}" \
-X GET 'https://api.twitch.tv/kraken/streams/followed' | \
ramda \
'tap (res) -> if res.error then console.error(res); process.exit(1)' \
'.streams' \
'map pick-dot-paths [\channel.name, \channel.status, \game, \viewers]' \
'map flat' \
'map (rename-keys-by split(".") >> last)' \
'-> if is-empty(it) then "No one you are following is streaming right now." else it' \
-o table
else
streamlink -p mpv twitch.tv/$1 ${2:-best}
fi

18
.local/bin/update Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
echo
echo
echo -e $(date)
echo
echo
sudo /home/yorune/.local/bin/eix-repos-sync
sudo eix-sync -a
sudo eix-update
#sudo emerge-webrsync
#sudo emerge --sync
#sudo emaint sync -a
sudo emerge -auDN @world
echo
echo
echo -e $(date)
echo
echo

118
.local/bin/update-kernel Executable file
View File

@ -0,0 +1,118 @@
#!/bin/bash
BACKUP="/home/yorune/Linux/portage"
LOG_FILE="/tmp/update-kernel.log"
TMP_KERNEL="/tmp/kernel-config-`uname -r`"
DEFAULT_KERNEL="/usr/src/linux/.config"
function starting() {
echo -e "\e[93m----------------------COMPILING------------------------------\e[0m"
sudo cp -rv $DEFAULT_KERNEL $TMP_KERNEL
cp -r $TMP_KERNEL $BACKUP/kernel-config
cp -r /etc/portage/* $BACKUP
qlist -I | sort -u > $BACKUP/list-of-programs
}
function selection() {
echo -e "\e[93m----------------------SELECTION-----------------------------\e[0m"
sudo eselect kernel list
echo
echo
read -p "New kernel is: " KERVER
echo
echo -e "Your kernel now is \e[91m$(uname -sr)\e[0m"
echo -e "Your selected kernel is \e[91m"$KERVER"\e[0m"
sudo eselect kernel set $KERVER
sudo eselect kernel list | grep "*"
echo
}
function compilation() {
read -p "Do you want to accept and compile (Y/N): " agreed
echo
if [ "$agreed" == "y" ] || [ "$agreed" == "Y" ]
then
echo -e "\e[91m----------------------\e[5mSTARTING\e[0m\e[91m------------------------------\e[0m" && sleep 10
$NOW > /tmp/compiling-starting
NEW_KERNEL="/tmp/new-kernel-config"
sudo cp -r $TMP_KERNEL $DEFAULT_KERNEL
cd /usr/src/linux; sudo make menuconfig; sleep 2; sudo cp -r $DEFAULT_KERNEL $NEW_KERNEL
sudo genkernel all --makeopts=-j$(nproc --all) --kernel-config=$NEW_KERNEL --callback="emerge nvidia-drivers::gentoo" --lvm --btrfs --luks
elif [ "$agreed" == "N" ] || [ "$agreed" == "n" ]
then
exit
fi
}
function ending() {
echo
echo
echo -e "\e[93m----------------------CHECKING-----------------------------\e[0m"
checking
echo
echo
echo -e "\e[93m----------------------REMEMBER-----------------------------\e[0m"
echo "You can remove:"
echo "* /lib/modules/OLD_KERNEL"
echo "* /boot/initramfs-genkernel-OLD_KERNEL"
echo "* /boot/vmlinuz-OLD_KERNEL"
echo "* /boot/System.map-OLD_KERNEL"
echo "* /boot/initramfs-OLD_KERNEL"
echo "* /usr/src/linux-OLD_KERNEL"
echo
echo -e "AFTER EVERYTHING YOU MUST WRITE COMMAND \e[91m"sudo grub-mkconfig -o /boot/grub/grub.cfg"\e[0m"
}
function checking() {
KERNEL=`eselect kernel list | awk '{print $2}' | egrep -o '[0-9]+.[0-9]+.[0-9]+' | tail -n1`
INITRANFS="initramfs-$KERNEL-gentoo-x86_64.img"
SYSTEMMAP="System.map-$KERNEL-gentoo-x86_64"
VMLINUZ="vmlinuz-$KERNEL-gentoo-x86_64"
ifchecking $INITRANFS
ifchecking $SYSTEMMAP
ifchecking $VMLINUZ
sudo grub-mkconfig -o /boot/grub/grub.cfg
}
function ifchecking () {
FILE=/boot/$1
if test -f "$FILE"; then
echo "$FILE exist in the /boot folder ;)"
else
echo "$FILE NOT exist in the /boot folder ;)"
fi
}
function addgit() {
cd ~/Linux/portage || exit
git add .
git commit -m "Updated: $(date)"
git push
cd ~ || exit
}
function main() {
clear
BEGIN=$(date +"%s")
starting
addgit
selection
compilation
echo -e "\e[31mI am leaving! Thank You!\e[0m" && sleep 3
TERMIN=$(date +"%s")
DIFFTLPS=$(($TERMIN-$BEGIN))
echo -e "\e[93m------------------TIME COMPILATION-------------------------\e[0m"
echo -e "\e[93m$(($DIFFTLPS / 60)) minutes and $(($DIFFTLPS % 60)) seconds \e[0m elapsed for Script Execution." && sleep 3
ending
exit
}
main

3
.local/bin/video-convert Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
FILE=$(echo $1 | cut -d. -f1)
ffmpeg -i $1 -b:a 128k -codec:v libx265 -b:v 1500k -vf scale=1280:720 $FILE-convered.mp4

5
.local/bin/volume Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
pkill -RTMIN+10 dwmblocks
[ "$1" = "up" ] && ponymix increase 5 > /dev/null && notify-send "🔊 Volume $(ponymix get-volume)"
[ "$1" = "down" ] && ponymix decrease 5 > /dev/null && notify-send "🔉 Volume $(ponymix get-volume)"
[ "$1" = "toggle" ] && ponymix toggle> /dev/null && notify-send "🔇 Volume (un)mute "

54
.local/bin/welcomer Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
MEMTOTAL=`awk '$3=="kB"{$2=$2/1024**2;$3="GB";} 1' /proc/meminfo | column -t | grep "MemTotal" | awk '{print $2}'`
MEMFREE=`awk '$3=="kB"{$2=$2/1024**2;$3="GB";} 1' /proc/meminfo | column -t | grep "MemAvailable" | awk '{print $2}'`
NETE=`ip a | awk {'print $2'} | grep -i en | sed 's/://g'`
NETW=`ip a | awk {'print $2'} | grep -i wl | sed 's/://g'`
BACKUP_SDA8=`df -h | grep -i sda8 | awk '{print $5", " $2 " (Total), " $3" (Usage)"}'`
BACKUP_EL=`df -h | grep /run/media/jaqu3/ELEMENTS | awk '{print $5", " $2 " (Total), " $3" (Usage)"}'`
BACKUP_EV=`df -h | grep /run/media/jaqu3/BACKUP_EVERYTHING | awk '{print $5", " $2 " (Total), " $3" (Usage)"}'`
if [ -z "$NETW" ]; then
NETD=$NETE
else
NETD=$NETW
fi
if [ -z "$BACKUP_SDA8" ]; then
BACKUPSDA8=`echo NOT MOUNTED`
else
BACKUPSDA8=$BACKUP_SDA8
fi
if [ -z "$BACKUP_EL" ]; then
BACKUPEL=`echo NOT MOUNTED`
else
BACKUPEL=$BACKUP_EL
fi
if [ -z "$BACKUP_EV" ]; then
BACKUPEV=`echo NOT MOUNTED`
else
BACKUPEV=$BACKUP_EV
fi
echo -e "
\033[0;35m+++++++++++++++++++: \033[0;37mInfo\033[0;35m :+++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ \033[0;37mHostname \033[0;35m= \033[1;32m `hostname`
\033[0;35m+ \033[0;37mAddress \033[0;35m= \033[1;32m `/sbin/ip addr show $NETD | grep "inet " | awk '{print $2}' | cut -d'/' -f1`
\033[0;35m+ \033[0;37mKernel \033[0;35m= \033[1;32m `uname -r`
\033[0;35m+ \033[0;37mUptime \033[0;35m= \033[1;32m`uptime | sed 's/.*up ([^,]*), .*/1/'`
\033[0;35m+ \033[0;37mMemory \033[0;35m= \033[1;32m $MEMTOTAL GB (free $MEMFREE GB)\033[0;35m
\033[0;35m+ \033[0;37mUsername \033[0;35m= \033[1;32m `whoami`\033[0;35m
+
\033[0;35m++++++++++++++++++: \033[0;37mStorage\033[0;35m :+++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ \033[0;37m/ \033[0;35m= \033[1;32m `df -h / | sed '1,1d' | awk '{print $5\", \"$2\" (Total), \"$3\" (Usage)\"}'`\033[0;35m
+ \033[0;37mSDA8 \033[0;35m= \033[1;32m $BACKUPSDA8 \033[0;35m
+ \033[0;37mELEMENTS \033[0;35m= \033[1;32m $BACKUPEL \033[0;35m
+ \033[0;37mBACKUP_EVERYTHING \033[0;35m= \033[1;32m $BACKUPEV \033[0;35m
+
\033[0;35m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \033[0m"
echo ""

33
.local/bin/welcomer-serwer Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
# Copy this file to /bin/welcomer and change permisson +x
# sudo bash -c $'echo "/bin/welcomer" >> /etc/profile.d/mymotd.sh && chmod +x /etc/profile.d/mymotd.sh'
MEMTOTAL=`awk '$3=="kB"{$2=$2/1024**2;$3="GB";} 1' /proc/meminfo | column -t | grep "MemTotal" | awk '{print $2}'`
MEMFREE=`awk '$3=="kB"{$2=$2/1024**2;$3="GB";} 1' /proc/meminfo | column -t | grep "MemAvailable" | awk '{print $2}'`
NETE=`ip a | awk {'print $2'} | grep -i en | sed 's/://g'`
NETW=`ip a | awk {'print $2'} | grep -i wl | sed 's/://g'`
if [ -z "$NETW" ]; then
NETD=$NETE
else
NETD=$NETW
fi
echo -e "
\033[0;35m+++++++++++++++++++: \033[0;37mInfo\033[0;35m :+++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ \033[0;37mHostname \033[0;35m= \033[1;32m `hostname`
\033[0;35m+ \033[0;37mAddress \033[0;35m= \033[1;32m `/sbin/ip addr show $NETD | grep "inet " | awk '{print $2}' | cut -d'/' -f1`
\033[0;35m+ \033[0;37mKernel \033[0;35m= \033[1;32m `uname -r`
\033[0;35m+ \033[0;37mUptime \033[0;35m= \033[1;32m`uptime | sed 's/.*up ([^,]*), .*/1/'`
\033[0;35m+ \033[0;37mMemory \033[0;35m= \033[1;32m $MEMTOTAL GB (free $MEMFREE GB)\033[0;35m
\033[0;35m+ \033[0;37mUsername \033[0;35m= \033[1;32m `whoami`\033[0;35m
+
\033[0;35m++++++++++++++++++: \033[0;37mStorage\033[0;35m :+++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ \033[0;37m/ \033[0;35m= \033[1;32m `df -h / | sed '1,1d' | awk '{print $5\", \"$2\" (Total), \"$3\" (Usage)\"}'`\033[0;35m
+
\033[0;35m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \033[0m"
echo ""

8
.local/bin/wheel Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from wheel.cli import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

4
.local/bin/wsl-notify Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe "New-BurntToastNotification -Text \"$1\""

5
.local/bin/wylaczoff Executable file
View File

@ -0,0 +1,5 @@
xset b off
xset s off && xset -dpms
set bell-style none
#/usr/bin/amixer -c 0 sset "Auto-Mute Mode" Disabled

1
.local/bin/yatqa Executable file
View File

@ -0,0 +1 @@
wine "C:/Program Files (x86)/YaTQA/yatqa.exe"

2
.local/bin/yt-mp3 Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
youtube-dl --extract-audio --audio-format mp3 $1

Some files were not shown because too many files have changed in this diff Show More