This file contains hidden or 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
package utils | |
import ( | |
"time" | |
) | |
// Period type to represent a point in modularized time. | |
/** | |
* e.g: Every monday at 10:00. | |
* duration: period duration is one week. |
This file contains hidden or 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
class K8sHpaSimulation { | |
public static void main(String[] args) { | |
final double tolerance = 0.1; // 0 < x < 1 | |
final double targetUtilization = 50; // 0 < x < 100 | |
final double requestedMetricPerPod = 40; | |
final double limitMetricPerPod = 80; | |
final int podScaleUpPolicyCount = 16; | |
final int podScaleDownPolicyCount = 2; |
This file contains hidden or 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
#include <unistd.h> | |
#include <fcntl.h> | |
#define OUTPUT_BUFFER_SIZE 1024 | |
struct listen_data | |
{ | |
int fd_copy; | |
int fd; | |
int *pipe_fd; |
This file contains hidden or 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
int get_bit(int val, int bit) { | |
return (val >> bit) & 1; | |
} | |
/* sets ith bit to zero*/ | |
int set_zero_bit(int val, int i) { | |
return val & (~(1 << i)); | |
} | |
/* sets ith bit to one*/ |
This file contains hidden or 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
const State = { | |
next: undefined, | |
isLookingFor(char) { | |
throw new Error('Not implemented'); | |
} | |
}; | |
const assert = (ensureTrue, message="Validation failed.") => { | |
if (!ensureTrue) | |
throw new Error(message); |
This file contains hidden or 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
#include <stdio.h> | |
void right_shift_bit(char *c, int last_bit) { | |
if (last_bit) | |
*c = (*c >> 1) | 0b10000000; | |
else | |
*c = (*c >> 1) & 0b01111111; | |
} | |
int get_bit(char c, int bit_index) { |
This file contains hidden or 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.File; | |
import java.io.FileNotFoundException; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.util.Scanner; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class CoordinateRounder { |
This file contains hidden or 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
#include <stdlib.h> | |
#include <printf.h> | |
int is_seperator(char c) { | |
return (c == '\0' || c == ' ' || c == '\n'); | |
} | |
int word_length(char *str) { | |
int i; |
This file contains hidden or 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
int power(int n, int pow) { | |
int res = n; | |
if (pow == 0) return 1; | |
while (--pow > 0) res *= n; | |
return res; | |
} | |
// increases 'pow' until find the smallest power of 10 | |
// which is bigger than the number. and its gives the digit count. | |
int count_digits(int nbr) { |
This file contains hidden or 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
public final class ChatEntry implements Listener { | |
private static final Map<UUID, ChatEntry> entryMap = new HashMap<>(); | |
public Consumer<AsyncPlayerChatEvent> action; | |
public ChatEntry(UUID uuid) { | |
entryMap.put(uuid, this); | |
Bukkit.getPluginManager().registerEvents(this, SeniorRegions.getInstance()); | |
} |
NewerOlder