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
upstream backend { | |
server wearespb.bnvt.ru; | |
} | |
upstream frontend { | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 80; | |
server_name localhost; |
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
docker run -it -v /pgdata:/var/lib/postgres/data postgres:10 /bin/bash | |
gosu postgres pg_resetwal -f /var/lib/postgres/data |
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
[ | |
{ | |
"id": 369, | |
"day": 108, | |
"order": 0, | |
"question": "Question 1", | |
"answers": [ | |
{ | |
"id": 1101, | |
"title": "1", |
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
# Python and Go | |
def (*args) -> func (args...) | |
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
# Solves: | |
# error: Couldn't set refs/heads/branchName | |
# To X:xxx.git | |
# ! [remote rejected] branchName -> branchName (failed to write) | |
# error: failed to push some refs to 'X:xxx.git' | |
git fsck —unreachable | |
git reflog expire —expire=0 —all | |
git repack -a -d -l | |
git prune |
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
# Dump database from container | |
docker exec -t %CONTAINER_NAME% pg_dumpall -c -U %USER% | gzip > /tmp/dump_`date +%d-%m-%Y"_"%H_%M_%S`.gz |
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
function download(filename, text) { | |
var element = document.createElement('a'); | |
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); | |
element.setAttribute('download', filename); | |
element.style.display = 'none'; | |
document.body.appendChild(element); | |
element.click(); |
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
// You must set the timezone offset by JavaScript into cookies using JavaScript | |
var userDate = new Date(); | |
var tzOffset = userDate.getTimezoneOffset(); | |
// Now set the cookie | |
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
class Item(model.Model): | |
# что-то | |
def get_options(self): | |
"""Получить опции этого Item в JSON""" | |
item_options = ItemOption.objects.all(item__id=self.id): | |
for topic in item_options.values_list('option__topic').distinct(): | |
data = {'name': topic.name, 'options': []} |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from datetime import timedelta, datetime | |
from time import sleep | |
from functools import partial | |
class Cache(object): | |
"""Class caching function's results for some time. |
NewerOlder