Skip to content

Instantly share code, notes, and snippets.

View CodeMaster7000's full-sized avatar
🎯
Working towards my next project!

CodeMaster7000 CodeMaster7000

🎯
Working towards my next project!
View GitHub Profile
@CodeMaster7000
CodeMaster7000 / Sine Wave Graph.py
Last active February 15, 2023 16:42
A Python graph coded with matplotlib to visualise a sine wave.
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-np.pi,np.pi,100)
y = np.sin(x)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.spines['left'].set_position('center')
ax.spines['bottom'].set_position('center')
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
@CodeMaster7000
CodeMaster7000 / Repo-Stars.py
Created February 15, 2023 12:30
A Python program to print the number of stars a Github repo has.
from github import Github
g_cred = Github("<Paste Your Token Here>")
f_repo = input("Enter repository name to see its stars (eg. user/repo): ")
repo = g_cred.get_repo(f_repo)
print(repo.stargazers_count)
@CodeMaster7000
CodeMaster7000 / Language Detector.py
Created January 1, 2023 10:45
A handy language detector coded in Python. It's time for you to put it to the test!
from tkinter import *
from langdetect import *
from iso639 import languages
root = Tk()
root.title("Language Detector")
root.geometry("400x480")
def language_detection():
text = T.get("1.0", 'end-1c')
language_code = languages.get(alpha2=detect(text))
l_d.config(text="Language Detected: "+language_code.name)
@CodeMaster7000
CodeMaster7000 / Currency Converter.py
Created December 24, 2022 18:11
A handy currency converter coded in Python.
from forex_python.converter import CurrencyRates
import time
cr = CurrencyRates()
amount = int(input("Enter the amount you want to convert: "))
time.sleep(1)
from_currency = input("Enter the currency code to be converted: ").upper()
time.sleep(1)
to_currency = input("Enter the currency code to convert to: ").upper()
time.sleep(1)
@CodeMaster7000
CodeMaster7000 / Geeky Joke Generator.py
Created November 26, 2022 20:04
A geeky joke generator to have all of you programmers cracking up!
import pyjokes
import time
print ("10 geeky jokes to have you cracking up: \n")
time.sleep(1.5)
jokes = pyjokes.get_jokes(language='en', category='neutral')
for i in range(10):
print(i+1,':',jokes[i])
time.sleep(2)
@CodeMaster7000
CodeMaster7000 / HM Crown Memorial.py
Created September 18, 2022 14:50
RIP Queen Elizabeth II. Long Live King Charles III!
def crown(length, height):
for i in range(0, height):
for j in range(0, length):
if i == 0:
print(" ", end = "")
elif i == height - 1:
print("-", end = "")
elif ((j < i or j > height - i) and
(j < height + i or
j >= length - i)) :
@CodeMaster7000
CodeMaster7000 / Robot Movement.py
Created June 15, 2022 20:05
A simple program to make your Raspberry Pi robot travel in a square.
from gpiozero import Robot
from time import sleep
robot = Robot(left = (7, 8), right = (9, 10))
while True:
robot.forward()
sleep(2)
robot.stop()
robot.right()
sleep(2)
robot.stop()
@CodeMaster7000
CodeMaster7000 / Comment Remover.js
Created June 12, 2022 13:36
A program to remove comments from all of your JavaScript files. Note that you must have the 'glob' module installed in order for this program to work.
const fs = require("fs")
const strip = require("strip-comments")
const prettier = require("prettier")
var glob = require("glob")
try {
glob("**/*.js", { ignore: "**/node_modules/**" }, function (error, files) {
files.forEach((element) => {
var file = fs.openSync(element, "r+")
var data = fs.readFileSync(file, "utf8")
@CodeMaster7000
CodeMaster7000 / Collatz Sequence.php
Last active April 29, 2022 20:36
A simple program coded in PHP which prints the Collatz sequence for the inputted number.
<?php
function printCollatz($n)
{
while ($n != 1)
{
echo $n . " ";
if ($n & 1)
$n = 3 * $n + 1;
else
$n = $n / 2;
@CodeMaster7000
CodeMaster7000 / ISS Locator.py
Last active April 23, 2022 16:14
A program which locates the International Space Station, maps it and determines your exact latitude and longitude. Run 'ISS Locator.py' in a terminal if you have Python 3 (you must have the json, urllib.request, webbrowser and geocoder modules installed).
import json
import turtle
import urllib.request
import time
import webbrowser
import geocoder
url = "http://api.open-notify.org/astros.json"
response = urllib.request.urlopen(url)
result = json.loads(response.read())