Skip to content

Instantly share code, notes, and snippets.

View exploit.sh
echo "Exploit.sh talking..."
@theflofly
theflofly / HeapSort.js
Last active Apr 15, 2019
JavaScript implementation of the heap sort algorithm as described here : http://staff.ustc.edu.cn/~csli/graduate/algorithms/book6/chap07.htm
View HeapSort.js
"use strict";
class HeapSort {
constructor(inputArray) {
this.inputArray = inputArray;
this.heapSize = inputArray.length;
}
main() {
View insertion_sort.py
def insertion_sort(arr_to_sort):
# we begin at the second element
for j in range(1, len(arr_to_sort)):
# the key is the number that will be placed in the ordered array
key = arr_to_sort[j]
# we know that before the key all elements are ordered (at the beginning there is one element before the key)
View JobsLauncher.java
package com.tcb.issue1.configuration;
import org.joda.time.LocalDateTime;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
View CarToOfferJobListener.java
package com.tcb.issue1.job;
import com.tcb.issue1.model.Car;
import com.tcb.issue1.repository.CarRepository;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.listener.JobExecutionListenerSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
View CarToOffersJobConfiguration.java
package com.tcb.issue1.configuration;
import com.tcb.issue1.job.CarToOfferJobListener;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.launch.support.RunIdIncrementer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
View CarToOfferStepConfiguration.java
package com.tcb.issue1.job;
import com.tcb.issue1.model.Car;
import com.tcb.issue1.model.Offer;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemReader;
import org.springframework.beans.factory.annotation.Qualifier;
View OfferItemWriter.java
package com.tcb.issue1.job;
import com.tcb.issue1.model.Offer;
import com.tcb.issue1.repository.OfferRepository;
import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
View CarProcessor.java
package com.tcb.issue1.job;
import com.tcb.issue1.model.Car;
import com.tcb.issue1.model.Offer;
import org.slf4j.Logger;
import org.springframework.batch.item.ItemProcessor;
import static org.slf4j.LoggerFactory.getLogger;
/**
View CarItemReader.java
package com.tcb.issue1.job;
import com.tcb.issue1.model.Car;
import com.tcb.issue1.repository.CarRepository;
import org.springframework.batch.item.data.AbstractPaginatedDataItemReader;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;