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 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
""" | |
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
#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
#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
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
# 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
# brute-force solution 1 | |
radius = float(input('Enter radius: ')) | |
square_radius = radius * radius | |
int_count = 0 | |
max_int = int(radius) | |
min_int = (-1) * max_int | |
for i in range(min_int, max_int + 1): | |
for j in range(min_int, max_int + 1): | |
if (i*i) + (j*j) <= square_radius: | |
int_count += 1 |
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 <vector> | |
template <class T> | |
void bubble_sort(std::vector<T> &vec) { | |
//Bubble Sort | |
T tmp; | |
for (unsigned int i = 0; i < vec.size(); i++) { | |
for (unsigned int j = 0; j < vec.size()-1; j++) { | |
if (vec[j] > vec[j+1]) { | |
tmp = vec[j]; |
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 | |
#Install sl package and enjoy! | |
while : | |
do | |
sl | |
done |