Skip to content

Instantly share code, notes, and snippets.

@CodeMaster7000
CodeMaster7000 / File Generator.cpp
Created April 1, 2022 21:49
A simple file generator coded in C++.
#include <iostream>
#include <fstream>
using namespace std;
int main () {
string fileName;
string fileType;
string fileText;
cout << "Please enter the information in the file >";
@CodeMaster7000
CodeMaster7000 / Standard Deviation Calculator.c
Created April 23, 2022 15:54
A program which calculates the standard deviation of an individual series using an array of 10 numbers.
#include <math.h>
#include <stdio.h>
float calculateSD(float data[]);
int main() {
int i;
float data[10];
printf("Enter 10 elements:");
printf("\n");
for (i = 0; i < 10; ++i)
scanf("%f", &data[i]);
@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())
@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 / 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 / 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 / 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 / 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 / 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 / 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)