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
# original work by Michael F. Lamb. License: GPLv3. | |
# added optional tilde before !user by kupp | |
RFC2812Matcher = /// | |
^ # We'll match the whole line. Start. | |
# Optional prefix and the space that separates it | |
# from the next thing. Prefix can be a servername, | |
# or nick[[!user]@host] | |
(?::( # This whole set is optional but if it's | |
# here it begins with : and ends with space |
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
net = require 'net' | |
host = 'irc.run.net' | |
port = 6660 | |
pingRegExp = RegExp("^PING : #{host}\r\n$") | |
sendMsg = (socket, data) -> | |
socket.write(data + '\r\n') | |
matchPing = (data) -> |
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
#include <iostream> | |
#include <SFML/Graphics.hpp> | |
#include <SFML/System/Vector2.hpp> | |
#include <SFML/Window/Keyboard.hpp> | |
bool chkFunc(sf::Vector2i pos, sf::Vector2f pos_c) { | |
if ( sf::Mouse::isButtonPressed(sf::Mouse::Left) && pos.x >= pos_c.x && pos.x <= pos_c.x+100 && pos.y >= pos_c.y && pos.y <= pos_c.y+100 ) { | |
std::cout << "ya1" << "\n"; | |
return true; | |
} else { |
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
#include <stdio.h> | |
int main (int argc, char* argv[]) { | |
if (argc < 2) { | |
return -1, printf("missing argument\n"); | |
} | |
for (int i = 1; i < argc; i++) { | |
while (*argv[i] != '\0') { | |
if (*argv[i] >= 65 && *argv[i] <= 90) | |
putchar(*argv[i] + 32); |
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
""" | |
Sieve of Eratosthenes | |
""" | |
import math | |
def erato_bool(n: int): | |
""" | |
Returned list of primary numbers form 2 to n-1 | |
""" | |
if n <= 2: |
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 check_rectangle_matrix(matrix: list): | |
# """ | |
# Check if matrix is rectangle list matrix | |
# """ | |
# if matrix and isinstance(matrix, list): | |
# x_len = len(matrix[0]) | |
# for array in matrix: | |
# if len(array) != x_len or not isinstance(array, list): | |
# 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
#include <stdio.h> | |
#include <string.h> | |
#include <stdbool.h> | |
bool checkUniqueSymbols(char* string) { | |
for (int i = 0; i < strlen(string); i++) { | |
for (int j = i + 1; j < strlen(string); j++) { | |
if (string[i] == string[j]) { | |
return false; | |
} |
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 reverse_array(array: list, start, stop): | |
tmp = array[start:stop] | |
array[start:stop] = reversed(tmp) | |
return array | |
def circular_array_shift(array: list, shift: int): | |
if array and shift: | |
length = len(array) | |
shift %= length | |
array = reverse_array(array, 0, length) |
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
Задача: даны два натуральных числа a, b. Необходимо найти сумму чисел на интервале [a, b] (включая концы интервала). | |
Входные данные: a, b, где a <= b. a, b от 1 до 10^9. | |
Вывод: sum - сумма чисел на интервале [a, b]. | |
Пример: a = 1, b = 3 |
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
Задача: даны два числа K, N. Необходимо вычислить арифметическое выражение вида: | |
K * 2^N, используя только битовые операции. | |
Входные данные: K, N - натуральные числа, где K от 1 до 10^3, N от 1 до 20 | |
Вывод: результат выражения K * 2^N | |
Пример: K = 3, N = 4 |