Skip to content

Instantly share code, notes, and snippets.

View sashadasasha's full-sized avatar

Aleksandra Tarasova sashadasasha

View GitHub Profile
@sashadasasha
sashadasasha / memory_manager
Created October 14, 2025 14:01
Менеджер памяти
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
const int MAXM = 100000;
const int MAXFREE = MAXM / 2;
# Find a and b for y = ax + b, for known x and y (Least-squares function approximation)
x = [-2, -1, 1, 2, 3] #example
y = [-1.34, 0.94, 5.5, 7.78, 10.06]
sumxmulty = 0
sumxsqu = 0
sumx = 0
sumy = 0
n = len(x)
@sashadasasha
sashadasasha / StreamsBuilderFactoryBean.java
Last active October 26, 2021 07:12
StreamsBuilderFactoryBean for re-creating Kafka Streams topology
@Bean(name = DEFAULT_STREAMS_BUILDER_BEAN_NAME)
@Primary
public StreamsBuilderFactoryBean defaultKafkaStreamsBuilder(KafkaStreamsConfiguration kStreamsConfigs) {
return new DynamicStreamsBuilderFactoryBean(kStreamsConfigs);
}
public static class DynamicStreamsBuilderFactoryBean extends StreamsBuilderFactoryBean {
private StreamsBuilder instance;
@sashadasasha
sashadasasha / gist:18d1f41f3a5ce9b22207f043970d4be2
Created April 29, 2021 17:59
maven dependencies for Spring MVC
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
@sashadasasha
sashadasasha / Parser.java
Last active October 26, 2021 07:13
INN validation Java (from txt file to xls) with apache.poi library
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import java.io.File;
import java.io.FileOutputStream;
@sashadasasha
sashadasasha / fizzBuzzPHP.php
Created August 16, 2019 11:07
PHP FizzBuzz
$i = 0;
while ($i <= 100) {
if ($i % 3 === 0 && $i % 5 === 0) {
echo "FizzBuzz <br>";
} elseif ($i % 3 === 0) {
echo "Fizz <br>";
} elseif ($i % 5 === 0) {
echo"Buzz <br>";
} else {
const x = () => {
for (let i = 1; i <= 100; i ++) {
if ( i % 3 === 0) {
if (i % 5 === 0) {
console.log("FizzBuzz");
} else {
console.log("Fizz");
}
} else if (i % 5 === 0) {
console.log("Buzz");
@sashadasasha
sashadasasha / Vowels and consonants
Created May 1, 2019 18:34
function vowelsAndConsonants First, print each vowel in a string on a new line. Each vowel printed in the same order as it appeared in a string . Second, print each consonant (i.e., non-vowel) in a string on a new line in the same order as it appeared in a string.
<meta charset="UTF-8">
<script>
"use strict";
function vowelsAndConsonants(s) {
let vowel = ["a", "e", "i", "o", "u"];
let arrVowel = [];
let arrConson = [];
for (let i = 0; i < s.length; i++) {
switch (s[i]) {
@sashadasasha
sashadasasha / Median of array
Created April 30, 2019 10:26
searching of array's median
<meta charset="UTF-8">
<script>
"use strict";
function median(data) {
function compareNumbers(a, b) {
return a - b;
}
let arr = data.sort(compareNumbers);
@sashadasasha
sashadasasha / gist:acc823a194241cd11899237ddb9672f3
Last active April 30, 2019 10:28
JS recursion function, 1...n, without array
<meta charset = "utf-8">
<script>
"use strict";
var x=0;
function my_function(n) {
if (n==1){
return (x+1);
}else{