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 itertools | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| with open("war_peace.txt", "r") as file: | |
| content = file.readlines(); | |
| print("Всего строк", len(content)) | |
| notEmpty = list(filter(lambda s: len(s) > 1, content)) | |
| print("Непустых строк", len(notEmpty)) |
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 boolean connect(String workDir, String dbname) { | |
| try { | |
| Class.forName("org.sqlite.JDBC"); | |
| String url = "jdbc:sqlite:/" + workDir + "/" + dbname + ".db"; | |
| conn = DriverManager.getConnection(url); | |
| } | |
| catch (ClassNotFoundException e) { | |
| e.printStackTrace(); | |
| } | |
| catch (SQLException e) { |
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 class LessonInfo { | |
| public LocalDate date; | |
| public String pair; | |
| public String lessonType; | |
| public LessonInfo(LocalDate date, String pair, String lessonType) { | |
| this.date = date; | |
| this.pair = pair; | |
| this.lessonType = lessonType; | |
| } |
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
| date.getDayOfWeek().getDisplayName(TextStyle.SHORT, Locale.getDefault()) |
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
| DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | |
| return date.format(formatter); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| #!/bin/bash | |
| awk '!seen[$0]++' class.txt > class-1.txt |
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
| // true - если объект ранее не встречался среди ближайших | |
| // false - если он был ранее найден (по id) | |
| // поиск ведем в векторе результатов | |
| bool isNewObj1(std::vector<ScaleObjInfo>& result, ScaleObjInfo* minSOI) { | |
| for (auto& t : result) { | |
| if (t.pobj->id == minSOI->pobj->id) | |
| return false; | |
| } | |
| return true; | |
| } |
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
| template<typename Set> | |
| auto closest_element(Set& set, const typename Set::value_type& value) | |
| -> decltype(set.begin()) | |
| { | |
| const auto it = set.lower_bound(value); | |
| if (it == set.begin()) | |
| return it; | |
| const auto prev_it = std::prev(it); | |
| return (it == set.end() || value - *prev_it <= *it - value) ? prev_it : it; |
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
| def serp(n): | |
| d = ['*'] | |
| for i in range(n): | |
| sp = " "*(2**i) | |
| d = [sp+x+sp for x in d] + [x+" "+x for x in d] | |
| return d | |
| print ("\n".join(serp(4))) |