products = {
'00000234': {'value1': 0, 'value2': 23},
'567333': {'value1': 5, 'value2': 23},
'23234243': {'value1': 25, 'value2': 23},
}
products = {product_id: values for product_id, values in products.items() if values['value1']}
print(products)
# {'567333': {'value1': 5, 'value2': 23}, '23234243': {'value1': 25, 'value2': 23}}
function setCenter () {
myMap.setCenter([57.767265, 40.925358]);
}
youtube-dl https://vk.com/id2867140\?z\=video-126090446_456239037%2Fd690ca4bae957e3ebf%2Fpl_post_-126090446_157
[vk] -126090446_456239037: Downloading webpage
[vk] -126090446_456239037: Downloading m3u8 information
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 2004
[download] Destination: BLKROOM ON AIR - XMAS SESSION--126090446_456239037.mp4
[download] 2.5% of ~5.59GiB at 475.65KiB/s
import yaml
config = yaml.safe_load(open("path/to/config.yml"))
# config.json
{
"mysql":{
"host":"localhost",
"user":"root",
"passwd":"my secret password",
"db":"write-math"
},
"other":{
"preprocessing_queue":[
"preprocessing.scale_and_center",
"preprocessing.dot_reduction",
"preprocessing.connect_lines"
],
"use_anonymous":true
}
}
import json
with open('config.json') as json_data_file:
data = json.load(json_data_file)
print(data)
В чем может быть проблема?
Предлагается развернуть на сервере базу данных MariaDB и писать в неё. Но я сомневаюсь что это имеет смысл, потому что приложение использует 1 человек.
как проще всего решить данную задачу?
server {
server_name server1.site.com;
root /var/www/server1.site.com/public;
# reverse proxy
location / {
proxy_pass http://10.0.0.1:80;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name server1.site.com;
root /var/www/server1.site.com/public;
# SSL
ssl_certificate /etc/letsencrypt/live/server1.site.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/server1.site.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/server1.site.com/chain.pem;
# security
include nginxconfig.io/security.conf;
# reverse proxy
location / {
proxy_pass http://10.0.0.1:80;
include nginxconfig.io/proxy.conf;
}
# additional config
include nginxconfig.io/general.conf;
}
# subdomains redirect
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name *.server1.site.com;
# SSL
ssl_certificate /etc/letsencrypt/live/server1.site.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/server1.site.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/server1.site.com/chain.pem;
return 301 https://server1.site.com$request_uri;
}
# HTTP redirect
server {
listen 80;
listen [::]:80;
server_name .server1.site.com;
include nginxconfig.io/letsencrypt.conf;
location / {
return 301 https://server1.site.com$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name server2.site.com;
root /var/www/server2.site.com/public;
# SSL
ssl_certificate /etc/letsencrypt/live/server2.site.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/server2.site.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/server2.site.com/chain.pem;
# security
include nginxconfig.io/security.conf;
# reverse proxy
location / {
proxy_pass http://10.0.0.2:80;
include nginxconfig.io/proxy.conf;
}
# additional config
include nginxconfig.io/general.conf;
}
# subdomains redirect
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name *.server2.site.com;
# SSL
ssl_certificate /etc/letsencrypt/live/server2.site.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/server2.site.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/server2.site.com/chain.pem;
return 301 https://server2.site.com$request_uri;
}
# HTTP redirect
server {
listen 80;
listen [::]:80;
server_name .server2.site.com;
include nginxconfig.io/letsencrypt.conf;
location / {
return 301 https://server2.site.com$request_uri;
}
}
process = subprocess.Popen(['ping', '-c 4', 'python.org'],
stdout=subprocess.PIPE,
universal_newlines=True)
while True:
output = process.stdout.readline()
print(output.strip())
# Do something else
return_code = process.poll()
if return_code is not None:
print('RETURN CODE', return_code)
# Process has finished, read rest of the output
for output in process.stdout.readlines():
print(output.strip())
break
В первом нужно вручную указывать столбцы, количество столбцов большое.
Второй не получается установить. Ошибки какие-то.