Skip to content

Instantly share code, notes, and snippets.

View JellyWX's full-sized avatar
💙
Idle

Jude Southworth JellyWX

💙
Idle
View GitHub Profile
@JellyWX
JellyWX / quadratic.py
Last active April 28, 2017 16:58
Python3 Quadratic Formula Calculator
#This script is for calculating quadratic equations in the form ax^2 + bx + c = 0. The answer to the equation MUST BE 0. To rearrange it, simply subtract one side from the other. Enjoy!
from math import sqrt
print('Enter values for a, b and c (ax^2 + bx + c = 0) by each in when prompted and pressing enter.')
a = int(input('a='))
b = int(input('b='))
c = int(input('c='))
d = ((-1*b) + sqrt((b**2) - (4*a*c)))/(2*a)
/*A script using jQuery which creates a function which can be used to fill out a div with another html file*/
var root = 'enter the root of your html files here. leave empty for none.'
function fillText(a){
$('#text').load(root + a + '.html');
}
/*2 functions which can be used to create and grab cookie data. This code credits to W3Schools*/
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}
function getCookie(cname) {
@JellyWX
JellyWX / pythagoras.py
Last active October 13, 2016 15:09
Pythagoras Calculator
from math import sqrt
a = 0
b = 0
h = 0
print('You will be asked to enter values for a (short side), b (short side) and h (hypotenuse). Press ENTER for the value you do not know.')
try:
a = float(input('a='))
except:
@JellyWX
JellyWX / counterstrike.txt
Last active November 9, 2016 13:26
Small quiz game that loads a quiz from a file. Example of using string methods to cut and pick parts from strings and lines of files.
qinit
q:What team does NiKo play for?
a:mousesports
q:How much is the AWP Sniper Rifle (raw numbers)?
a:4750
q:What is the terrorist equivalent to the SCAR-20?
a:g3sg1
q:What is the default counter terrorist equivalent to the AK-47?
a:m4a4
q:How many bullets does the 5.7 have total?
@JellyWX
JellyWX / mastermind.py
Created November 23, 2016 13:02
a python mastermind game
from random import randint
from sys import stdout
correct = [randint(1,8), randint(1,8), randint(1,8), randint(1,8)]
usr_guess = [0, 0, 0, 0]
usr_guess_output = []
usr_guess_output_n = []
guesses = 0
@JellyWX
JellyWX / acceleration.py
Last active May 21, 2020 21:20
a python script to calculate acceleration from time or distance when provided with any 1 missing value
from math import sqrt
## V**2 - U**2 = 2*A*X ##
## A = (v-u)/T ##
def main():
dis = str(input('Are you working for distance or time? > '))
@JellyWX
JellyWX / CompleteTheSquare.py
Created April 28, 2017 16:54
A Python 3 script to solve complete the square questions and solve quadratics.
import math
print('Enter your equation, which should be in the format ax^2 + bx + c')
a = int(input('Enter the `a` value'))
b = int(input('Enter the `b` value'))
c = int(input('enter the `c` value'))
b = b/a
c = c/a
## card sort program ##
from random import choice
from math import floor
from time import sleep
class Card(object):
all_types = ['ace','two','three','four','five','six','seven','eight','nine','jack','queen','king']
all_classes = ['clubs','spades','diamonds','hearts']
@JellyWX
JellyWX / Zalgo.py
Created August 23, 2017 13:23
Minimalist example of how to transform a normal string into zalgo text using python
import random
chars = [
## super ##
"\u030d", "\u030e", "\u0304", "\u0305", "\u033f",
"\u0311", "\u0306", "\u0310", "\u0352", "\u0357",
"\u0351", "\u0307", "\u0308", "\u030a", "\u0342",
"\u0343", "\u0344", "\u034a", "\u034b", "\u034c",
"\u0303", "\u0302", "\u030c", "\u0350", "\u0300",