This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io._ | |
import Main.file | |
import scala.collection.mutable | |
import scala.util.Random | |
object Main extends App { | |
val randomFileName = "random.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __TIMER_GUARD__ | |
#define __TIMER_GUARD__ | |
class TimeGuard { | |
private: | |
unsigned long lastUpdated = 0; | |
unsigned long interval; | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Color biasedColor(Color color, float offset){ | |
float value = (color.r + color.g + color.b) / 3.0; | |
float newValue = value+2.0*((float)random(0,10000)/10000.0)*offset-offset; | |
float valueRatio = newValue / value; | |
int R = (int)((float)color.r * valueRatio); | |
int G = (int)((float)color.g * valueRatio); | |
int B = (int)((float)color.b * valueRatio); | |
return Color(R,G,B); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DateTime } from 'luxon'; | |
import { z } from 'zod'; | |
/** | |
* Replace type V1 with type V2. | |
*/ | |
type Replace<T, V1, V2> = T extends V1 ? V2 : never; | |
/** | |
* Replace all fields of type V1 with fields of type V2. |