Skip to content

Instantly share code, notes, and snippets.

@lmasikl
lmasikl / telegraf.conf
Created January 21, 2022 19:40
Telegraf config
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 100
metric_buffer_limit = 1000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = "0s"
@lmasikl
lmasikl / tmux-cheatsheet.markdown
Created January 30, 2019 07:56 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
default: run
run:
@pipenv run jupyter notebook --ip=0.0.0.0 --config=./jupyter_notebook_config.json
clean:
@find . -name 'doc.*' -not -name doc.ipynb -delete
convert:
@make clean
c = get_config()
c.NbConvertApp.export_format = 'PDF'
c.TemplateExporter.template_path = ['.']
c.Exporter.template_file = 'cyrillic'
image: openjdk:8-jdk
stages:
- build
- package
####################################################################################################
# BUILD
#
@lmasikl
lmasikl / django-grafana-proxy.py
Created May 23, 2018 06:15 — forked from feroda/django-grafana-proxy.py
Django reverse proxy for Grafana SSO
"""
## Install the Django reverse proxy package: `pip install django-revproxy`
## Enable auth.proxy authentication in Grafana like the following
```
[auth.proxy]
enabled = true
header_name = X-WEBAUTH-USER
header_property = username
import asyncio
import json
import time
import uuid
import aiohttp
async def test_register_user(client):
response = await client.post(

Авторизация

Как пользователь приложения я хочу чтобы при запске приложения открывался экран с формой авторизации: username, password и кнопкой login. При нажатии на кнопку логин отправляется запрос:

Запрос

METHOD: POST

URL: 127.0.0.1/api/obtain-auth-token/

class SuperForm(ModelForm):
other_filed = CharField()
class Meta:
model = SuperModel
fields = ('title' , 'number')
public void noDups(){
int in, out;
for (in=0; in < nElems-1; in++){
long temp = a[in];
out = in;
while (out < nElems-1 && a[out+1]==temp){
// До тех пор пока не конец массива или следующий элемент равен текущему
// Заполняем "пустым" значением
a[out]=-1;