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 / GATES.md
Last active October 9, 2020 14:51
Mathematic calculations for logic gates

Logic Gates Mathematic Evaluations

These are just the proper, mathematical formula's that will behave like any generic logic evaluation. This was compiled by me simply because I had the time to, I'm sure these are already known, and maybe even have different/better ways to do them.

AND

The formula for this is xy, where

  • X: first input
  • Y: second input
  • R: the result

Truth Table

@Frontear
Frontear / mcp_setup.sh
Last active January 4, 2019 18:01
A shell script dedicated to automatically downloading and setting up a ModCoderPack workspace. Now includes more functionality than ever!
#!/bin/sh
# I highly recommend this video: https://www.youtube.com/watch?v=b2gJfKNSb1k
# It can help troubleshoot, and is the sole reason I decided to even expand this script for such complex tasks in the first place
# update these urls correctly for yourself
MC_VERSION="1.8.8" # just the minecraft version you are planning to decompile
MCP_ZIP="http://www.modcoderpack.com/files/mcp918.zip" # the modcoderpack zip. Download the one closest to your version
SERVER_JAR="https://launcher.mojang.com/v1/objects/5fafba3f58c40dc51b5c3ca72a98f62dfdae1db7/server.jar" # the server jar. Download the exact one for your version
MAPPINGS_ZIP="http://export.mcpbot.bspk.rs/mcp_stable/20-1.8.8/mcp_stable-20-1.8.8.zip" # the obfuscated mappings. Download the stable ones, if possible
@Frontear
Frontear / warframe_setup.sh
Created December 12, 2018 12:46
A simple script dedicated to being able to run Warframe using SteamPlay and GloriousEggroll's script. Modify for your system as you need to.
#!/bin/sh
WARFRAME_STEAM_DIR=~/.local/share/Steam/steamapps/common/Warframe
GLORIOUS_EGGROLL_PATCHES="https://gitlab.com/GloriousEggroll/warframe-linux/-/archive/steamplay-proton/warframe-linux-steamplay-proton.zip"
sudo -v
echo "Downloading dependencies..."
pacaur -S xboxdrv curl
@Frontear
Frontear / resource_pack.py
Last active August 1, 2024 02:05
Packages the default minecraft resource pack in it's entirety. This is a tool designed for resource pack makers
import os, sys, logging, json, shutil
from urllib.request import urlopen, urlretrieve
from zipfile import ZipFile
def main():
logging.basicConfig(format='[%(asctime)s] [pack/%(levelname)s]: %(message)s', datefmt='%H:%M:%S', level=logging.INFO)
os.mkdir('tmp')
manifest = json.loads(urlopen('https://launchermeta.mojang.com/mc/game/version_manifest.json').read())
target_version = sys.argv[1] if len(sys.argv) > 1 else manifest['latest']['release'] # defaults to latest version if none specified
@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)
@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 / 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 / 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 / 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 / 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