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
from django.contrib import admin | |
from .models import User | |
admin.site.register([User]) |
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
cat ~/.ssh/id_rsa.pub | ssh REMOTE_USER@REMOTE_IP "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys" | |
// ssh-copy-id REMOTE_USER@REMOTE_IP |
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
#include <ESP8266WiFi.h> | |
#include <TM1637Display.h> | |
#include <ESP8266HTTPClient.h> | |
#include <ESP8266WiFiMulti.h> | |
#include "DHTesp.h" | |
const char* ssid = "HUAWEI-E8372-26A6";//put your wifi ssid here | |
const char* password = "***";//put your wifi password here | |
const int CLK = D2; //Set the CLK pin connection to the display |
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
CREATE TABLE billing.mytable(id integer, name text); | |
INSERT INTO billing.mytable VALUES(1, '1'); | |
INSERT INTO billing.mytable VALUES(2, '2'); | |
INSERT INTO billing.mytable VALUES(3, '3'); | |
UPDATE billing.mytable | |
SET name = Q.name | |
FROM ( | |
SELECT (value->>0)::integer AS id, (value->>1)::decimal AS name |
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
$.validator.addMethod("inn", function (value, element) { | |
var multipliers = [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8], | |
inn = value.split(''), i, j, ch = [0, 0, 0]; | |
for (i = 0; i < 12; i++) | |
for (j = 0; j < 3; j++) | |
if (multipliers[i + j]) | |
ch[j] = ch[j] + inn[i] * multipliers[i + j]; | |
if (inn.length == 10) | |
return inn[9] == ch[2] % 11 % 10; | |
else if (inn.length == 12) |
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 pathToRegexp from 'path-to-regexp'; | |
export const reverse = (path, kwargs={}) => { | |
const toPath = pathToRegexp.compile(path); | |
return toPath(kwargs); | |
}; |
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 DocumentQuerySet(models.QuerySet): | |
def pdfs(self): | |
return self.filter(file_type='pdf') | |
def smaller_than(self, size): | |
return self.filter(size__lt=size) | |
class Document(models.Model): | |
name = models.CharField(max_length=30) | |
size = models.PositiveIntegerField(default=0) |
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
from django import template | |
register = template.Library() | |
class SetVarNode(template.Node): | |
def __init__(self, var_name, var_value): | |
self.var_name = var_name | |
self.var_value = var_value |
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
# Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-36-generic x86_64) | |
# (из коробки) OpenSSL 1.1.0g 2 Nov 2017 | |
# (из коробки) curl 7.58.0 (x86_64-pc-linux-gnu) | |
# PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS ) | |
# Компилим GOST-engine | |
sudo apt install cmake libssl-dev | |
git clone --branch=openssl_1_1_0 https://github.com/gost-engine/engine.git gost-engine/engine | |
cd gost-engine/engine | |
cmake . |
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
EMAIL_HOST = 'smtp.yandex.ru' | |
EMAIL_PORT = 587 | |
EMAIL_HOST_USER = '[email protected]' | |
EMAIL_HOST_PASSWORD = 'password' | |
DEFAULT_FROM_EMAIL = '[email protected]' | |
EMAIL_USE_TLS = True |
NewerOlder