Skip to content

Instantly share code, notes, and snippets.

gladilindv

Block or report user

Report or block gladilindv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View substrWith2DiffChars
// 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';
@gladilindv
gladilindv / install-rabbitmq.sh
Created Dec 3, 2018 — forked from yetanotherchris/install-rabbitmq.sh
RabbitMQ on Docker with admin UI
View install-rabbitmq.sh
# 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
@gladilindv
gladilindv / nginx.conf
Created Dec 3, 2018
NGINX Reverse Proxy
View nginx.conf
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;
View sumBigNumber_v1.cpp
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]; //резервируем два символа для единицы в начале строки и для конца строки
View sumBigNumber_v2.cpp
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())
{
View sumBigNumber_v0.cpp
// Example program
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
// ----------------------------------------------------------
// ряд вспомогательных функций
static inline void removeChar(string& s, char c){
You can’t perform that action at this time.