Skip to content

Instantly share code, notes, and snippets.

View Eladkay's full-sized avatar

Eladkay Eladkay

View GitHub Profile
@Eladkay
Eladkay / OneOneMerge.kt
Last active August 6, 2021 20:24
I needed it, so I made it. It takes two sets of lines and merges them alternatingly.
import java.util.*
fun main() {
val scanner = Scanner(System.`in`)
var last = ""
val lines1 = mutableListOf<String>()
do {
last = scanner.nextLine()
lines1.add(last)
} while (last != "$")
@Eladkay
Eladkay / FindCourseAndSemesterAvg.kt
Created March 4, 2021 08:40
Find average of chosen courses over given semesters, as well as calculate the average of the given semesters over the chosen courses
import java.net.URL
data class Course(val number: String, var avg: Double = 0.0, val avgBySem: MutableMap<String, Double> = mutableMapOf())
val bucket = listOf("104031", "104166", "234114", "234129",
"104032", "104134", "114071", "234124", "234141",
"044252", "094412", "234218", "234292", "236319")
val semesters = listOf("202001", "201902", "201901", "201802", "201801", "201702", "201701", "201602", "201601")
fun link(course: String, semester: String)
@Eladkay
Eladkay / NfaToDfa.kt
Last active May 15, 2020 12:36
Converts a nondeterministic finite automaton with epsilon moves to a minimal deterministic finite automaton and to the corresponding linear grammar.
import java.util.*
fun main(args: Array<String>) {
val a = "a"; val b = "b"; val c = "c"; val d = "d"; val e = "e"; val f = "f"; val g = "g"; val h = "h"; val i = "i"; val j = "j" // for convenience
// format is delta(first, third) = second. no requirement that third be of the same list as the first and second.
// nfa without epsilon moves:
/*val moves = listOf(
a, b, b,
@Eladkay
Eladkay / vault.ino
Created March 9, 2020 09:31
Vaults Project Arduino Code
int lastReading = 0;
int threshold = 18;
int hittingThres = 0;
int SECONDS_THRESHOLD = 60;
void calibrate() { // sets threshold
int readings = 0;
int NUM_CALIBRATE = 5;
for(int i = 0; i < NUM_CALIBRATE; i++) {
if(i % 2 == 1) digitalWrite(12, HIGH);
open fun postInit(event: FMLPostInitializationEvent) {
// --Wiki Navbox Generator-- (i made this)
val COLOR_CHAR = '\u00A7'
val STRIP_COLOR_PATTERN = Pattern.compile("(?i)" + COLOR_CHAR.toString() + "[0-9A-FK-OR]")
fun stripColor(input: String?): String? {
if (input == null)
return null
return STRIP_COLOR_PATTERN.matcher(input).replaceAll("")
}
val abbrev = "SIL" // has to be wiki-registered

Quaritum Progression

No world gen. (impl.)

Poppies can be upgraded to Common flowers using Sharded Skies (d) (impl.)

Which can be upgraded to rare flowers using Grand Sharded Skies (d) (impl.)

Then magical fertilizer made with Atlas is used to grow Arcane flowers from rare flowers. (impl.)

Keybase proof

I hereby claim:

  • I am Eladkay on github.
  • I am eladkay (https://keybase.io/eladkay) on keybase.
  • I have a public key whose fingerprint is 699E 740C 7432 3206 1EBC 7DDE 443E F707 D2CC 1B1A

To claim this, I am signing this object:

@Eladkay
Eladkay / gist:e8bca15373b0aa86cff1
Created July 14, 2015 07:01
Forestry Crash Report
---- Minecraft Crash Report ----
// This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]
Time: 7/14/15 9:59 AM
Description: Rendering entity in world
java.lang.RuntimeException: Found Chromosome with invalid Alleles.
NBTTagCompound: [0:{UID1:"forestry.speciesArgrarian",UID0:"forestry.speciesArgrarian",Slot:0b},1:{UID1:"forestry.speedSlow",UID0:"forestry.speedSlow",Slot:1b},2:{UID1:"forestry.lifespanShorter",UID0:"forestry.lifespanShorter",Slot:2b},3:{UID1:"forestry.fertilityNormal",UID0:"forestry.fertilityNormal",Slot:3b},4:{UID1:"forestry.toleranceNone",UID0:"forestry.toleranceNone",Slot:4b},5:{UID1:"forestry.boolFalse",UID0:"forestry.boolFalse",Slot:5b},6:{UID1:"forestry.toleranceBoth2",UID0:"forestry.toleranceBoth2",Slot:7b},7:{UID1:"forestry.boolFalse",UID0:"forestry.boolFalse",Slot:8b},8:{UID1:"forestry.boolFalse",UID0:"forestry.boolFalse",Slot:9b},9:{UID1:"forestry.flowersWheat",UID0:"forestry.flowersWheat",Slot:10b},10:{UID1:"forestry.floweringFaster",UID0:"forestry.floweringFa
---- Minecraft Crash Report ----
// Don't do that.
Time: 7/7/15 6:20 PM
Description: Ticking block entity
java.lang.NullPointerException: Ticking block entity
at cofh.thermalexpansion.block.machine.TilePulverizer.processStart(TilePulverizer.java:109)
at cofh.thermalexpansion.block.machine.TileMachineBase.func_145845_h(TileMachineBase.java:114)
at net.minecraft.world.World.func_72939_s(World.java:1939)
[10:07:52] [Client thread/WARN] [ChromaPixel]: An exception occured in onClientTick(). Stacktrace below.
[10:07:52] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.NullPointerException
[10:07:52] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.kevyporter.chromapixel.chromahuds.InfoHUD.getPing(InfoHUD.java:147)
[10:07:52] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.kevyporter.chromapixel.chromahuds.InfoHUD.getInfoDisplay(InfoHUD.java:77)
[10:07:52] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.kevyporter.chromapixel.ChromaPixelMod.onClientTick(ChromaPixelMod.java:183)
[10:07:52] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_8_ChromaPixelMod_onClientTick_ClientTickEvent.invoke(.dynamic)
[10:07:52] [Client thread/INFO] [STDERR]: [ja