brew install gcc
brew install git
brew install postgresql@14
brew install wget
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
/* Useful celery config. | |
app = Celery('tasks', | |
broker='redis://localhost:6379', | |
backend='redis://localhost:6379') | |
app.conf.update( | |
CELERY_TASK_RESULT_EXPIRES=3600, | |
CELERY_QUEUES=( | |
Queue('default', routing_key='tasks.#'), |
Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им логина/пароля с данными сохранёнными в базе данных.
Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.
Например после аутентификации юзер sasha получает право обращатся и получать от ресурса "super.com/vip" некие данные. Во время обращения юзера sasha к ресурсу vip система авторизации проверит имеет ли право юзер обращатся к этому ресурсу (проще говоря переходить по неким разрешенным ссылкам)
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
Some useful Python one-liners taken from http://www.reddit.com/r/Python/comments/fofan/suggestion_for_a_python_blogger_figure_out_what/ | |
All modules listed are part of the standard library and should work with Python 2.6+ | |
How to use: | |
$ python -m [module] [arguments] | |
calendar - does default to displaying a yearly calendar, but it has a bunch of options (args are year or year month, options are HTML output, calendar locale, encoding, and some type-specific stuff, see python -m calendar -h) | |
cgi, dumps a bunch of information as HTML to stdout |
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
CACHE = dict() | |
def cached(ttl, cache, logger=None): | |
"""Caching decorator with parameters | |
:param ttl: time to live for the data | |
:type int | |
:param cache: cache object | |
:type dict | |
:param logger: logger to use |
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
# -*- coding: utf8 -*- | |
import json | |
from datetime import datetime | |
import requests | |
class MyShows(object): | |
API_URL = 'https://api.myshows.me/v2/rpc/' |
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
# ll | |
-rwxr--r-- 1 root root 305 May 17 04:45 gen_conf.py | |
drwxr-xr-x 2 root root 4096 May 17 03:24 templates | |
-rw-r--r-- 1 root root 6 May 17 03:15 vars.csv | |
# cat templates/test.conf | |
line 1 | |
line 2 | |
{% for item in items %}line {{ item }} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import math | |
class TriangleError(Exception): | |
"""docstring for TriangleError | |
error.args - single element tuple which conteins the msg passed to | |
the constructor""" | |
def __init__(self, text, sides): | |
super().__init__(text) | |
self.sides = tuple(sides) |
NewerOlder