Skip to content

Instantly share code, notes, and snippets.

View Lvl4Sword's full-sized avatar
💚
Whatever you do, do it well.

Scott King Lvl4Sword

💚
Whatever you do, do it well.
View GitHub Profile
@Lvl4Sword
Lvl4Sword / discord_dbus.py
Last active December 10, 2023 22:32
Pay attention to Discord notifications on Linux
import datetime
import smtplib
import ssl
from email.headerregistry import Address
from email.message import EmailMessage
import dbus
import pytz
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib
from jinja2 import Template
@Lvl4Sword
Lvl4Sword / do_not_disturb.py
Last active August 27, 2021 07:29
Programmatically enable DND mode on Ubuntu 20.04 LTS between 5PM - 8AM
import subprocess
import time
dnd_time = {'start': {'hour': 17, 'minute': 00}, 'end': {'hour': 8, 'minute': 00}}
sleep_time = 30
def get_dnd_status():
enabled = None
status = subprocess.check_output(['gsettings', 'get', 'org.gnome.desktop.notifications', 'show-banners']).strip().decode()
import random
import sys
BLACKJACK = 21
ACE_IS_ELEVEN = 10
ACE_IS_ONE = 11
EXITS = ['e', 'x', 'q', 'exit', 'quit', 'escape', 'leave']
cards = {'🂾': 10, '🂽': 10, '🂻': 10, '🂺': 10, '🂹': 9, '🂸': 8, '🂷': 7,
'🂶': 6, '🂵': 5, '🂴': 4, '🂳': 3, '🂲': 2, '🂱': 'A', '🃎': 10,
@Lvl4Sword
Lvl4Sword / gmail_from_and_returnpath_headers.py
Last active March 20, 2020 17:28
gmail_from_and_returnpath_headers.py
import email
import collections
import imaplib
mail = imaplib.IMAP4_SSL('imap.gmail.com')
mail.login('EMAIL_ADDRESS@gmail.com', 'PASSWORD')
mail.list()
mail.select('inbox')
from_dict = collections.Counter()
import collections
import pyautogui
import pyscreeze
import sys
def MousePosition():
"""This function is meant to be run from the command line. It will
automatically display the location and RGB of the mouse cursor."""
print('Press Ctrl-C to quit.')
try:
import collections
import pyautogui
import pyscreeze
import sys
def MousePosition():
"""This function is meant to be run from the command line. It will
automatically display the location and RGB of the mouse cursor."""
print('Press Ctrl-C to quit.')
try:
@Lvl4Sword
Lvl4Sword / idle_time.py
Created October 13, 2018 00:12
Detect idle time, because why not
import subprocess
import time
while True:
time.sleep(1)
a = subprocess.check_output('xprintidle')
a = round(int(a.decode().strip()), -3)
print('Seconds idle: {0}'.format(int(a / 1000)))
@Lvl4Sword
Lvl4Sword / detection.py
Last active October 4, 2018 23:12
Detect Ethernet, Wireless, Battery, and Main Power Supply, within Linux.
#!/usr/bin/env python3
import os
ethernet_interfaces = []
wireless_interfaces = []
def get_interfaces():
interfaces = os.listdir('/sys/class/net')
return interfaces
#!/usr/bin/env python3
# While systemd has the prefixes set in the following way:
# en = ethernet
# wl = wlan
# ww = wwan
# There are still instances where an interface won't have these.
# Which, is why I made this script.
import os
ethernet_interfaces = []
@Lvl4Sword
Lvl4Sword / ZodiacPOC.py
Last active December 11, 2020 22:37
Basic concept as to how I believe the 340 Zodiac Cipher would have been done. It could also just be random characters. It's been solved! - https://www.youtube.com/watch?v=-1oQLPRE21o
import string
def encrypt(the_input):
start = 1
encrypted = []
one_e = str.maketrans(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?!. '",
"74IKSQ'VR5LDBZ6J.N1GW?ETO8P UA023F9!MXHYC")