This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' Script checking if a pre-defined process is running ''' | |
import subprocess | |
import shlex | |
import time | |
import datetime | |
import psutil | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $OpenBSD: sshd_config,v 1.102 2018/02/16 02:32:40 djm Exp $ | |
# This is the sshd server system-wide configuration file. See | |
# sshd_config(5) for more information. | |
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin | |
# The strategy used for options in the default sshd_config shipped with | |
# OpenSSH is to specify options with their default value where | |
# possible, but leave them commented. Uncommented options override the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $(ps -o pid= -p 2310) -ne 0 ]]; then | |
echo "True" | |
else | |
echo "False" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -e "$1" ] && [ -e "$2" ]; | |
then | |
if file "$1" | grep -qE 'image|bitmap' && file "$2" | grep -qE 'image|bitmap' ; | |
then | |
ffmpeg -loglevel error -i "$1" -i "$2" -lavfi psnr=psnr.log -f null - | |
cat psnr.log | |
rm psnr.log | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
n='([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])' | |
m='([0-9]|[12][0-9]|3[012])' | |
IFS= read -rp 'Input: ' ipaddr | |
if [[ $ipaddr =~ ^$n(\.$n){3}/$m$ ]]; then | |
printf '"%s" is a valid CIDR\n' "$ipaddr" | |
elif [[ $ipaddr =~ ^$n(\.$n){3}$ ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
target_dir="" | |
bkp_dir="" | |
while [[ ! $bkp_dir =~ [a-zA-Z] && ! -d "$bkp_dir" ]]; | |
do | |
echo "Please enter a valid directory to backup:" | |
read -r bkp_dir | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
stream="" | |
recording_dir=$HOME/recordings | |
while [[ ! $stream =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9] ]]; | |
do | |
echo "Please enter a valid multicast address and port in the format: IP.AD.DR.ESS:PORT after the script name!" | |
read -r stream | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Creating an array containing all network interfaces which are up | |
net_array=() | |
for iface in $(ifconfig | cut -d ' ' -f1| tr ':' '\n' | awk NF) | |
do | |
net_array+=("$iface") | |
done | |
unset "net_array[${#net_array[@]}-1]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
bkp_dir="$HOME/backup" | |
now="$(date +'%Y%m%d')" | |
tar cfJ $HOME/backup/"${now}"_scripts.tar.xz "$HOME"/scripts/ &> /dev/null | |
# Evaluates the md5sum of the most recent backup and compares its md5sum against the other files in the same directory. If the md5sum is the same removes the duplicated file | |
md5sum_now=$(md5sum "$bkp_dir"/"${now}"_scripts.tar.xz | awk '{ print $1 }') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
md5sum * | sort -k1 | uniq -w 32 -d |