Skip to content

Instantly share code, notes, and snippets.

Avatar

Scott King Lvl4Sword

View GitHub Profile
@Lvl4Sword
Lvl4Sword / do_not_disturb.py
Last active Aug 27, 2021
Programmatically enable DND mode on Ubuntu 20.04 LTS between 5PM - 8AM
View do_not_disturb.py
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()
View blackjack.py
import random
import sys
BLACKJACK = 21
ACE_IS_ELEVEN = 10
ACE_IS_ONE = 11
cards = {'🂾': 10, '🂽': 10, '🂻': 10, '🂺': 10, '🂹': 9, '🂸': 8, '🂷': 7,
'🂶': 6, '🂵': 5, '🂴': 4, '🂳': 3, '🂲': 2, '🂱': 'A', '🃎': 10,
'🃍': 10, '🃋': 10, '🃊': 10, '🃉': 9, '🃈': 8, '🃇': 7, '🃆': 6,
@Lvl4Sword
Lvl4Sword / gmail_from_and_returnpath_headers.py
Last active Mar 20, 2020
gmail_from_and_returnpath_headers.py
View 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()
View MousePositionForAScript_WithoutRGB.py
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:
View MousePositionForAScript.py
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 Oct 13, 2018
Detect idle time, because why not
View idle_time.py
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 Oct 4, 2018
Detect Ethernet, Wireless, Battery, and Main Power Supply, within Linux.
View detection.py
#!/usr/bin/env python3
import os
ethernet_interfaces = []
wireless_interfaces = []
def get_interfaces():
interfaces = os.listdir('/sys/class/net')
return interfaces
View detect_ethernet_and_wireless_adapter_in_linux.py
#!/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 Dec 11, 2020
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
View ZodiacPOC.py
import string
def encrypt(the_input):
start = 1
encrypted = []
one_e = str.maketrans(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?!. '",
"74IKSQ'VR5LDBZ6J.N1GW?ETO8P UA023F9!MXHYC")
View VFScraper.py
#!/usr/bin/env python3
import json
import requests
import sys
band = None
user = None
counter = 0
input_stripped = input('Input a band (or hit enter for user): ').strip()