Removed some old/unneeded shell scripts and formatted the rest
This commit is contained in:
parent
86ba9538de
commit
7e48c8f75a
|
@ -31,14 +31,14 @@ if [ "$num_staged_lua" -gt 0 ]; then
|
|||
fi
|
||||
|
||||
# Run shfmt on staged shell scripts
|
||||
staged_sh=$(echo "$staged_files" | grep -E '(.sh$|pre-commit)' || true)
|
||||
num_staged_sh=$(echo "$staged_sh" | grep -vce '^$' || true)
|
||||
if [ "$num_staged_sh" -gt 0 ]; then
|
||||
printf '\nFormatting %s staged shell scripts with shfmt\n' "$num_staged_sh"
|
||||
shfmt -w "$staged_sh"
|
||||
printf "Re-staging\n\n"
|
||||
git add "$staged_sh"
|
||||
fi
|
||||
#staged_sh=$(echo "$staged_files" | grep -E '(.sh$|pre-commit)' || true)
|
||||
#num_staged_sh=$(echo "$staged_sh" | grep -vce '^$' || true)
|
||||
#if [ "$num_staged_sh" -gt 0 ]; then
|
||||
# printf '\nFormatting %s staged shell scripts with shfmt\n' "$num_staged_sh"
|
||||
# shfmt -w "$staged_sh"
|
||||
# printf "Re-staging\n\n"
|
||||
# git add "$staged_sh"
|
||||
#fi
|
||||
|
||||
# Run prettier on all other staged files
|
||||
# that are supported
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
# remove old entries
|
||||
for bootentry in $(efibootmgr | head -n 3 | tail -n 1 | cut -d' ' -f2- | sed 's/,/\n/g'); do
|
||||
sudo efibootmgr -qBb $bootentry
|
||||
sudo efibootmgr -qBb $bootentry
|
||||
done
|
||||
|
||||
# add all entries back
|
||||
for bootscript in *.efi; do
|
||||
./$bootscript
|
||||
./$bootscript
|
||||
done
|
||||
|
||||
# set bootorder
|
||||
|
|
|
@ -5,22 +5,22 @@ alert="Signature detected: $CLAM_VIRUSEVENT_VIRUSNAME in $CLAM_VIRUSEVENT_FILENA
|
|||
|
||||
# Send the alert to systemd logger if exist, othewise to /var/log
|
||||
if [[ -z $(command -v systemd-cat) ]]; then
|
||||
echo "$(date) - $alert" >> /var/log/clamav/infected.log
|
||||
echo "$(date) - $alert" >>/var/log/clamav/infected.log
|
||||
else
|
||||
# as "emerg", this could cause your DE to show a visual alert. Happen in Plasma. but the next visual alert is much nicer
|
||||
echo "$alert" | /usr/bin/systemd-cat -t clamav -p emerg
|
||||
# as "emerg", this could cause your DE to show a visual alert. Happen in Plasma. but the next visual alert is much nicer
|
||||
echo "$alert" | /usr/bin/systemd-cat -t clamav -p emerg
|
||||
fi
|
||||
|
||||
#send an alrt to all graphical user
|
||||
XUSERS=($(who|awk '{print $1}'|sort -u))
|
||||
XUSERS=($(who | awk '{print $1}' | sort -u))
|
||||
|
||||
for XUSER in $XUSERS; do
|
||||
NAME=(${XUSER/(/ })
|
||||
DISPLAY=${NAME[1]/)/}
|
||||
DBUS_ADDRESS=unix:path=/run/user/$(id -u ${NAME[0]})/bus
|
||||
echo "run $NAME - $DISPLAY - $DBUS_ADDRESS -" >> /tmp/testlog
|
||||
/usr/bin/sudo -u ${NAME[0]} DISPLAY=${DISPLAY} \
|
||||
DBUS_SESSION_BUS_ADDRESS=${DBUS_ADDRESS} \
|
||||
PATH=${PATH} \
|
||||
/usr/bin/notify-send -i dialog-warning "clamAV" "$alert"
|
||||
NAME=(${XUSER/(/ })
|
||||
DISPLAY=${NAME[1]/)/}
|
||||
DBUS_ADDRESS=unix:path=/run/user/$(id -u ${NAME[0]})/bus
|
||||
echo "run $NAME - $DISPLAY - $DBUS_ADDRESS -" >>/tmp/testlog
|
||||
/usr/bin/sudo -u ${NAME[0]} DISPLAY=${DISPLAY} \
|
||||
DBUS_SESSION_BUS_ADDRESS=${DBUS_ADDRESS} \
|
||||
PATH=${PATH} \
|
||||
/usr/bin/notify-send -i dialog-warning "clamAV" "$alert"
|
||||
done
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
#!/bin/bash
|
||||
function rotate_ms {
|
||||
case $1 in
|
||||
"normal")
|
||||
swaymsg output eDP-1 transform 0
|
||||
;;
|
||||
"right-up")
|
||||
swaymsg output eDP-1 transform 90
|
||||
;;
|
||||
"bottom-up")
|
||||
swaymsg output eDP-1 transform 180
|
||||
;;
|
||||
"left-up")
|
||||
swaymsg output eDP-1 transform 270
|
||||
;;
|
||||
esac
|
||||
case $1 in
|
||||
"normal")
|
||||
swaymsg output eDP-1 transform 0
|
||||
;;
|
||||
"right-up")
|
||||
swaymsg output eDP-1 transform 90
|
||||
;;
|
||||
"bottom-up")
|
||||
swaymsg output eDP-1 transform 180
|
||||
;;
|
||||
"left-up")
|
||||
swaymsg output eDP-1 transform 270
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
while IFS='$\n' read -r line; do
|
||||
rotation="$(echo $line | sed -En "s/^.*orientation changed: (.*)/\1/p")"
|
||||
[[ ! -z $rotation ]] && rotate_ms $rotation
|
||||
rotation="$(echo $line | sed -En "s/^.*orientation changed: (.*)/\1/p")"
|
||||
[[ ! -z $rotation ]] && rotate_ms $rotation
|
||||
done < <(stdbuf -oL monitor-sensor)
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
source ~/.cache/wal/colors.sh
|
||||
echo "[colors]
|
||||
foreground = $foreground
|
||||
background = $background
|
||||
color0 = $color0
|
||||
color1 = $color1
|
||||
color2 = $color2
|
||||
color3 = $color3
|
||||
color4 = $color4
|
||||
color5 = $color5
|
||||
color6 = $color6
|
||||
color7 = $color7
|
||||
color8 = $color8
|
||||
color9 = $color9
|
||||
color10 = $color10
|
||||
color11 = $color11
|
||||
color12 = $color12
|
||||
color13 = $color13
|
||||
color14 = $color14
|
||||
color15 = $color15
|
||||
|
||||
[options]
|
||||
font = Noto Color Emoji 12
|
||||
font = Material Design Icons 12
|
||||
font = Hack Nerd Font 12" > ~/.config/termite/config
|
|
@ -1,40 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Generates zathura configuration file with pywal colors
|
||||
|
||||
. $HOME/.cache/wal/colors.sh
|
||||
|
||||
cat <<CONF > ~/.config/zathura/zathurarc
|
||||
set completion-bg "$background"
|
||||
set recolor-darkcolor "$foreground"
|
||||
set recolor-lightcolor "$background"
|
||||
set completion-fg "$foreground"
|
||||
set completion-group-bg "$background"
|
||||
set completion-group-fg "$color2"
|
||||
set completion-highlight-bg "$foreground"
|
||||
set completion-highlight-fg "$background"
|
||||
set default-bg "$background"
|
||||
set default-fg "$foreground"
|
||||
set inputbar-bg "$background"
|
||||
set inputbar-fg "$foreground"
|
||||
set notification-bg "$background"
|
||||
set notification-fg "$foreground"
|
||||
set notification-error-bg "$color1"
|
||||
set notification-error-fg "$foreground"
|
||||
set notification-warning-bg "$color1"
|
||||
set notification-warning-fg "$foreground"
|
||||
set statusbar-bg "$background"
|
||||
set statusbar-fg "$foreground"
|
||||
set index-bg "$background"
|
||||
set index-fg "$foreground"
|
||||
set index-active-bg "$foreground"
|
||||
set index-active-fg "$background"
|
||||
set render-loading-bg "$background"
|
||||
set render-loading-fg "$foreground"
|
||||
|
||||
set smooth-scroll true
|
||||
set window-title-home-tilde true
|
||||
set statusbar-basename true
|
||||
set selection-clipboard clipboard
|
||||
set recolor false
|
||||
CONF
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/sh
|
||||
acpi -b | awk -F'[,:%]' '{print $2, $3}' | {
|
||||
read -r status capacity
|
||||
read -r status capacity
|
||||
|
||||
if [ "$status" = Discharging -a "$capacity" -lt 5 ]; then
|
||||
logger "Critical battery threshold"
|
||||
systemctl hibernate
|
||||
fi
|
||||
if [ "$status" = Discharging -a "$capacity" -lt 5 ]; then
|
||||
logger "Critical battery threshold"
|
||||
systemctl hibernate
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
IPMIHOST=10.0.0.82
|
||||
IPMIUSER=ReekyMarko
|
||||
IPMIPW={{@@ env['PASS_IPMI'] @@}}
|
||||
IPMIEK=0000000000000000000000000000000000000000
|
||||
|
||||
printf "Activating dynamic fan control."
|
||||
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x01 0x01
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
IPMIHOST=10.0.0.82
|
||||
IPMIUSER=ReekyMarko
|
||||
IPMIPW={{@@ env['PASS_IPMI'] @@}}
|
||||
IPMIEK=0000000000000000000000000000000000000000
|
||||
|
||||
DATA=`ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK sdr get "FAN 1 RPM" "FAN 2 RPM" "FAN 3 RPM" "FAN 4 RPM" "FAN 5 RPM" "FAN 6 RPM" | grep "Sensor Reading" | awk '{ print $4 }'`
|
||||
|
||||
echo "$DATA"
|
||||
|
||||
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan1" -m "$(echo "$DATA" | head -1 | tail -1)"
|
||||
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan2" -m "$(echo "$DATA" | head -2 | tail -1)"
|
||||
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan3" -m "$(echo "$DATA" | head -3 | tail -1)"
|
||||
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan4" -m "$(echo "$DATA" | head -4 | tail -1)"
|
||||
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan5" -m "$(echo "$DATA" | head -5 | tail -1)"
|
||||
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/fan6" -m "$(echo "$DATA" | head -6 | tail -1)"
|
|
@ -1,10 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
IPMIHOST=10.0.0.82
|
||||
IPMIUSER=ReekyMarko
|
||||
IPMIPW={{@@ env['PASS_IPMI'] @@}}
|
||||
IPMIEK=0000000000000000000000000000000000000000
|
||||
|
||||
printf "speeeed!"
|
||||
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x01 0x00
|
||||
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x64
|
|
@ -1,10 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
IPMIHOST=10.0.0.82
|
||||
IPMIUSER=ReekyMarko
|
||||
IPMIPW={{@@ env['PASS_IPMI'] @@}}
|
||||
IPMIEK=0000000000000000000000000000000000000000
|
||||
|
||||
printf "Activating manual fan speeds! (2160 RPM)"
|
||||
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x01 0x00
|
||||
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x10
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
IPMIHOST=10.0.0.82
|
||||
IPMIUSER=ReekyMarko
|
||||
IPMIPW={{@@ env['PASS_IPMI'] @@}}
|
||||
IPMIEK=0000000000000000000000000000000000000000
|
||||
MAXTEMP=27
|
||||
TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK sdr type temperature |grep Ambient |grep degrees |grep -Po '\d{2}' | tail -1)
|
||||
|
||||
mosquitto_pub -u reekynet -P {{@@ env['PASS_MQTT'] @@}} -t "ipmi/temp" -m "$TEMP"
|
||||
|
||||
|
||||
if [[ $TEMP > $MAXTEMP ]];
|
||||
then
|
||||
printf "Warning: Temperature is too high! Activating dynamic fan control! ($TEMP C)"
|
||||
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x01 0x01
|
||||
else
|
||||
printf "Temperature is OK ($TEMP C)"
|
||||
fi
|
|
@ -5,20 +5,19 @@ COUNT=$(ls $NEWMAILDIR | wc -l)
|
|||
ICON=/usr/share/icons/Papirus-Dark/64x64/apps/email.svg
|
||||
SOUND=/usr/share/sounds/Oxygen-Im-Message-In.ogg
|
||||
|
||||
|
||||
if [ $COUNT -ne 0 ]; then
|
||||
mpv $SOUND &
|
||||
mpv $SOUND &
|
||||
fi
|
||||
|
||||
if [ $COUNT -gt 1 ]; then
|
||||
fromaddress=$(cat $NEWMAILDIR/$(ls $NEWMAILDIR | sort -R | tail -1) | formail -x From | tail -1)
|
||||
notify-send.sh -i $ICON "$COUNT new messages in $1" "From $fromaddress and others"
|
||||
fromaddress=$(cat $NEWMAILDIR/$(ls $NEWMAILDIR | sort -R | tail -1) | formail -x From | tail -1)
|
||||
notify-send.sh -i $ICON "$COUNT new messages in $1" "From $fromaddress and others"
|
||||
|
||||
elif [ $COUNT -eq 1 ]; then
|
||||
mailsubject=$(cat $NEWMAILDIR/* | formail -x Subject)
|
||||
fromaddress=$(cat $NEWMAILDIR/* | formail -x From | tail -1)
|
||||
mailsubject=$(cat $NEWMAILDIR/* | formail -x Subject)
|
||||
fromaddress=$(cat $NEWMAILDIR/* | formail -x From | tail -1)
|
||||
|
||||
notify-send.sh -i $ICON "New message in $1" "$fromaddress $mailsubject"
|
||||
notify-send.sh -i $ICON "New message in $1" "$fromaddress $mailsubject"
|
||||
else
|
||||
echo "No new mail"
|
||||
echo "No new mail"
|
||||
fi
|
||||
|
|
|
@ -1,186 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import struct
|
||||
import subprocess
|
||||
|
||||
VERSION = '7.2.2'
|
||||
|
||||
try:
|
||||
sys.stdin.buffer
|
||||
|
||||
# Python 3.x version
|
||||
# Read a message from stdin and decode it.
|
||||
def getMessage():
|
||||
rawLength = sys.stdin.buffer.read(4)
|
||||
if len(rawLength) == 0:
|
||||
sys.exit(0)
|
||||
messageLength = struct.unpack('@I', rawLength)[0]
|
||||
message = sys.stdin.buffer.read(messageLength).decode('utf-8')
|
||||
return json.loads(message)
|
||||
|
||||
# Send an encoded message to stdout
|
||||
def sendMessage(messageContent):
|
||||
encodedContent = json.dumps(messageContent).encode('utf-8')
|
||||
encodedLength = struct.pack('@I', len(encodedContent))
|
||||
|
||||
sys.stdout.buffer.write(encodedLength)
|
||||
sys.stdout.buffer.write(encodedContent)
|
||||
sys.stdout.buffer.flush()
|
||||
|
||||
except AttributeError:
|
||||
# Python 2.x version (if sys.stdin.buffer is not defined)
|
||||
# Read a message from stdin and decode it.
|
||||
def getMessage():
|
||||
rawLength = sys.stdin.read(4)
|
||||
if len(rawLength) == 0:
|
||||
sys.exit(0)
|
||||
messageLength = struct.unpack('@I', rawLength)[0]
|
||||
message = sys.stdin.read(messageLength)
|
||||
return json.loads(message)
|
||||
|
||||
# Send an encoded message to stdout
|
||||
def sendMessage(messageContent):
|
||||
encodedContent = json.dumps(messageContent)
|
||||
encodedLength = struct.pack('@I', len(encodedContent))
|
||||
|
||||
sys.stdout.write(encodedLength)
|
||||
sys.stdout.write(encodedContent)
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
def install():
|
||||
home_path = os.getenv('HOME')
|
||||
|
||||
manifest = {
|
||||
'name': 'open_with',
|
||||
'description': 'Open With native host',
|
||||
'path': os.path.realpath(__file__),
|
||||
'type': 'stdio',
|
||||
}
|
||||
locations = {
|
||||
'chrome': os.path.join(home_path, '.config', 'google-chrome', 'NativeMessagingHosts'),
|
||||
'chrome-beta': os.path.join(home_path, '.config', 'google-chrome-beta', 'NativeMessagingHosts'),
|
||||
'chrome-unstable': os.path.join(home_path, '.config', 'google-chrome-unstable', 'NativeMessagingHosts'),
|
||||
'chromium': os.path.join(home_path, '.config', 'chromium', 'NativeMessagingHosts'),
|
||||
'firefox': os.path.join(home_path, '.mozilla', 'native-messaging-hosts'),
|
||||
}
|
||||
filename = 'open_with.json'
|
||||
|
||||
for browser, location in locations.items():
|
||||
if os.path.exists(os.path.dirname(location)):
|
||||
if not os.path.exists(location):
|
||||
os.mkdir(location)
|
||||
|
||||
browser_manifest = manifest.copy()
|
||||
if browser == 'firefox':
|
||||
browser_manifest['allowed_extensions'] = ['openwith@darktrojan.net']
|
||||
else:
|
||||
browser_manifest['allowed_origins'] = [
|
||||
'chrome-extension://cogjlncmljjnjpbgppagklanlcbchlno/', # Chrome
|
||||
'chrome-extension://fbmcaggceafhobjkhnaakhgfmdaadhhg/', # Opera
|
||||
]
|
||||
|
||||
with open(os.path.join(location, filename), 'w') as file:
|
||||
file.write(
|
||||
json.dumps(browser_manifest, indent=2, separators=(',', ': '), sort_keys=True).replace(' ', '\t') + '\n'
|
||||
)
|
||||
|
||||
|
||||
def _read_desktop_file(path):
|
||||
with open(path, 'r') as desktop_file:
|
||||
current_section = None
|
||||
name = None
|
||||
command = None
|
||||
for line in desktop_file:
|
||||
if line[0] == '[':
|
||||
current_section = line[1:-2]
|
||||
if current_section != 'Desktop Entry':
|
||||
continue
|
||||
|
||||
if line.startswith('Name='):
|
||||
name = line[5:].strip()
|
||||
elif line.startswith('Exec='):
|
||||
command = line[5:].strip()
|
||||
|
||||
return {
|
||||
'name': name,
|
||||
'command': command
|
||||
}
|
||||
|
||||
|
||||
def find_browsers():
|
||||
apps = [
|
||||
'Chrome',
|
||||
'Chromium',
|
||||
'chromium-browser',
|
||||
'firefox',
|
||||
'Firefox',
|
||||
'Google Chrome',
|
||||
'google-chrome',
|
||||
'opera',
|
||||
'Opera',
|
||||
'SeaMonkey',
|
||||
'seamonkey',
|
||||
]
|
||||
paths = [
|
||||
os.path.join(os.getenv('HOME'), '.local/share/applications'),
|
||||
'/usr/local/share/applications',
|
||||
'/usr/share/applications'
|
||||
]
|
||||
suffix = '.desktop'
|
||||
|
||||
results = []
|
||||
for p in paths:
|
||||
for a in apps:
|
||||
fp = os.path.join(p, a) + suffix
|
||||
if os.path.exists(fp):
|
||||
results.append(_read_desktop_file(fp))
|
||||
return results
|
||||
|
||||
|
||||
def listen():
|
||||
receivedMessage = getMessage()
|
||||
if receivedMessage == 'ping':
|
||||
sendMessage({
|
||||
'version': VERSION,
|
||||
'file': os.path.realpath(__file__)
|
||||
})
|
||||
elif receivedMessage == 'find':
|
||||
sendMessage(find_browsers())
|
||||
else:
|
||||
for k, v in os.environ.items():
|
||||
if k.startswith('MOZ_'):
|
||||
try:
|
||||
os.unsetenv(k)
|
||||
except:
|
||||
os.environ[k] = ''
|
||||
|
||||
devnull = open(os.devnull, 'w')
|
||||
subprocess.Popen(receivedMessage, stdout=devnull, stderr=devnull)
|
||||
sendMessage(None)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) == 2:
|
||||
if sys.argv[1] == 'install':
|
||||
install()
|
||||
sys.exit(0)
|
||||
elif sys.argv[1] == 'find_browsers':
|
||||
print(find_browsers())
|
||||
sys.exit(0)
|
||||
|
||||
allowed_extensions = [
|
||||
'openwith@darktrojan.net',
|
||||
'chrome-extension://cogjlncmljjnjpbgppagklanlcbchlno/',
|
||||
'chrome-extension://fbmcaggceafhobjkhnaakhgfmdaadhhg/',
|
||||
]
|
||||
for ae in allowed_extensions:
|
||||
if ae in sys.argv:
|
||||
listen()
|
||||
sys.exit(0)
|
||||
|
||||
print('Open With native helper, version %s.' % VERSION)
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
source $DOTREPO/secrets/env
|
||||
|
||||
cat <<SECRET > $DOTREPO/secrets/secrets
|
||||
cat <<SECRET >$DOTREPO/secrets/secrets
|
||||
export PASS_LIBREFM="$PASS_LIBREFM"
|
||||
export PASS_MUSICBRAINZ="$PASS_MUSICBRAINZ"
|
||||
export PASS_LISTENBRAINZ="$PASS_LISTENBRAINZ"
|
||||
|
|
Loading…
Reference in a new issue