Skip to content

Instantly share code, notes, and snippets.

View MattSegal's full-sized avatar
💭
Recovering engineering student

Matt Segal MattSegal

💭
Recovering engineering student
View GitHub Profile
@MattSegal
MattSegal / hash.py
Last active August 22, 2017 02:34
hashing stuff in python
from hashlib import sha256
def get_sha256_hash(text):
text_bytes = text.encode('utf-8')
text_hash = sha256(text_bytes)
return text_hash.hexdigest()
password_1 = 'hunter2'
password_2 = 'hunter2'
# This works fine
print("hey " + "you!")
# This causes an error because "hey" is a string and 1 is an integer
print("hey " + 1)
foo = "hey " + 1 # This is an error too
print(foo)
# This works fine - the argument is an integer
def say_hello():
print("Hello")
def say_bye():
print("Bye")
def say_sup():
print("Sup?")
from __future__ import print_function # Ignore this
# Example 1 - Function with argument
def say_hello(name):
# Prints 'Hello {name}!' to the screen
print("Hello {}!".format(name))
# We 'invoke' / 'call' a function using the ()s
say_hello('Nick')
"""
Test GUI
"""
from Tkinter import *
import os
import subprocess
def main():
""" starts up GUI """
"""
Python Script Manager
allows user to select a python (.py) script from directory and run it.
the script may be selected from a list and run in a command window or opened using a text editor
user can navigate folders in ROOT_DIRECTORY
TO DO:
add 'troubleshoot' to open python intepreter in a separate cmd window