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
// Example program | |
#include <iostream> | |
#include <algorithm> | |
#include <string> | |
using namespace std; | |
// ---------------------------------------------------------- | |
// ряд вспомогательных функций | |
static inline void removeChar(string& s, char c){ |
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
std::string sum(const std::string& a, const std::string& b) | |
{ | |
std::string res(std::max(a.size(), b.size()) + 1, '0'); | |
auto iterA = a.rbegin(); | |
auto iterB = b.rbegin(); | |
auto iter = res.rbegin(); | |
static const auto addIter = [&iter](decltype(iterA)& iterA, const std::string& a) | |
{ | |
if(iterA != a.rend()) | |
{ |
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
const char* sum(const char* a, const char* b) { | |
int size_a = strlen(a); | |
int size_b = strlen(b); | |
int size_max = 0, size_min = 0, temp = 0, max_k = 0, min_k = 0; | |
const char *p_max, *p_min; | |
//создаем динамический массив res и копируем в него большую строку | |
size_max = std::max(size_a, size_b); | |
size_min = std::min(size_a, size_b); | |
char *res = new char[size_max + 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
http { | |
# NGINX will handle gzip compression of responses from the app server | |
gzip on; | |
gzip_proxied any; | |
gzip_types text/plain application/json; | |
gzip_min_length 1000; | |
server { | |
listen 80; |
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
# AWS specific install of Docker | |
sudo yum update -y | |
sudo yum install -y docker | |
sudo service docker start | |
sudo usermod -a -G docker ec2-user | |
# exit the SSH session, login again | |
# Docker | |
docker run -d --hostname my-rabbit --name some-rabbit -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq |
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
// only for one-byte encoding | |
string get2CharSubString(const string& s) { | |
auto l = s.length(); | |
if (l < 3) return s; | |
size_t p = 0; // start max substr position | |
size_t m = 0; // current max length of substr | |
char c1 = s[0]; | |
char c2 = '\0'; |
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 Foundation | |
import SwiftUI | |
import Combine | |
class HttpAuth: ObservableObject { | |
@Published var authenticated = false | |
func postAuth(username: String, password: String) { | |
guard let url = URL(string: "http://mysite/login") else { return } |