Skip to content

Instantly share code, notes, and snippets.

View AlexRogalskiy's full-sized avatar
🛰️
Work on stuff that matters

Alexander AlexRogalskiy

🛰️
Work on stuff that matters
View GitHub Profile
@MachineLearningIsEasy
MachineLearningIsEasy / Seq2Seq_with_pytorch.ipynb
Created October 12, 2020 11:05
Create and train seq2seq model with pytorch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MachineLearningIsEasy
MachineLearningIsEasy / Satellite_images_example.ipynb
Created September 11, 2020 11:47
Download satellite images from sentelhub
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pavlospt
pavlospt / settings.gradle.kts
Created August 20, 2020 09:03
Automatically discover modules
/**
* Dynamically discover and add modules in our project
* */
val moduleBuildFileName = "build.gradle.kts"
// A pattern to match the prefix of our modules
val eligibleModuleNamePattern = "a_pattern_to_match_our_module_names".toRegex() // (e.g.: (app|android-|kotlin-).*)
// Filter directories that indicate modules
val moduleFilter: FileFilter = FileFilter { pathname: File ->
@erohana
erohana / api.mustache
Created August 17, 2020 10:45
openapi spring webflux server code generator
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package {{package}};
{{#imports}}import {{import}};
{{/imports}}
import io.swagger.annotations.*;
@theboreddev
theboreddev / GroupByClassifier.java
Created July 18, 2020 20:49
employeesOverThirtyBySex
final Map<Employee.Sex, List<Employee>> employeesOverThirtyBySex = employees.stream()
.collect(groupingBy(Employee::getSex, filtering(employee -> employee.getAge() > 30, toList())));
@theboreddev
theboreddev / GroupByClassifier.java
Created July 18, 2020 20:35
youngestEmployeeBySex
final Map<Employee.Sex, Optional<Employee>> youngestEmployeeBySex = employees.stream()
.collect(groupingBy(Employee::getSex, minBy(comparing(Employee::getAge))));
@theboreddev
theboreddev / GroupByClassifier.java
Created July 18, 2020 20:31
groupBySexAndAge groupBySexAndAge
final Map<Employee.Sex, Map<Integer, List<Employee>>> groupBySexAndAge = employees.stream()
.collect(groupingBy(Employee::getSex, groupingBy(Employee::getAge)));
final Map<Employee.Sex, Double> averageAgeBySex = employees.stream()
.collect(groupingBy(Employee::getSex, averagingInt(Employee::getAge)));
final Map<Employee.Sex, Set<Employee>> employeesBySex = employees.stream()
.collect(groupingBy(Employee::getSex, toSet()));
final Collection<Employee> employees = List.of(
new Employee("Karen Smith", 51200.0, 29, Employee.Sex.FEMALE),
new Employee("John Smith", 24000.0, 32, Employee.Sex.MALE),
new Employee("Anthony Jackson", 44000.0, 33, Employee.Sex.MALE),
new Employee("Alyson Palmer", 34320.0, 36, Employee.Sex.FEMALE),
new Employee("Jessica Sanders", 64320.0, 34, Employee.Sex.FEMALE)
);
final Map<Employee.Sex, List<Employee>> employeesBySex = employees.stream()
.collect(groupingBy(Employee::getSex));