Skip to content

Instantly share code, notes, and snippets.

View se7enack's full-sized avatar
🏠
Working from home

Stephen Burke se7enack

🏠
Working from home
View GitHub Profile
@se7enack
se7enack / captcha.py
Last active January 2, 2024 23:35
Python GUI Captcha Challenge
#!/usr/bin/env python3
import os
import random
import string
from captcha.image import ImageCaptcha
from captcha.audio import AudioCaptcha
from playsound import playsound
from easygui import *
@se7enack
se7enack / film-art.py
Last active January 3, 2024 15:30
Displays artwork for a given motion picture
#!/usr/bin/env python3
import json
import sys
import urllib.request as ur
from PIL import Image
movie = sys.argv[1].replace(" ","%20")
filename = sys.argv[1].replace(" ","_") + ".jpg"
@se7enack
se7enack / convert-json-and-yaml.py
Created January 2, 2024 23:14
Converts JSON files to YAML and YAML files to JSON
#!/usr/bin/env python3
import yaml
import json
import sys
import os
"""
### Converts JSON to YAML as well as YAML to JSON ###
Usage:
@se7enack
se7enack / pi-day-calc.py
Created January 2, 2024 23:33
Mathematically calculates Pi Day's day-of-the-week for a given year
#!/usr/bin/env python3
def day(x):
days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
return days[x]
def century(y):
startdays = [0, 5, 3, 2]
centurycounter = 0
@se7enack
se7enack / tts.py
Last active January 6, 2024 19:53
An example of pyttsx3 Text to Speech
#!/Users/user/miniconda3/bin/python3
import pyttsx3
engine = pyttsx3.init()
engine.setProperty('rate', 150)
engine.setProperty('volume', 1.0)
people = {
@se7enack
se7enack / http_share.sh
Last active January 17, 2024 15:10
quick and easy file server
open http://`ifconfig en0 | grep "inet " | awk '{print $2}'` & python3 -m http.server 80
@se7enack
se7enack / bulk_file_rename.py
Last active January 17, 2024 15:20
Torrent Episode Renaming Tool
#!/usr/bin/env python3
import os
string2remove = ".720p.IBCTV.WEBRip.x264-GalaxyGlue"
edir = "/Users/user/Desktop/SomeGoodShowS01"
#edir = os.getcwd()
# Will reaname all files in the 'edir' by removing the above 'string2remove'.
# Example:
@se7enack
se7enack / rm-lines-b4-string.py
Created January 31, 2024 20:02
Delete all lines before a line that starts with a string
found = 0
mystring = "Code"
with open("inputfile.txt", "r") as input:
with open("outputfile.txt", "w") as output:
for line in input:
if line.startswith(mystring):
found = 1
if found == 0:
pass
else:
@se7enack
se7enack / csv-with-header_2_json.py
Created February 2, 2024 21:09
Converts a comma delimited csv file containing a header row into a json file
#!/usr/bin/env python3
import json
import csv
csv_file_path = "/Users/user/Downloads/file.csv"
json_file_path = "/Users/user/Downloads/file.json"
def step1(csv_file_path, json_file_path):
@se7enack
se7enack / mysql-connector.py
Last active February 12, 2024 02:13
python mysql connector
#!/usr/local/bin/env python3
import mysql.connector
# pip3 install mysql-connector-python
user_input = input("Enter something: ")
db = mysql.connector.connect(
host="localhost",
port="3306",