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 redis | |
import time | |
import random | |
def load_file(fp, fpKey, r, expiry): | |
with open(fp, "rb") as f: | |
data = f.read() | |
p = r.pipeline() | |
p.set(fpKey, data) |
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
Production is awesome place to learn and know about the system. Team should feel lucky to work on those systems. | |
Make sure to have these parameters defined | |
-XX:+HeapDumpOnOutOfMemoryError | |
-XX:HeapDumpPath=<path> | |
lets say that you are experiencing OOM, but you still don't determine the root cause of the issue, | |
You might probably need to restart as soon as you see performance issues or even better daily thats perfectly fine & taking heap | |
dump will not practical. try to take heap dumpl. |
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
// Lets keep only last 10 builds | |
MAX_BUILDS = 10 | |
def jobs = Jenkins.instance.items; | |
println "Total Jobs" + jobs.size() | |
for (job in jobs) { | |
println "Job: " + job.name | |
try { | |
if(job instanceof jenkins.branch.MultiBranchProject) { |
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.util.Arrays; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Properties; | |
import org.apache.kafka.clients.consumer.KafkaConsumer; | |
import org.apache.kafka.clients.consumer.OffsetAndMetadata; | |
import org.apache.kafka.common.TopicPartition; | |
import org.apache.kafka.common.serialization.StringDeserializer; | |
import org.zeroturnaround.exec.ProcessExecutor; |
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
export JAVA_HOME=$(/usr/libexec/java_home) | |
export GRADLE_HOME=/opt/gradle | |
export M2_HOME=/opt/maven | |
export M2=$M2_HOME/bin | |
export PATH=$M2:$PATH:$GRADLE_HOME/bin | |
export MYSQL_HOME=/usr/local/bin/mysql | |
export PATH=$PATH:$MYSQL_HOME/bin | |
alias ll="ls -lptr" | |
alias cd..="cd .." |
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
public static LocalDate getLocalDateWithUnknownFormat(String dString) { | |
LocalDate[] localDate = {null}; | |
Arrays.asList("yyyy-MM-dd'T'HH:mm:ss'Z'", "yyyy-MM-dd'T'HH:mm:ssZ", | |
"yyyy-MM-dd'T'HH:mm:ss", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", | |
"yyyy-MM-dd'T'HH:mm:ss.SSSZ", "yyyy-MM-dd HH:mm:ss", | |
"MM/dd/yyyy HH:mm:ss", "MM/dd/yyyy'T'HH:mm:ss.SSS'Z'", | |
"MM/dd/yyyy'T'HH:mm:ss.SSSZ", "MM/dd/yyyy'T'HH:mm:ss.SSS", | |
"MM/dd/yyyy'T'HH:mm:ssZ", "MM/dd/yyyy'T'HH:mm:ss", | |
"yyyy:MM:dd HH:mm:ss", "yyyyMMdd") | |
.stream().parallel().forEach(f-> { |
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
// IntelliJ generated | |
@Override | |
public boolean equals(Object o) { | |
if (this == o) return true; | |
if (!(o instanceof ElementNameKey)) return false; | |
ElementNameKey that = (ElementNameKey) o; | |
if (field1 != that.field1) return false; | |
if (field2 != that.field2) return false; |
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
// Follows the template pattern to provide container for ObjectInput | |
static abstract class ObjectInputReaderTemplate<T> { | |
private ObjectInput objectInput; | |
public ObjectInputReaderTemplate(final ObjectInput objectInput){ | |
this.objectInput=objectInput; | |
} | |
public final T execute() throws IOException { | |
T t = get(); |
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
// A wrapper classes delegating the execution of method into the container that can handle forward compatibility | |
// This class implements all the methods ObjectInput & moves the cursor | |
// whenever it sees skippable data from future versions | |
// WARNING : Currently for POC only 2 methods are implemented | |
class ObjectInputDecorator{ | |
ObjectInput input; | |
ObjectInputDecorator(ObjectInput input){ | |
this.input=input; | |
} |
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
VERSION = 0; | |
@Override | |
public void writeExternal(ObjectOutput out) throws IOException { | |
out.writeInt(VERSION); | |
out.writeInt(number); | |
out.writeObject(name); | |
} | |
@Override | |
public void readExternal(ObjectInput _in) throws IOException, ClassNotFoundException { | |
ObjectInputWrapper in = new ObjectInputWrapper(_in); |
NewerOlder