Skip to content

Instantly share code, notes, and snippets.

Avatar
🏫
In High School

Edwin Pratt EdThePro101

🏫
In High School
  • Gauteng, South Africa
  • 08:06 (UTC +02:00)
  • Twitter @edthepro101
View GitHub Profile
@EdThePro101
EdThePro101 / how-to-setup-tlauncher.md
Created Jan 20, 2022
This is a guide to setting up TLauncher!
View how-to-setup-tlauncher.md

How to: Set up TLauncher

If you try installing TLauncher with JDK 17, you may end up with an error saying you need to install Java 8. The solution to this problem is a bit tedious, as you need two Java versions. So I hope this guide will clear everything up 😄

This was tested on Windows 10 and Adoptium's OpenJDK.

First and foremost, uninstall any Java versions on your system including TLauncher.

Afterwards, head over to Adoptium's OpenJDK 8 Archive and download the JRE Installer for your system. While the JRE is installing, make sure that all the features except Set JAVA_HOME variable is selected.

@EdThePro101
EdThePro101 / Matrix.hs
Last active Feb 4, 2021
This Gist contains some useful matrix operations such as addition, subtraction, exponentiation, etc.
View Matrix.hs
module Matrix where
import Data.List (transpose)
newtype Matrix = Matrix [[Integer]] deriving (Show, Eq)
mFromList :: [[Integer]] -> Matrix
mFromList lst = Matrix lst
mToList :: Matrix -> [[Integer]]
@EdThePro101
EdThePro101 / styles.js
Created Jan 21, 2021
This is a small modification of the `styles.js` file of colors.js.
View styles.js
// Original: https://github.com/Marak/colors.js/blob/master/lib/styles.js
//
// This is a slight modification of the `styles.js` file of colors.js.
// I've made it a bit more readable and added comments to explain what it does.
// I've also added a helper function that can be used to make your codes a bit more readable.
//
// Example usage:
//
// ```js
// const styles = require("/path/to/styles.js");
@EdThePro101
EdThePro101 / file-io.c
Created Jan 12, 2021
File IO operations in C.
View file-io.c
// file-io.h
//
// #ifndef FILE_IO_H
// #define FILE_IO_H
//
// // Read and write files.
// // filename - The file's name.
// // buffer - Buffer that will contain file characters.
// // buffer_length - The length of the buffer.
// //
@EdThePro101
EdThePro101 / tokenise-string.c
Created Jan 6, 2021
Tokenise a string in C by whitespaces.
View tokenise-string.c
#include <stdio.h>
#include <string.h>
// Check if a character is a digit
char is_digit(char curr) {
return (curr >= '0' && curr <= '9');
}
// Check if a character is a letter
char is_letter(char curr) {
@EdThePro101
EdThePro101 / remapper.js
Created Jan 6, 2021
Remap a number from one range to another range. For example, remap celsius to fahrenheit or remap kilometres to miles.
View remapper.js
// To remap a value x in range [a, b] to [c, d], we can use:
//
// y = (x - a) * ((d - c) / (b - a)) + c
//
function remapper(x, a, b, c, d) {
let y = (x - a) * ((d - c) / (b - a)) + c;
return y;
}
@EdThePro101
EdThePro101 / melody-gen.c
Created Jan 3, 2021
This is a very simple melody generator made in C.
View melody-gen.c
// Copyright (c) 2021 Edwin Pratt
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
// Compile with
// gcc -Wall -Werror -Wextra -o melody-gen melody-gen.c
@EdThePro101
EdThePro101 / simple-makefile-v1.0.mk
Last active Dec 9, 2020
This Makefile is used in most of my projects. It's simple, easy to modify and is legible.
View simple-makefile-v1.0.mk
# Copyright (c) 2020 Edwin Pratt
# Licenced under the MIT Licence
# Example project structure
# awesome_project
# |---Makefile
# |---README.md
# |---bin
# | |---[empty for Makefile]
# |---obj
@EdThePro101
EdThePro101 / prng.f95
Created Sep 24, 2020
A simple pseudo-random number generator written in Fortran.
View prng.f95
! A simple pseudo-random number generator made in Fortran 2018.
!
! The .f95 extension is used only for syntax highlighting.
!
! Compile with:
! gfortran -std=f2018 -Wall -Werror -Wextra prng.f95 -o prng
!
! -----------------------
!
! Equation used:
@EdThePro101
EdThePro101 / pip-upgrade-all.py
Created Aug 9, 2020
Update all Python packages with pip.
View pip-upgrade-all.py
# python pip-upgrade-all.py
#
# This file will upgrade all Python packages that are out of date.
#
# This file is a snippet from a Stack Overflow answer.
# Link: https://stackoverflow.com/a/5839291/9591441
import pkg_resources as pkg_res
from subprocess import call