Skip to content

Instantly share code, notes, and snippets.

View jdtech3's full-sized avatar
πŸ‘¨β€πŸ’»
Just coding away...

Joe Dai jdtech3

πŸ‘¨β€πŸ’»
Just coding away...
View GitHub Profile
@jdtech3
jdtech3 / clock_page_replacement_sim.py
Created December 7, 2024 01:37
Simulator for clock page replacement algorithm (created for ECE344: Operating Systems)
class Page:
def __init__(self):
self.r = 0
self.p = None
def __str__(self):
str(self.p)
def inc_clk(cur: int, max: int) -> int:
@jdtech3
jdtech3 / gen_save_reg_to_stack.py
Last active March 4, 2024 01:25
Generate Nios II assembly to save registers to stack
STORE_MEM_INST = 'stw'
REGISTER_PREFIX = 'r'
STACK_POINTER_REG = 'sp'
RETURN_POINTER_REG = 'ra'
WORD_SIZE = 4
from_reg = int(input("from register: "))
to_reg = int(input("to register: "))
output = []
#include <stdio.h>
#include <math.h>
#define CHECK_UP_TO 100
int main() {
_Bool notPrime[CHECK_UP_TO] = { 1, 1 };
for (int i = 0; i < sqrt(CHECK_UP_TO); i++) {
if (notPrime[i] == 0) {
@jdtech3
jdtech3 / rot_cipher.py
Last active September 12, 2021 00:23
Rot-n/Caesar Cipher
"""rot_cipher.py - A rot-n/Caesar cipher tool that takes user input plaintext and outputs ciphertext
- Provides encrypt() and decrypt()"""
# Store alphabet and the length for later use
ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ALPHABET_LEN = len(ALPHABET)
def encrypt(plaintext: str, rot: int) -> str:
@jdtech3
jdtech3 / NPC Groups Target Profiles [pyfa].txt
Last active March 1, 2025 11:58
All the NPC ships in EVE made into 2 lists of pyfa target profiles. I recommend using groups profiles or pick and choose from ships profiles, since pyfa is not great for handling 4000+ profiles xD (Disclaimer: accuracy not guaranteed!)
# Exported from npc_groups_profiles.py by JDTech
#
# Values are in following format:
# TargetProfile = [name],[EM %],[Thermal %],[Kinetic %],[Explosive %],[Max velocity m/s],[Signature radius m],[Radius m]
TargetProfile = Sentry Gun,22.499999999999996,18.125000000000004,19.374999999999996,18.75,0.0,100.0,100.0
TargetProfile = Police Drone,18.458819370802402,19.288617886178862,21.57601235415237,22.222782258064516,2000.0,100.0,100.0
TargetProfile = Pirate Drone,18.59375,18.281250000000004,21.030745967741936,20.46875,250.0,87.5,87.5
TargetProfile = LCO Drone,0.0,0.0,0.0,0.0,350.0,100.0,100.0
TargetProfile = Minor Threat,18.282493368700266,15.714285714285714,23.67302955665025,27.224221627050554,380.0,45.0,45.0
TargetProfile = Rogue Drone,17.14285714285714,18.571428571428573,24.28571428571429,25.71428571428571,250.0,45.0,45.0
// ==UserScript==
// @name Torn Bazaar Item IDs
// @namespace https://j0e.ca/
// @version 0.3
// @description Displays item IDs in the Bazaar
// @author JDTech
// @match https://www.torn.com/bazaar.php*
// @grant GM_log
// ==/UserScript==
#
#
# TheFrenchGhostys YouTube-DL Archivist Scripts: The ultimate collection of scripts for YouTube-DL
# https://github.com/TheFrenchGhosty/TheFrenchGhostys-YouTube-DL-Archivist-Scripts
# https://github.com/TheFrenchGhosty
#
# Modified by JDTech
.\youtube-dlc --format "(bestvideo[vcodec^=av01][height>=4320][fps>30]/bestvideo[vcodec^=vp9.2][height>=4320][fps>30]/bestvideo[vcodec^=vp9][height>=4320][fps>30]/bestvideo[vcodec^=av01][height>=4320]/bestvideo[vcodec^=vp9.2][height>=4320]/bestvideo[vcodec^=vp9][height>=4320]/bestvideo[height>=4320]/bestvideo[vcodec^=av01][height>=2880][fps>30]/bestvideo[vcodec^=vp9.2][height>=2880][fps>30]/bestvideo[vcodec^=vp9][height>=2880][fps>30]/bestvideo[vcodec^=av01][height>=2880]/bestvideo[vcodec^=vp9.2][height>=2880]/bestvideo[vcodec^=vp9][height>=2880]/bestvideo[height>=2880]/bestvideo[vcodec^=av01][height>=2160][fps>30]/bestvideo[vcodec^=vp9.2][height>=2160][fps>30]/bestvideo[vcodec^=vp9][height>=2160][fps>30]/bestvideo[vcodec^=av01][height>=2160]/bestvideo[vcodec^=vp9.2]
@jdtech3
jdtech3 / pnw_infra_tools.py
Last active September 3, 2020 00:01
[Politics and War] Python rewrite of Sheepy's PHP infra calculator
# [what] JDTech's Python rewrite of Sheepy's PHP infra calculator
# [license] MIT
# [updated] 2020-09-02
def infra_price(amt: float) -> float:
"""Calculates infra price at a certain infra level
Args:
amt (float): Infra level
Returns:
float: Price of one (1) infra at specified infra level
@jdtech3
jdtech3 / Quiz4Q3.java
Last active August 7, 2019 02:39
If we have private fields, name 2 different ways we can set the values from outside of the class.
import java.lang.reflect.Field;
class SomeClass {
private int privateValue = 0;
public int getPrivateValue() {
return privateValue;
}
public void setPrivateValue(int privateValue) {