The solution is good enough for data.txt provided. In production there can be the way larger files, thus I would implement a generator that reads an input file in chunks and returns tokens that can be accumulated in a hash table instead of keeping everything in the memory.
This file contains 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
Извините за недоразумение. Вы правильно заметили, что вам неизвестно, легче или тяжелее фальшивая монета. Давайте попробуем другой метод: | |
1. Разделите 12 монет на три группы по 4 монеты. | |
2. Первое взвешивание: | |
- Взвесьте две из этих трех групп. Если они весят одинаково, перейдите к шагу 3. | |
- Если одна из групп легче, перейдите к шагу 4. | |
3. Возьмите оставшиеся 4 монеты (2 из каждой из первых двух групп) и разделите их на две группы по 2 монеты. Сравните их вес. |
This file contains 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
Для решения этой головоломки можно использовать следующий метод: | |
1. Разделите 12 монет на три равные группы по 4 монеты. | |
2. Первое взвешивание: | |
- Взвесьте две из этих трех групп. Если они весят одинаково, перейдите к шагу 3. | |
- Если одна из групп легче, то одна из четырех монет в этой группе фальшивая. Перейдите к шагу 3. | |
3. Возьмите три монеты из группы, в которой была обнаружена фальшивая монета. Пометьте их как A, B и C. |
This file contains 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
[ | |
{ | |
'$match': { | |
'app': 'nametestsig', | |
'lang': 'en', | |
'label_name': '', | |
'label_value': '', | |
'content_id': { | |
'$ne': '0' | |
} |
This file contains 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
user www-data; | |
worker_processes 8; | |
error_log off; | |
pid logs/nginx.pid; | |
events { | |
worker_connections 4096; | |
use epoll; | |
} |
This file contains 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 | |
# Check if wrk2 is installed | |
if ! command -v wrk2 &> /dev/null; then | |
echo "wrk2 is not installed. Please install it: https://github.com/giltene/wrk2" | |
exit 1 | |
fi | |
# Check if an argument (URL) is provided | |
if [ -z "$1" ]; then |
This file contains 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
If your Docker containers cannot connect to each other using public IP addresses and there's a firewall on the host machine, there are several factors you should consider: | |
1. **Docker Networking**: Docker containers are typically assigned private IP addresses by Docker's internal networking system. Directly using public IP addresses to communicate between containers is not the usual practice. Docker containers are designed to communicate with each other using internal IP addresses, service names, or Docker's internal DNS. | |
2. **Firewall Rules**: If there's a firewall on the host machine, you need to ensure that the required ports for communication between containers are open. By default, Docker uses various ports for communication, and if those ports are blocked by the firewall, communication between containers might be affected. | |
3. **Docker Network Configuration**: Ensure that your containers are connected to the same Docker network if you want them to communicate with each other. Docker provides bridge ne |
This file contains 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 | |
# Check if wrk2 is installed | |
if ! command -v wrk2 &> /dev/null; then | |
echo "wrk2 is not installed. Please install it: https://github.com/giltene/wrk2" | |
exit 1 | |
fi | |
# Check if an argument (URL) is provided | |
if [ -z "$1" ]; then |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<!--Import Google Icon Font--> | |
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | |
<!--Import materialize.css--> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"> | |
<!--Let browser know website is optimized for mobile--> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> |
This file contains 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
$ ./manage.py showmigrations --settings=mashup.settings.prod | |
Traceback (most recent call last): | |
File "./manage.py", line 10, in <module> | |
execute_from_command_line(sys.argv) | |
File "/Users/vladimir/PycharmProjects/buzzhearts/env27/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line | |
utility.execute() | |
File "/Users/vladimir/PycharmProjects/buzzhearts/env27/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute | |
django.setup() | |
File "/Users/vladimir/PycharmProjects/buzzhearts/env27/lib/python2.7/site-packages/django/__init__.py", line 27, in setup | |
apps.populate(settings.INSTALLED_APPS) |
NewerOlder