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 | |
BACKUP_SERVER=kronos.metadesign.ru | |
BACKUP_DIR=/backup/zeus/all/ | |
RUAUTO_BACKUP_PATH=/db/dumps/pgsql/ruauto.sql.gz | |
DUMP_TMP=tmp/db.sql | |
DUMP_TMP_GZ="$DUMP_TMP.gz" | |
# Text color variables |
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
proxy_cache_path /home/mediavault/cache-mem levels=2:2 keys_zone=ram:400m inactive=48h max_size=26G; | |
proxy_cache_path /home/mediavault/cache-ssd levels=2:2:2 keys_zone=ssd:800m inactive=30d max_size=160G; | |
client_body_temp_path /home/mediavault/cache-mem/tmp; | |
open_file_cache max=5000 inactive=600s; | |
open_file_cache_valid 1200s; | |
open_file_cache_min_uses 2; | |
open_file_cache_errors on; | |
server { |
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 re, logging | |
from django.conf import settings | |
from django.core.handlers.wsgi import STATUS_CODE_TEXT | |
req_handler = logging.FileHandler(settings.HOME_DIR + '/logs/requests.log') | |
req_handler.setLevel(logging.INFO) | |
formatter = logging.Formatter('[%(asctime)s] %(message)s') | |
req_handler.setFormatter(formatter) |
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 code | |
from funcy import ireductions | |
def itemcollector(last, x): | |
if "Node ID" in x: | |
return x | |
if "files" not in last: | |
last["files"] = [] | |
last["files"].append(x) |
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
In [1]: class T(tuple): pass | |
In [2]: t = (1, 2) | |
In [3]: t.__class__ = T | |
TypeError: __class__ assignment: only for heap types |
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
from funcy import join | |
def apply_el(data, el): | |
if isinstance(el, str): | |
return {el: data.get(el)} | |
elif isinstance(el, dict): | |
return { | |
k: apply_schema(data.get(k), v) | |
for k, v in el.items() | |
} |
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
errors = {} | |
for key, value in bundle.data.items(): | |
if not some_test(value): | |
if key not in errors: | |
errors[key] = [] | |
errors[key].append('required.') | |
# R1: использовать defaultdict | |
from collections import defaultdict |
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
# Это оригинальный код, всё веселье ниже и по пунктам | |
limit = 5 | |
def intify(array): | |
latest = [] | |
for i in array: | |
row = [] | |
for j in i: | |
row.append(int(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
#!/usr/bin/perl | |
s~^.*//~/~ for @ARGV; | |
system "kdiff3", @ARGV; | |
# kdiff3 %o %m %n -o %t |
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
suor$ npm install node-gd | |
npm http GET https://registry.npmjs.org/node-gd | |
npm http 304 https://registry.npmjs.org/node-gd | |
> [email protected] install /home/suor/projects/mediavault/node_modules/node-gd | |
> node-waf configure build | |
Checking for program g++ or c++ : /usr/bin/g++ | |
Checking for program cpp : /usr/bin/cpp | |
Checking for program ar : /usr/bin/ar |