Adding Scripts
This commit is contained in:
parent
dc101c96ca
commit
dfd00f9832
4 changed files with 280 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
serverssh
|
||||||
224
ssh_and_gpg.py
Normal file
224
ssh_and_gpg.py
Normal file
|
|
@ -0,0 +1,224 @@
|
||||||
|
# Made by Devaine
|
||||||
|
# mostly because bash was pissing me off when it comes to recursion
|
||||||
|
# also because i am lazy and i wanted to automate things
|
||||||
|
|
||||||
|
import time
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
class GPG():
|
||||||
|
def export(id_num):
|
||||||
|
print("\n\nHere's your exported key for ID: " + id_num)
|
||||||
|
os.system("gpg --armor --export " + id_num)
|
||||||
|
|
||||||
|
def view():
|
||||||
|
id_output = os.popen("gpg --list-keys --with-colons | \
|
||||||
|
awk -F: '/^pub:/ { print $5 }'").read()
|
||||||
|
id_split = id_output.split("\n")
|
||||||
|
|
||||||
|
info_output = os.popen("gpg --list-keys --with-colons | \
|
||||||
|
awk -F: '/^uid:/ { print $10 }'").read()
|
||||||
|
info_split = info_output.split("\n")
|
||||||
|
|
||||||
|
print("\n\n----------------------")
|
||||||
|
for i in range(len(info_split) - 1):
|
||||||
|
print("ID #" + str(i) + ": " + id_split[i] +
|
||||||
|
"\nInfo: " + info_split[i])
|
||||||
|
|
||||||
|
print("\n")
|
||||||
|
|
||||||
|
def prompt():
|
||||||
|
question = input("ID # you want to export: ")
|
||||||
|
|
||||||
|
while question == "":
|
||||||
|
question = input("ID # you want to export: ")
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = int(question)
|
||||||
|
except ValueError:
|
||||||
|
print("Not a valid ID number!")
|
||||||
|
time.sleep(1)
|
||||||
|
prompt()
|
||||||
|
|
||||||
|
if response >= len(info_output) - 1 or response < 0:
|
||||||
|
print("Not a valid ID number! test")
|
||||||
|
time.sleep(1)
|
||||||
|
prompt()
|
||||||
|
else:
|
||||||
|
GPG.export(id_split[response])
|
||||||
|
|
||||||
|
prompt()
|
||||||
|
|
||||||
|
def view_prompt():
|
||||||
|
prompt = input("Do you want to see the entire GPG Key? (Y/N): ")
|
||||||
|
while prompt == "":
|
||||||
|
prompt = input("Do you want to see the entire GPG Key? (Y/N): ")
|
||||||
|
|
||||||
|
ans = prompt.upper()
|
||||||
|
|
||||||
|
if "Y" in ans:
|
||||||
|
GPG.view()
|
||||||
|
|
||||||
|
elif "N" in ans:
|
||||||
|
print("Exiting...")
|
||||||
|
exit(0)
|
||||||
|
else:
|
||||||
|
print("Incorrect Reponse!")
|
||||||
|
print("Retrying...")
|
||||||
|
time.sleep(1)
|
||||||
|
GPG.view_prompt()
|
||||||
|
|
||||||
|
def gpg_keygen():
|
||||||
|
os.system("gpg --full-generate-key")
|
||||||
|
|
||||||
|
def __init__():
|
||||||
|
GPG.gpg_keygen()
|
||||||
|
GPG.view_prompt()
|
||||||
|
|
||||||
|
|
||||||
|
class SSH():
|
||||||
|
def keygen():
|
||||||
|
def fileDestination():
|
||||||
|
default_destination = os.path.expanduser("~") + "/.ssh"
|
||||||
|
print("------------")
|
||||||
|
print("Default: " + default_destination)
|
||||||
|
prompt = input("Path for Key (Press Enter for Default): ")
|
||||||
|
|
||||||
|
if prompt == "":
|
||||||
|
prompt = default_destination
|
||||||
|
|
||||||
|
if os.path.exists(prompt) is True:
|
||||||
|
os.system("ssh-keygen -f " + prompt + "/" + name + " -t ed25519")
|
||||||
|
else:
|
||||||
|
print("Path " + prompt + " doesn't exist, try again.")
|
||||||
|
time.sleep(1)
|
||||||
|
fileDestination()
|
||||||
|
|
||||||
|
def nameConfirmation(confirm):
|
||||||
|
while confirm == "":
|
||||||
|
confirm = input("Are you sure this is the name you want? (Y/N): ")
|
||||||
|
ans = confirm.upper()
|
||||||
|
|
||||||
|
if "Y" in ans:
|
||||||
|
fileDestination()
|
||||||
|
|
||||||
|
elif "N" in ans:
|
||||||
|
print("Retrying...")
|
||||||
|
SSH.keygen()
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Incorrect Reponse!")
|
||||||
|
print("Retrying...")
|
||||||
|
time.sleep(1)
|
||||||
|
nameConfirmation()
|
||||||
|
# Function starts here actually.
|
||||||
|
name = input("What is the name of your key: ")
|
||||||
|
|
||||||
|
while name == "":
|
||||||
|
name = input("What is the name of your key: ")
|
||||||
|
|
||||||
|
confirm = input("Are you sure this is the name you want (" + name + ")? (Y/N): ")
|
||||||
|
nameConfirmation(confirm)
|
||||||
|
|
||||||
|
def gpg_prompt():
|
||||||
|
prompt = input("Do you want to create a GPG Key? (Y/N): ")
|
||||||
|
while prompt == "":
|
||||||
|
prompt = input("Do you want to create a GPG Key? (Y/N): ")
|
||||||
|
ans = prompt.upper()
|
||||||
|
if "Y" in ans:
|
||||||
|
print("Starting...")
|
||||||
|
GPG.gpg_keygen()
|
||||||
|
elif "N" in ans:
|
||||||
|
GPG.view_prompt()
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Incorrect Reponse!")
|
||||||
|
time.sleep(1)
|
||||||
|
SSH.gpg_prompt()
|
||||||
|
|
||||||
|
def public_key_view():
|
||||||
|
def choose_file():
|
||||||
|
default_destination = os.path.expanduser("~") + "/.ssh"
|
||||||
|
print("------------")
|
||||||
|
print("Default Path: " + default_destination)
|
||||||
|
path = input("Enter Key Path (Press Enter for Default): ")
|
||||||
|
|
||||||
|
if path == "":
|
||||||
|
path = default_destination
|
||||||
|
|
||||||
|
if os.path.exists(path) is True:
|
||||||
|
avail_options = os.popen("ls " + path + "| grep .pub").read()
|
||||||
|
else:
|
||||||
|
print("Path " + path + " doesn't exist, try again.")
|
||||||
|
time.sleep(1)
|
||||||
|
choose_file()
|
||||||
|
|
||||||
|
options_split = avail_options.split("\n")
|
||||||
|
|
||||||
|
print("There are " + str(len(options_split) - 1)
|
||||||
|
+ " public keys available to read...")
|
||||||
|
|
||||||
|
for i in range(len(options_split) - 1):
|
||||||
|
print("Option #" + str(i) + ": " + options_split[i][:-4])
|
||||||
|
|
||||||
|
def prompt():
|
||||||
|
question = input("Choose an option (by number): ")
|
||||||
|
|
||||||
|
while question == "":
|
||||||
|
question = input("Choose an option (by number): ")
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = int(question)
|
||||||
|
except ValueError:
|
||||||
|
print("Not a valid number!")
|
||||||
|
time.sleep(1)
|
||||||
|
prompt()
|
||||||
|
|
||||||
|
if response >= len(options_split) - 1 or response < 0:
|
||||||
|
print("Not a valid ID number! test")
|
||||||
|
time.sleep(1)
|
||||||
|
prompt()
|
||||||
|
else:
|
||||||
|
print("Here's the public key from Option #" + str(i)
|
||||||
|
+ " (" + options_split[response] + "):")
|
||||||
|
os.system("cat " + path + "/" + options_split[response])
|
||||||
|
|
||||||
|
prompt()
|
||||||
|
|
||||||
|
prompt = input("Do you want to view your SSH public key? (Y/N): ")
|
||||||
|
while prompt == "":
|
||||||
|
prompt = input("Do you want to view your SSH public key? (Y/N): ")
|
||||||
|
ans = prompt.upper()
|
||||||
|
if "Y" in ans:
|
||||||
|
print("Starting...")
|
||||||
|
choose_file()
|
||||||
|
|
||||||
|
elif "N" in ans:
|
||||||
|
SSH.gpg_prompt()
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Incorrect Reponse!")
|
||||||
|
time.sleep(1)
|
||||||
|
SSH.public_key_view()
|
||||||
|
|
||||||
|
def start():
|
||||||
|
ssh_prompt = input("Do you want to create a SSH Key? (Y/N): ")
|
||||||
|
while ssh_prompt == "":
|
||||||
|
ssh_prompt = input("Do you want to create a SSH Key? (Y/N): ")
|
||||||
|
ans = ssh_prompt.upper()
|
||||||
|
|
||||||
|
if "Y" in ans:
|
||||||
|
print("Starting...")
|
||||||
|
SSH.keygen()
|
||||||
|
|
||||||
|
elif "N" in ans:
|
||||||
|
SSH.public_key_view()
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Incorrect Reponse!")
|
||||||
|
time.sleep(1)
|
||||||
|
SSH.start()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
SSH.start()
|
||||||
14
sunset.sh
Executable file
14
sunset.sh
Executable file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Build and Install 'redshift' for wayland: https://github.com/minus7/redshift
|
||||||
|
# You can also use gammastep
|
||||||
|
|
||||||
|
#cd $HOME/.local/bin
|
||||||
|
# killing gammastep if it already exists
|
||||||
|
if [[ $(pgrep gammastep) =~ ^[0-9]+$ ]]
|
||||||
|
then
|
||||||
|
kill $(pgrep gammastep)
|
||||||
|
|
||||||
|
else
|
||||||
|
gammastep -PO 3200
|
||||||
|
fi
|
||||||
|
|
||||||
41
wayshot2.sh
Executable file
41
wayshot2.sh
Executable file
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
## Variables
|
||||||
|
declare -r time=$(date --iso-8601=seconds)
|
||||||
|
|
||||||
|
|
||||||
|
while(( $# > 0)); do
|
||||||
|
case $1 in
|
||||||
|
-s)
|
||||||
|
REGION=yes
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-c)
|
||||||
|
CURSOR=yes
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -z "$FILENAME" ]; then
|
||||||
|
FILENAME="$1/$time.png"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
echo "wrong format"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
OPTS=()
|
||||||
|
if [ -n "$REGION" ]; then
|
||||||
|
OPTS+=("-g $(slurp)")
|
||||||
|
|
||||||
|
if [ -n "$CURSOR" ]; then
|
||||||
|
OPTS+=("-c")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
grim "${OPTS[@]}" "$FILENAME"
|
||||||
|
# https://github.com/bugaevc/wl-clipboard/issues/198 lifesaver
|
||||||
|
wl-copy --type image/png < $FILENAME
|
||||||
Loading…
Add table
Add a link
Reference in a new issue