Skip to content

Instantly share code, notes, and snippets.

View Frontear's full-sized avatar
🚫
Hiatus due to school.

Ali Rizvi Frontear

🚫
Hiatus due to school.
View GitHub Profile
@Frontear
Frontear / jvm_descriptor_generator.py
Last active October 11, 2021 20:21
A python script designed to output jvm descriptors with respect to the standards set by mixin.
"""
Implement the descriptor spec defined in Java 16: https://docs.oracle.com/javase/specs/jvms/se16/html/jvms-4.html#jvms-4.3
It is given respect to mixin standards, found at: https://github.com/SpongePowered/Mixin
package com.github.frontear;
class Main {
private int num;
private String str;
@Frontear
Frontear / str_obfuscate.py
Last active October 26, 2021 17:42
A simple string obfuscation/deobfuscation python program. This was used as a non-secure, educational use only "encryption" for a school assignment.
import zlib
import base64
import hashlib
SEPARATOR = "\0"
ENCODING = "UTF-8"
HASHING = hashlib.blake2b
def encrypt(data: str, key: str) -> bytes:
arr = []
@Frontear
Frontear / Glyph.java
Created July 17, 2021 02:46
An attempt to draw text using GLFW
package org.example;
public final class Glyph {
private final int x, y, width, height;
public Glyph(final int x, final int y, final int width, final int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
@Frontear
Frontear / cps109_lab3.py
Created September 29, 2020 13:15
This is the code for CPS109 Lab 3
nums = []
while True:
x = float(input("Please enter a number: "))
nums.append(x)
if x < 0.0:
break
for x in range(len(nums)):
@Frontear
Frontear / cps109_lab2.py
Created September 22, 2020 13:34
This is the code for CPS109 Lab 2
items = {}
count = int(input("How many items are you purchasing? "))
for x in range(count):
name = str(input("Item name: "))
cost = float(input("Item cost: "))
items[name] = cost
@Frontear
Frontear / main.cpp
Last active October 9, 2020 14:38
Programming technique to compare objects inside of a loop without needing to loop twice
#include <iostream>
// find the max value in an array
int main() {
int array[] = { 11, 100, 99, 95, 14, 62, 35, 74 };
auto j = 0u;
for (auto i = 0u; i < 8; ++i) {
if (array[j] < array[i]) { // controls comparisions to find the maximum value without needing to loop the same array twice
j = i;
@Frontear
Frontear / duplicates.cpp
Last active February 15, 2020 19:16
A simple program(s) that will find duplicate files in a specific directory, and list them
#include <map>
#include <set>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <filesystem>
using namespace std;
@Frontear
Frontear / jailbreak.hpp
Last active January 17, 2020 14:32
An example of how you can use reinterpret_cast to access and modify private properties of classes in C++
#ifndef FRONTEAR_JAILBREAK
#define FRONTEAR_JAILBREAK
/* This class is meant to mimic the layout of the class you want to access
* It won't necessarily always work, as the compiler can potentially move
* properties around in one, but not the other. This shouldn't be used
* in daily code, and serves moreso as a demonstration.
*/
struct Jailbreak {
int x; // a publically accessible property
@Frontear
Frontear / Main.kt
Last active September 16, 2019 14:42
Working with sun.misc.Unsafe: How to allocate, store, and view information
package org.frontear
fun main() {
val unsafe = SunUtils.getUnsafe()!!
val str = "Hello World"
val int = Int.MAX_VALUE
val address = unsafe.allocateMemory((Int.SIZE_BYTES + Char.SIZE_BYTES * str.length).toLong()) // allocate enough memory for our objects. Notice how we don't allocate for the \0 in strings, as we don't need it in this case, but might in other cases
unsafe.putInt(address, int) // we don't need to offset, since the address is starting from it's beginning point
for (i in 0 until str.length) {
val char = str[i]
@Frontear
Frontear / CMakeLists.txt
Last active March 4, 2023 00:08
C++ Environment files for working with OpenGL (GLEW + GLFW) on Linux [Manjaro]
cmake_minimum_required(VERSION 3.15)
project(Program)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS "-lGL -lGLEW -lglfw")
add_executable(Program src/main.cpp src/main.h)